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

FTL.log; WARNING SSL/TLS certificate <FILE> does not match domain <DOMAIN>! #2227

Open
Eddict opened this issue Feb 21, 2025 · 7 comments
Open

Comments

@Eddict
Copy link

Eddict commented Feb 21, 2025

Versions

  • Pi-hole: Core version is v6.0.1 (Latest: v6.0.1)
  • AdminLTE: Web version is v6.0 (Latest: v6.0)
  • FTL: FTL version is v6.0 (Latest: v6.0)

Platform

  • OS and version: Debian GNU/Linux 12 (bookworm)
  • Platform: Proxmox container

Expected behavior

I would not expect this warning as my certificate is a wildcard SSL certificate

Actual behavior / bug

webserver.webserver.tls points to a valid TLS (SSL) certificate file, which is a wildcard certifcate.
CN = domain.com
subject alt names contains "domain.com", ".domain.com" and ".sub.domain.com"

webserver.domain is set to "sub.domain.com"

Steps to reproduce

Steps to reproduce the behavior:

test above with a wildcard certificate containing "domain.com", ".domain.com" and ".sub.domain.com" and set webserver.domain to "sub.domain.com". restart pihole-FTL service

Debug Token

Screenshots

Additional context

@DL6ER
Copy link
Member

DL6ER commented Feb 21, 2025

FTL should check the extra SAN domains. Could you please run

pihole-FTL --read-x509 /etc/pihole/tls.pem | pihole tricorder

and provide the uploaded token? You should first run it without the "| pihole tricorder" to see there is nothing bad uploaded. If you don't want this, you can also post it here in sanitized form. I somehow have the feeling there my be no exact match somewhere as you said "wildcard". This may be confusing FTL.

@Eddict
Copy link
Author

Eddict commented Feb 21, 2025

i ran the command, but pointing to another file (the /etc/pihole/tls.pem is still the default pi.hole certificate).
i used the same file as in toml setting [webserver.tls].cert

https://tricorder.pi-hole.net/aQ2BTQC6/

@RyeNCode
Copy link

I posted what appears to be a duplicate issue as #2277 (sorry)!

However, I do think I found the cause (wrong strncasecmp compare length used) in a flow that is only used when checking against a wildcard certificate.
Oddly testing the domain *.yourdomain.tld would match a cert with a SAN *.yourdomain.tld

@RyeNCode RyeNCode marked this as a duplicate of #2277 Feb 25, 2025
@iShark5060
Copy link

Got the same issue, also with a wildcard cert.
https://tricorder.pi-hole.net/WoHnNgnE/

at least chrome doesn't complain (duh, the cert is valid)
Image

@RyeNCode
Copy link

RyeNCode commented Feb 25, 2025 via email

@DL6ER
Copy link
Member

DL6ER commented Feb 26, 2025

Sorry for the long delay... Seems you are right with assuming there is a length check issue in strcasecmp(). In some cases, it still works (when the next byte after the SAN happens to be nul) but that is not guaranteed. Could you please verify

sudo pihole checkout ftl fix/san_wildcard

fixes this for you? The certificate is always used, even when FTL finds a mismatch as the error message in your browser (that the domain is incorrect) is probably more helpful for you to debug than us simply rejecting the certificate and you first have to look for and then read the log files.

@RyeNCode
Copy link

@DL6ER I have just tested that, first locally with the branch and confirmed that the --read-x509 with a check domain command now behaves as expected. I performed the on-system pihole checkout operation successfully and it also no longer produces the previous warning and validates the wildcard correctly.
(The code change is precisely what I came up with when doing my diagnosis too /toot-my-own-horn 👍 )

I say the fix/san_wildcard fix addresses the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants