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

Add support for CRL when using TLS Auth #618

Merged
merged 1 commit into from Oct 12, 2017
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion hack/docker/voyager/templates/http-frontend.cfg
@@ -1,6 +1,6 @@
frontend {{ .FrontendName }}
{{ if .OffloadSSL -}}
bind *:{{ .Port }} {{ if .AcceptProxy }}accept-proxy{{ end }} ssl no-sslv3 no-tlsv10 no-tls-tickets crt /etc/ssl/private/haproxy/tls/ {{ if .TLSAuth }} ca-file /etc/ssl/private/haproxy/ca/{{ .TLSAuth.CAFile }} verify {{ .TLSAuth.VerifyClient }} {{ if .TLSAuth.ErrorPage }}crt-ignore-err all {{end}}{{ end }} alpn http/1.1
bind *:{{ .Port }} {{ if .AcceptProxy }}accept-proxy{{ end }} ssl no-sslv3 no-tlsv10 no-tls-tickets crt /etc/ssl/private/haproxy/tls/ {{ if .TLSAuth }} ca-file /etc/ssl/private/haproxy/ca/{{ .TLSAuth.CAFile }} {{ if .TLSAuth.CRLFile }} crl-file /etc/ssl/private/haproxy/ca/{{ .TLSAuth.CRLFile }}{{ end }} verify {{ .TLSAuth.VerifyClient }} {{ if .TLSAuth.ErrorPage }}crt-ignore-err all {{end}}{{ end }} alpn http/1.1
# Mark all cookies as secure
rsprep ^Set-Cookie:\ (.*) Set-Cookie:\ \1;\ Secure
{{- if .EnableHSTS }}
Expand Down
2 changes: 1 addition & 1 deletion hack/docker/voyager/templates/tcp-frontend.cfg
@@ -1,5 +1,5 @@
frontend {{ .FrontendName }}
bind *:{{ .Port }} {{ if .AcceptProxy }}accept-proxy{{ end }} {{ if .SecretName }}ssl no-sslv3 no-tlsv10 no-tls-tickets crt /etc/ssl/private/haproxy/tls/{{ .SecretName }} {{ end }} {{ if .TLSAuth }} ca-file /etc/ssl/private/haproxy/ca/{{ .TLSAuth.CAFile }} verify {{ .TLSAuth.VerifyClient }}{{ end }} {{ if .ALPNOptions }}{{ .ALPNOptions }}{{ end }}
bind *:{{ .Port }} {{ if .AcceptProxy }}accept-proxy{{ end }} {{ if .SecretName }}ssl no-sslv3 no-tlsv10 no-tls-tickets crt /etc/ssl/private/haproxy/tls/{{ .SecretName }} {{ end }} {{ if .TLSAuth }} ca-file /etc/ssl/private/haproxy/ca/{{ .TLSAuth.CAFile }} {{ if .TLSAuth.CRLFile }} crl-file /etc/ssl/private/haproxy/ca/{{ .TLSAuth.CRLFile }}{{ end }} verify {{ .TLSAuth.VerifyClient }}{{ end }} {{ if .ALPNOptions }}{{ .ALPNOptions }}{{ end }}
mode tcp

{{- if .Limit }}
Expand Down
1 change: 1 addition & 0 deletions pkg/haproxy/types.go
Expand Up @@ -148,6 +148,7 @@ type Limit struct {

type TLSAuth struct {
CAFile string
CRLFile string
VerifyClient string
Headers map[string]string
ErrorPage string
Expand Down
3 changes: 3 additions & 0 deletions pkg/ingress/parser.go
Expand Up @@ -636,6 +636,9 @@ func (c *controller) getTLSAuth(fr api.FrontendRule) (*haproxy.TLSAuth, error) {
Headers: fr.Auth.TLS.Headers,
ErrorPage: fr.Auth.TLS.ErrorPage,
}
if _, ok := tlsAuthSec.Data["crl.pem"]; ok {
htls.CRLFile = fr.Auth.TLS.SecretName + "-crl.pem"
}
if u, err := url.Parse(fr.Auth.TLS.ErrorPage); err == nil {
htls.ErrorPath = u.Path
}
Expand Down
6 changes: 5 additions & 1 deletion pkg/tlsmounter/secret.go
Expand Up @@ -197,7 +197,11 @@ func (c *Controller) projectAuthSecret(r *apiv1.Secret, projections map[string]i
if !found {
return fmt.Errorf("secret %s@%s is missing ca.crt", r.Name, c.options.IngressRef.Namespace)
}

projections["ca/"+r.Name+"-ca.crt"] = ioutilz.FileProjection{Mode: 0755, Data: ca}

crl, found := r.Data["crl.pem"]
if found {
projections["ca/"+r.Name+"-crl.pem"] = ioutilz.FileProjection{Mode: 0755, Data: crl}
}
return nil
}