caddy: http.request.tls.client.* placeholder broken for Caddy 2.6.3+
Let me first say thanks for this awesome product ! The bug I am about to “complain” is rather a first world problem^^
I am using following matcher to decide whenever I am on a “safe” client (with installed client certificate) or some “public” machine (fallback to Authelia):
@missing_mTLS_cert {
expression {tls_client_subject} == null
}
forward_auth @missing_mTLS_cert ... {
....
}
Everything was working fine until 2.6.3 … Starting from this version it become unstable… Now even with a valid certificate it randomly fails (placeholder not set (?)). forcing me to login with Authelia …
Thanks!
About this issue
- Original URL
- State: open
- Created a year ago
- Reactions: 1
- Comments: 28 (15 by maintainers)
Dear all:
Thank you all for this thread. For me, the issue is that I was using
{http.request.tls.client.certificate}instead of{http.request.tls.client.certificate_der_base64}.So thank you for your time, @mholt
Greetings and best wishes!
Yeah long story, I used a mod by someone in a different issue to get around this since Caddy doesn’t wrap certs in escape characters–it was unrelated to the issue so I didn’t want to bog down my already-wordy paragraphs with extraneous details.
This is a lack of an understanding of how curl processes the
--nextrequest on my side then.Let’s put a pin in this for now. I will do more testing on my side and see if I can recreate the issue I am having in the web browsers I tested with curl, instead. The workaround for now is to disable HTTP3, which allows users to successfully use require_and_verify. I will also see if this behavior occurs with other web servers (Nginx, Apache, etc.) to see if it’s an issue that is only related to web browsers.
I think the issue should be left as open with needs info. I will update as soon as I can, likely after Hacker Summer Camp. Sorry for the delays on my end.
ALCON,
I am having the same issue where Caddy v2.6.4 only sometimes passes the client certificate to the backend server (in my case, Keycloak, but it shouldn’t matter whether it’s Keycloak, Authelia, or Authentik). Note that this issue only occurs if H3 is enabled and
verify_if_givenis used. Ifrequire_and_verifyis used, this issue doesn’t occur. Below is my CaddyfileAttached here is my debug log. Note that I removed the following from the logs, do let me know if it is an issue:
Another difference is I cannot recreate the issue with curl. It seems to only occur with browsers (Firefox, Chrome) and only sometimes. I know this is unhelpful. I will also try the latest alpha version, as well, and comment here.
@francislavoie You are right! I don’t see any http3 requests when testing with 2.6.2.
The behavior changed with 2.6.3+
Hmm. So you’re saying it seems broken for H3 requests but it works fine for H1/H2? Okay. Are you sure it worked with H3 with prior versions? I’m trying to understand what you’re actually describing as broken and when.
Please try v2.7.0-beta.1, we’ve made a lot of changes since 2.6.4, some of which may have already fixed it.