Skip to content

Commit

Permalink
fix(webhook): disable tsl 1.0 and 1.1 on webhook service
Browse files Browse the repository at this point in the history
ref: longhorn/longhorn 8387

Signed-off-by: Jack Lin <jack.lin@suse.com>
  • Loading branch information
ChanYiLin authored and mergify[bot] committed May 6, 2024
1 parent 1d143a6 commit a2dd56a
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions webhook/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package server

import (
"context"
"crypto/tls"
"fmt"
"net/http"
"reflect"
Expand Down Expand Up @@ -33,6 +34,17 @@ var (
sideEffectClassNone = admissionregv1.SideEffectClassNone
)

var (
whiteListedCiphers = []uint16{
tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,
tls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,
}
)

type WebhookServer struct {
context context.Context
namespace string
Expand Down Expand Up @@ -178,6 +190,10 @@ func (s *WebhookServer) runAdmissionWebhookListenAndServe(handler http.Handler,
tlsName,
},
FilterCN: dynamiclistener.OnlyAllow(tlsName),
TLSConfig: &tls.Config{
MinVersion: tls.VersionTLS12,
CipherSuites: whiteListedCiphers,
},
},
})
}
Expand Down Expand Up @@ -237,6 +253,10 @@ func (s *WebhookServer) runConversionWebhookListenAndServe(handler http.Handler,
tlsName,
},
FilterCN: dynamiclistener.OnlyAllow(tlsName),
TLSConfig: &tls.Config{
MinVersion: tls.VersionTLS12,
CipherSuites: whiteListedCiphers,
},
},
})
}
Expand Down

0 comments on commit a2dd56a

Please sign in to comment.