Skip to content

Commit

Permalink
[EOS-12641] Client certificate auth is broken in ingress-nginx-contro…
Browse files Browse the repository at this point in the history
…ller
  • Loading branch information
vjacynycz committed Apr 4, 2024
1 parent 1e7e2da commit 07dfcbb
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions internal/ingress/annotations/authtls/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"regexp"

"k8s.io/ingress-nginx/internal/ingress/annotations/parser"
"k8s.io/ingress-nginx/internal/ingress/errors"
ing_errors "k8s.io/ingress-nginx/internal/ingress/errors"
"k8s.io/ingress-nginx/internal/ingress/resolver"
"k8s.io/ingress-nginx/internal/k8s"
Expand Down Expand Up @@ -95,28 +96,28 @@ func (a authTLS) Parse(ing *networking.Ingress) (interface{}, error) {
config := &Config{}

tlsauthsecret, err := parser.GetStringAnnotation("auth-tls-vault", ing)
if err != nil {
return &Config{}, err
if err != nil && !errors.IsMissingAnnotations(err) {
return config, err
}

// If there is no secret in vault check for K8s secret
if tlsauthsecret == "" {
tlsauthsecret, err := parser.GetStringAnnotation("auth-tls-secret", ing)
tlsauthsecret, err = parser.GetStringAnnotation("auth-tls-secret", ing)
if err != nil {
return &Config{}, err
return config, err
}
secretInVault = false

_, _, err = k8s.ParseNameNS(tlsauthsecret)
if err != nil {
return &Config{}, ing_errors.NewLocationDenied(err.Error())
return config, ing_errors.NewLocationDenied(err.Error())
}
}

authCert, err := a.r.GetAuthCertificate(tlsauthsecret, secretInVault)
if err != nil {
e := fmt.Errorf("error obtaining certificate: %w", err)
return &Config{}, ing_errors.LocationDenied{Reason: e}
return config, ing_errors.LocationDenied{Reason: e}
}
config.AuthSSLCert = *authCert

Expand Down

0 comments on commit 07dfcbb

Please sign in to comment.