Skip to content

Commit

Permalink
reverseproxy: Add Caddyfile support for ClientCertificateAutomate
Browse files Browse the repository at this point in the history
  • Loading branch information
mholt committed Jun 8, 2020
1 parent 1dfb114 commit 4b10ae5
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions modules/caddyhttp/reverseproxy/caddyfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -619,15 +619,19 @@ func (h *HTTPTransport) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
h.DialTimeout = caddy.Duration(dur)

case "tls_client_auth":
args := d.RemainingArgs()
if len(args) != 2 {
return d.ArgErr()
}
if h.TLS == nil {
h.TLS = new(TLSConfig)
}
h.TLS.ClientCertificateFile = args[0]
h.TLS.ClientCertificateKeyFile = args[1]
args := d.RemainingArgs()
switch len(args) {
case 1:
h.TLS.ClientCertificateAutomate = args[0]
case 2:
h.TLS.ClientCertificateFile = args[0]
h.TLS.ClientCertificateKeyFile = args[1]
default:
return d.ArgErr()
}

case "tls":
if h.TLS == nil {
Expand Down Expand Up @@ -664,7 +668,6 @@ func (h *HTTPTransport) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
if h.TLS == nil {
h.TLS = new(TLSConfig)
}

h.TLS.RootCAPEMFiles = args

case "tls_server_name":
Expand All @@ -674,7 +677,6 @@ func (h *HTTPTransport) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
if h.TLS == nil {
h.TLS = new(TLSConfig)
}

h.TLS.ServerName = d.Val()

case "keepalive":
Expand Down

0 comments on commit 4b10ae5

Please sign in to comment.