Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EOS-12641] Client certificate authn is broken in ingress-nginx-controller #32

Merged
merged 6 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,5 @@ images/fastcgi-helloserver/rootfs/fastcgi-helloserver
cmd/plugin/release/ingress-nginx.yaml
cmd/plugin/release/*.tar.gz
cmd/plugin/release/LICENSE

dist/
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# Changelog

## 1.5.1-0.5.0 (2023-07-04)

## 1.5.1-0.5.1 (upcoming)

* [EOS-12641] Client certificate auth is broken in ingress-nginx-controller

## 1.5.1-0.5.0 (2023-07-04)

* Build the stratio ingress-nginx-controller with the community controller:1.5.1 as a base
* Fix vault retrieve secret recode
Expand Down
14 changes: 7 additions & 7 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,27 @@ 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
5 changes: 3 additions & 2 deletions rootfs/Dockerfile.stratio
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@ RUN apk update \
&& apk add make --repository=https://dl-cdn.alpinelinux.org/alpine/v3.14/main \
diffutils make unzip \
&& apk upgrade libxml2 \
&& apk add wget \
&& rm -rf /var/cache/apk/*

# JWT manipulation dependencies
ENV LUAROCKS_VERSION 3.8.0
ENV LUAROCKS_SHA ab6612ca9ab87c6984871d2712d05525775e8b50172701a0a1cabddf76de2be7
ENV LUAROCKS_SHA 56ab9b90f5acbc42eb7a94cf482e6c058a63e8a1effdf572b8b2a6323a06d923

RUN wget -O /tmp/luarocks.tgz \
https://github.com/luarocks/luarocks/archive/v${LUAROCKS_VERSION}.tar.gz \
https://luarocks.github.io/luarocks/releases/luarocks-${LUAROCKS_VERSION}.tar.gz \
&& echo "${LUAROCKS_SHA} */tmp/luarocks.tgz" | sha256sum -c - \
&& tar -C /tmp -xzf /tmp/luarocks.tgz \
&& cd /tmp/luarocks* \
Expand Down