Merge pull request #5166 from janosi/proxy-ssl-name
proxy_ssl_name support
This commit is contained in:
commit
f9e410458c
4 changed files with 24 additions and 4 deletions
|
@ -73,6 +73,7 @@ You can add these Kubernetes annotations to specific Ingress objects to customiz
|
||||||
|[nginx.ingress.kubernetes.io/proxy-http-version](#proxy-http-version)|"1.0" or "1.1"|
|
|[nginx.ingress.kubernetes.io/proxy-http-version](#proxy-http-version)|"1.0" or "1.1"|
|
||||||
|[nginx.ingress.kubernetes.io/proxy-ssl-secret](#backend-certificate-authentication)|string|
|
|[nginx.ingress.kubernetes.io/proxy-ssl-secret](#backend-certificate-authentication)|string|
|
||||||
|[nginx.ingress.kubernetes.io/proxy-ssl-ciphers](#backend-certificate-authentication)|string|
|
|[nginx.ingress.kubernetes.io/proxy-ssl-ciphers](#backend-certificate-authentication)|string|
|
||||||
|
|[nginx.ingress.kubernetes.io/proxy-ssl-name](#backend-certificate-authentication)|string|
|
||||||
|[nginx.ingress.kubernetes.io/proxy-ssl-protocols](#backend-certificate-authentication)|string|
|
|[nginx.ingress.kubernetes.io/proxy-ssl-protocols](#backend-certificate-authentication)|string|
|
||||||
|[nginx.ingress.kubernetes.io/proxy-ssl-verify](#backend-certificate-authentication)|string|
|
|[nginx.ingress.kubernetes.io/proxy-ssl-verify](#backend-certificate-authentication)|string|
|
||||||
|[nginx.ingress.kubernetes.io/proxy-ssl-verify-depth](#backend-certificate-authentication)|number|
|
|[nginx.ingress.kubernetes.io/proxy-ssl-verify-depth](#backend-certificate-authentication)|number|
|
||||||
|
@ -274,6 +275,8 @@ It is possible to authenticate to a proxied HTTPS backend with certificate using
|
||||||
Sets the verification depth in the proxied HTTPS server certificates chain. (default: 1)
|
Sets the verification depth in the proxied HTTPS server certificates chain. (default: 1)
|
||||||
* `nginx.ingress.kubernetes.io/proxy-ssl-ciphers`:
|
* `nginx.ingress.kubernetes.io/proxy-ssl-ciphers`:
|
||||||
Specifies the enabled [ciphers](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_ssl_ciphers) for requests to a proxied HTTPS server. The ciphers are specified in the format understood by the OpenSSL library.
|
Specifies the enabled [ciphers](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_ssl_ciphers) for requests to a proxied HTTPS server. The ciphers are specified in the format understood by the OpenSSL library.
|
||||||
|
* `nginx.ingress.kubernetes.io/proxy-ssl-name`:
|
||||||
|
Allows to set [proxy_ssl_name](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_ssl_name). This allows overriding the server name used to verify the certificate of the proxied HTTPS server. This value is also passed through SNI when a connection is established to the proxied HTTPS server.
|
||||||
* `nginx.ingress.kubernetes.io/proxy-ssl-protocols`:
|
* `nginx.ingress.kubernetes.io/proxy-ssl-protocols`:
|
||||||
Enables the specified [protocols](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_ssl_protocols) for requests to a proxied HTTPS server.
|
Enables the specified [protocols](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_ssl_protocols) for requests to a proxied HTTPS server.
|
||||||
|
|
||||||
|
|
|
@ -45,10 +45,11 @@ var (
|
||||||
// and the configured VerifyDepth
|
// and the configured VerifyDepth
|
||||||
type Config struct {
|
type Config struct {
|
||||||
resolver.AuthSSLCert
|
resolver.AuthSSLCert
|
||||||
Ciphers string `json:"ciphers"`
|
Ciphers string `json:"ciphers"`
|
||||||
Protocols string `json:"protocols"`
|
Protocols string `json:"protocols"`
|
||||||
Verify string `json:"verify"`
|
ProxySSLName string `json:"proxySSLName"`
|
||||||
VerifyDepth int `json:"verifyDepth"`
|
Verify string `json:"verify"`
|
||||||
|
VerifyDepth int `json:"verifyDepth"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Equal tests for equality between two Config types
|
// Equal tests for equality between two Config types
|
||||||
|
@ -143,6 +144,11 @@ func (p proxySSL) Parse(ing *networking.Ingress) (interface{}, error) {
|
||||||
config.Protocols = sortProtocols(config.Protocols)
|
config.Protocols = sortProtocols(config.Protocols)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
config.ProxySSLName, err = parser.GetStringAnnotation("proxy-ssl-name", ing)
|
||||||
|
if err != nil {
|
||||||
|
config.ProxySSLName = ""
|
||||||
|
}
|
||||||
|
|
||||||
config.Verify, err = parser.GetStringAnnotation("proxy-ssl-verify", ing)
|
config.Verify, err = parser.GetStringAnnotation("proxy-ssl-verify", ing)
|
||||||
if err != nil || !proxySSLOnOffRegex.MatchString(config.Verify) {
|
if err != nil || !proxySSLOnOffRegex.MatchString(config.Verify) {
|
||||||
config.Verify = defaultProxySSLVerify
|
config.Verify = defaultProxySSLVerify
|
||||||
|
|
|
@ -128,6 +128,10 @@ func TestAnnotations(t *testing.T) {
|
||||||
if u.VerifyDepth != 3 {
|
if u.VerifyDepth != 3 {
|
||||||
t.Errorf("expected %v but got %v", 3, u.VerifyDepth)
|
t.Errorf("expected %v but got %v", 3, u.VerifyDepth)
|
||||||
}
|
}
|
||||||
|
if u.ProxySSLName != "$host" {
|
||||||
|
t.Errorf("expected %v but got %v", "$host", u.ProxySSLName)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestInvalidAnnotations(t *testing.T) {
|
func TestInvalidAnnotations(t *testing.T) {
|
||||||
|
|
|
@ -813,6 +813,9 @@ stream {
|
||||||
proxy_ssl_protocols {{ $server.ProxySSL.Protocols }};
|
proxy_ssl_protocols {{ $server.ProxySSL.Protocols }};
|
||||||
proxy_ssl_verify {{ $server.ProxySSL.Verify }};
|
proxy_ssl_verify {{ $server.ProxySSL.Verify }};
|
||||||
proxy_ssl_verify_depth {{ $server.ProxySSL.VerifyDepth }};
|
proxy_ssl_verify_depth {{ $server.ProxySSL.VerifyDepth }};
|
||||||
|
{{ if not (empty $server.ProxySSL.ProxySSLName) }}
|
||||||
|
proxy_ssl_name {{ $server.ProxySSL.ProxySSLName }};
|
||||||
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ if not (empty $server.ProxySSL.PemFileName) }}
|
{{ if not (empty $server.ProxySSL.PemFileName) }}
|
||||||
|
@ -1234,6 +1237,10 @@ stream {
|
||||||
proxy_ssl_verify_depth {{ $location.ProxySSL.VerifyDepth }};
|
proxy_ssl_verify_depth {{ $location.ProxySSL.VerifyDepth }};
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if not (empty $location.ProxySSL.ProxySSLName) }}
|
||||||
|
proxy_ssl_name {{ $location.ProxySSL.ProxySSLName }};
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
{{ if not (empty $location.ProxySSL.PemFileName) }}
|
{{ if not (empty $location.ProxySSL.PemFileName) }}
|
||||||
proxy_ssl_certificate {{ $location.ProxySSL.PemFileName }};
|
proxy_ssl_certificate {{ $location.ProxySSL.PemFileName }};
|
||||||
proxy_ssl_certificate_key {{ $location.ProxySSL.PemFileName }};
|
proxy_ssl_certificate_key {{ $location.ProxySSL.PemFileName }};
|
||||||
|
|
Loading…
Reference in a new issue