Skip to content

Commit

Permalink
fix: handle 401 and 403 by external auth (kubernetes#9131)
Browse files Browse the repository at this point in the history
  • Loading branch information
johanneswuerbach authored and jaehnri committed Jan 2, 2023
1 parent 42f6ad6 commit f8843d3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rootfs/etc/nginx/template/nginx.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,7 @@ stream {
set $proxy_upstream_name "-";

{{ if not ( empty $server.CertificateAuth.MatchCN ) }}
{{ if gt (len $server.CertificateAuth.MatchCN) 0 }}
{{ if gt (len $server.CertificateAuth.MatchCN) 0 }}
if ( $ssl_client_s_dn !~ {{ $server.CertificateAuth.MatchCN }} ) {
return 403 "client certificate unauthorized";
}
Expand Down Expand Up @@ -1288,7 +1288,7 @@ stream {
{{- end }}
return
end
if res.status == ngx.HTTP_FORBIDDEN then
if res.status == ngx.HTTP_UNAUTHORIZED or res.status == ngx.HTTP_FORBIDDEN then
ngx.exit(res.status)
end
ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR)
Expand Down

0 comments on commit f8843d3

Please sign in to comment.