1. The problem I’m having:
I’m trialling caddy as a reverse proxy and have attempted to set up client cert auth as per the docs using the trust_pool file directive. However, I seem to get some strange results that I’m struggling to diagnose. The Home Assistant app which has the client cert works fine. Chrome does not; it throws an error stating ERR_BAD_SSL_CLIENT_AUTH_CERT and never asks me to present a client cert. I’m new to caddy so it’s probably a misunderstanding on my part but I’ve been through the docs and can’t find what I’m doing wrong.
2. Error messages and/or full log output:
Chrome errors:
This site can't provide a secure connection
<FQDN> didn't accept your login certificate, or one may not have been provided
Try contacting the system admin
ERR_BAD_SSL_CLIENT_AUTH_CERT
Caddy access logs look fine, I can’t see anything bouncing there and the caddyfile obviously loads without complaint.
Worryingly, because I don’t understand this issue, the Home Assistant app seems to work fine both across ipv4 and ipv6. Chrome exhibits the same behaviour across both stacks.
3. Caddy version:
v2.8.4 from apt
4. How I installed and ran Caddy:
Installed from apt as per the docs: Install — Caddy Documentation
a. System environment:
AWS Lightsail instance running Ubuntu 22.04 exposing both ipv4 and ipv6 endpoints
b. Command:
$ caddy start
$ caddy reload --config /etc/caddy/Caddyfile
2024/07/21 20:25:39.921 INFO using config from file {"file": "/etc/caddy/Caddyfile"}
2024/07/21 20:25:39.922 INFO adapted config to JSON {"adapter": "caddyfile"}
c. Service/unit/compose file:
n/a
d. My complete Caddy config:
(mutual_tls) {
tls {
protocols tls1.2 tls1.2
client_auth {
mode require_and_verify
#trusted_ca_cert_file /etc/caddy/ca.crt
#trusted_leaf_cert_file /etc/caddy/hass.crt
trust_pool file {
pem_file /etc/caddy/ca.crt
}
}
}
}
# HomeAssistant
<fqdn of caddy> {
log {
output file /var/log/caddy/access.log {
roll_size 10mb
roll_keep 5
roll_keep_for 168h
}
}
import mutual_tls
reverse_proxy https://192.168.100.1:443 {
transport http {
tls_server_name <fqdn of wireguard remote peer which port forwards on to the nginx origin server>
}
}
My ca.crt
file is a PEM encoded openssl generated CA with no intermediate and is valid.
5. Links to relevant resources:
n/a