mirror of
https://gitee.com/rainbond/Rainbond.git
synced 2024-11-30 02:38:17 +08:00
make ssl_protocols configrable
This commit is contained in:
parent
17fdad609a
commit
9a196dbbdc
@ -24,6 +24,7 @@ type Server struct {
|
||||
ProxyConnectTimeout Time
|
||||
ProxyTimeout Time
|
||||
ProxyPass string
|
||||
SSLProtocols string
|
||||
SSLCertificate string // Specifies a file with the certificate in the PEM format.
|
||||
SSLCertificateKey string // Specifies a file with the secret key in the PEM format.
|
||||
EnableSSLStapling bool
|
||||
|
@ -213,6 +213,7 @@ func (o *OrService) getNgxServer(conf *v1.Config) (l7srv []*model.Server, l4srv
|
||||
},
|
||||
}
|
||||
if vs.SSLCert != nil {
|
||||
server.SSLProtocols = vs.SSlProtocols
|
||||
server.SSLCertificate = vs.SSLCert.CertificatePem
|
||||
server.SSLCertificateKey = vs.SSLCert.CertificatePem
|
||||
server.EnableSSLStapling = o.ocfg.EnableSSLStapling
|
||||
|
@ -565,10 +565,16 @@ func (s *k8sStore) ListVirtualService() (l7vs []*v1.VirtualService, l4vs []*v1.V
|
||||
vs = l7vsMap[virSrvName]
|
||||
if vs == nil {
|
||||
vs = &v1.VirtualService{
|
||||
Listening: []string{strconv.Itoa(s.conf.ListenPorts.HTTP)},
|
||||
ServerName: virSrvName,
|
||||
Locations: []*v1.Location{},
|
||||
Listening: []string{strconv.Itoa(s.conf.ListenPorts.HTTP)},
|
||||
ServerName: virSrvName,
|
||||
Locations: []*v1.Location{},
|
||||
SSlProtocols: "TLSv1.2 TLSv1.3",
|
||||
}
|
||||
sslProtocols := os.Getenv("SSL_PROTOCOLS")
|
||||
if sslProtocols != "" {
|
||||
vs.SSlProtocols = sslProtocols
|
||||
}
|
||||
|
||||
vs.Namespace = ing.Namespace
|
||||
vs.ServiceID = anns.Labels["service_id"]
|
||||
if len(hostSSLMap) != 0 {
|
||||
|
@ -55,6 +55,7 @@ type VirtualService struct {
|
||||
Timeout int `json:"timeout"`
|
||||
ServerName string `json:"server_name"`
|
||||
PoolName string `json:"pool_name"`
|
||||
SSlProtocols string `json:"ssl_protocols"`
|
||||
SSLCert *SSLCert `json:"ssl_cert"`
|
||||
Locations []*Location `json:"locations"`
|
||||
ForceSSLRedirect bool `json:"force_ssl_redirect"`
|
||||
|
@ -14,8 +14,10 @@ server {
|
||||
|
||||
{{ if .SSLCertificate }}
|
||||
# ssl
|
||||
ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
|
||||
ssl_certificate {{.SSLCertificate}};
|
||||
{{ if .SSLProtocols }}
|
||||
ssl_protocols {{.SSLProtocols}};
|
||||
{{ end }}
|
||||
{{ if .EnableSSLStapling }}
|
||||
ssl_stapling on;
|
||||
resolver 8.8.8.8 8.8.4.4 114.114.114.114 valid=300s;
|
||||
|
Loading…
Reference in New Issue
Block a user