File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -2,9 +2,11 @@ package api
22
33import (
44 "context"
5+ "crypto/tls"
6+ "net/http"
7+
58 "github.com/goharbor/harbor-scanner-clair/pkg/etc"
69 log "github.com/sirupsen/logrus"
7- "net/http"
810)
911
1012type Server struct {
@@ -43,6 +45,24 @@ func (s *Server) listenAndServe() error {
4345 }).Debug ("Starting API server with TLS" )
4446 return s .server .ListenAndServeTLS (s .config .TLSCertificate , s .config .TLSKey )
4547 }
48+
49+ s .server .TLSConfig = & tls.Config {
50+ PreferServerCipherSuites : true ,
51+ CurvePreferences : []tls.CurveID {
52+ tls .CurveP256 ,
53+ tls .X25519 ,
54+ },
55+ MinVersion : tls .VersionTLS12 ,
56+ CipherSuites : []uint16 {
57+ tls .TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 ,
58+ tls .TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305 ,
59+ tls .TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 ,
60+ tls .TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305 ,
61+ tls .TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 ,
62+ tls .TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 ,
63+ },
64+ }
65+
4666 log .WithField ("addr" , s .config .Addr ).Warn ("Starting API server without TLS" )
4767 return s .server .ListenAndServe ()
4868}
You can’t perform that action at this time.
0 commit comments