I have a Debian 10 buster server, one of several identical hardware/software configs. I use a script that deploys them, they are all identical. However, one of them is throwing an error when using wget:
# wget https://mirrors.edge.kernel.org/pub/linux/kernel/v5.x/linux-5.6.15.tar.xz
--2020-05-30 12:49:20-- https://mirrors.edge.kernel.org/pub/linux/kernel/v5.x/linux-5.6.15.tar.xz
Resolving mirrors.edge.kernel.org (mirrors.edge.kernel.org)... 147.75.69.165, 2604:1380:1000:8100::1
Connecting to mirrors.edge.kernel.org (mirrors.edge.kernel.org)|147.75.69.165|:443... connected.
ERROR: The certificate of ‘mirrors.edge.kernel.org’ is not trusted.
ERROR: The certificate of ‘mirrors.edge.kernel.org’ has expired.
Things I’ve done:
- Checked that the SSL certificate is valid
- Confirmed the exact same command works on other servers
- Checked the system date, confirmed correct
- Checked resolv.conf, configuring for 8.8.8.8 8.8.4.4 identical to others
- Checked name resolution manually, working fine
- Reinstall
apt-get install --reinstall ca-certificates
- Ran
update-ca-certificates --fresh
- Ran
c_rehash
- Used curl, it works fine without errors, shows correct SSL expiration
The problem seems to only be wget from what I can tell. I don’t need a workaround. I need a solution so I have confidence this server is operating as it should.
3
Answers
I was able to solve my own problem using
--no-dns-cache
After this, it apparently updated whatever file was broken. It now works without the --no-dns-cache as well. So strange, but it seems stable.
I have the same symptom for f-droid.org:
In my case (Debian 9 stretch), curl doesn’t work either:
Looking at wget source one can see the error comes from status flag returned by gnutls_certificate_verify_peers2. We can ask gnutls to show certificate verification details:
So the problem is the USERTrust RSA Certification Authority certificate supplied by the server
f-droid.org
. This is an intermediate cert signed by AddTrust External CA Root that expired 4 days ago.The Debian
ca-certificates
package has a self-signed (root) certificate for USERTrust RSA Certification Authority:…but gnutls is confused by the expired cert supplied by the server, hence the error.
In your case (
mirrors.edge.kernel.org
) the certificate chain is as follows:Again we see USERTrust RSA Certification Authority, but here it’s a self-signed (root) certificate, not expired. I guess kernel.org did supply expired intermediate certificate too, but corrected under your hands. I think
--no-dns-cache
is irrelevant, mere coincidence.Incidentally, Firefox displays https://f-droid.org just fine.
Show page info
/Security
reveals new self-signed (root) USERTrust cert:Not after: 18 January 2038, 23:59:59 GMT
. That is, Firefox ignored the expired intermediate USERTrust cert supplied by the server, used the valid root USERTrust cert available locally.Resolution? The server webmaster should remove the obsolete intermediate certificate from the server configuration. In the meantime, use Firefox (or curl, if it works) instead of wget.
Update: as f-droid people pointed out, the gnutls bug is fixed already, the fix should be in Debian-security soon.
My problem was with the Let’s Encrypt cert, it said the same, on Debian 8.
My solution:
With the gnutls-cli command above I was able to look into the whole chain and it gave me a little more information, which eventually led me here: https://letsencrypt.org/docs/dst-root-ca-x3-expiration-september-2021/
With this information I issued
Unselected the already expired DST Root CA X3
And it started to work.