I’m trying to setup Caddy webserver as a reverse proxy in front of LXD API.
The problem so far seems to be client authentication: Caddy terminates TLS connection, so it wont send the client certificate to LXD backend.
This is a direct connection to LXD (Port 8443, without reverse proxy):
curl -ks --cert ~/lxd.crt https://lxd-server.my-domain.org:8443/1.0 | jq .metadata.auth
"trusted"
Note: ~/lxd.crt
is a concatenation of client.crt
and client.key
of my local LXD client, which is already added to the trusted list in the remote server.
And this is using Caddy as reverse proxy:
curl -s --cert ~/lxd.crt https://lxd-server.my-domain.org/1.0 | jq .metadata.auth
"untrusted"
For reference, this is the output of lxc config show
:
config:
core.https_address: :8443
In Caddy forum they recommend passing the certificate as a HTTP header to the backend. So this is my Caddyfile:
lxd-server.my-domain.org {
reverse_proxy https://127.0.0.1:8443 {
transport http {
tls_trusted_ca_certs /var/snap/lxd/common/lxd/server.crt
}
header_up Client-Cert {tls_client_certificate_der_base64}
}
}
But this is not working.
My questions: Is this actually possible?, Does LXD accept the client certificate for authentication as a HTTP header? And if so, which header?
Thank you for your time.