security: disallow tls1.0/1.1

This commit is contained in:
yusing 2025-05-12 12:22:52 +08:00
parent 99e975145c
commit 453262832a

View file

@ -73,6 +73,7 @@ func NewServer(opt Options) (s *Server) {
Handler: opt.Handler, Handler: opt.Handler,
TLSConfig: &tls.Config{ TLSConfig: &tls.Config{
GetCertificate: opt.CertProvider.GetCert, GetCertificate: opt.CertProvider.GetCert,
MinVersion: tls.VersionTLS12,
}, },
} }
} }
@ -169,7 +170,7 @@ func stop[Server httpServer](srv Server, logger *zerolog.Logger) {
proto := proto(srv) proto := proto(srv)
ctx, cancel := context.WithTimeout(task.RootContext(), 3*time.Second) ctx, cancel := context.WithTimeout(task.RootContext(), 1*time.Second)
defer cancel() defer cancel()
if err := srv.Shutdown(ctx); err != nil { if err := srv.Shutdown(ctx); err != nil {