@@ -2,19 +2,21 @@ package webhook
22
33import (
44 "context"
5+ "crypto/tls"
56 "fmt"
67 "net/http"
78 "time"
89
910 "github.com/gorilla/mux"
10- "github.com/harvester/harvester/pkg/webhook/types"
1111 "github.com/rancher/dynamiclistener"
1212 "github.com/rancher/dynamiclistener/server"
1313 "github.com/sirupsen/logrus"
1414 v1 "k8s.io/api/admissionregistration/v1"
1515 corev1 "k8s.io/api/core/v1"
1616 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1717 "k8s.io/client-go/rest"
18+
19+ "github.com/harvester/harvester/pkg/webhook/types"
1820)
1921
2022var (
3032 threadiness = 5
3133 MutatorName = "pcidevices-mutator"
3234 ValidatorName = "pcidevices-validator"
35+ whiteListedCiphers = []uint16 {tls .TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 ,
36+ tls .TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 ,
37+ tls .TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 ,
38+ tls .TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 ,
39+ tls .TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 ,
40+ tls .TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 ,
41+ }
3342)
3443
3544// AdmissionWebhookServer serves the mutating webhook for pcidevices
@@ -156,6 +165,10 @@ func (s *AdmissionWebhookServer) listenAndServe(clients *Clients, handler http.H
156165 tlsName ,
157166 },
158167 FilterCN : dynamiclistener .OnlyAllow (tlsName ),
168+ TLSConfig : & tls.Config {
169+ MinVersion : tls .VersionTLS12 ,
170+ CipherSuites : whiteListedCiphers ,
171+ },
159172 },
160173 })
161174}
0 commit comments