--preferred-chain not taking effect

Maybe I'll have to correct myself back to my original impression and statement. :slight_smile: Thanks, @Osiris!

4 Likes

Maybe indeed. The first part of the OpenSSL output is just like when viewing the cert chain in a browser: it's showing which chain is being build. The second part is more interesting. For example, this is my OpenSSL output for the long chain:

CONNECTED(00000003)
depth=2 C = US, O = Internet Security Research Group, CN = ISRG Root X1
verify return:1
depth=1 C = US, O = Let's Encrypt, CN = R3
verify return:1
depth=0 CN = lencr.org
verify return:1
---
Certificate chain
 0 s:CN = lencr.org
   i:C = US, O = Let's Encrypt, CN = R3
 1 s:C = US, O = Let's Encrypt, CN = R3
   i:C = US, O = Internet Security Research Group, CN = ISRG Root X1
 2 s:C = US, O = Internet Security Research Group, CN = ISRG Root X1
   i:O = Digital Signature Trust Co., CN = DST Root CA X3
---

Notice that the chain send by the server is different (bottom part), but the top part, the chain actually build, is identical to the short chain above! (Besides the hostname of the site of course..) That's because my OpenSSL (1.1.1) will terminate the chain at ISRG Root X1, even with the long chain being send by the server. Just like most browsers.

3 Likes

Yes, for sure.
It's an express server, the files cert.pem and key.pem are copied from /etc/letsencrypt/live/explogroup.ca/cert.pem (and privkey.pem).

const https = require('https');
const privateKey  = fs.readFileSync('key.pem', 'utf8');
const certificate = fs.readFileSync('cert.pem', 'utf8');

const credentials = {key: privateKey, cert: certificate};

const express = require('express');
const path = require('path');
const app = express();

app.use(express.static(path.join(__dirname, 'public')));

app.get('/*', function (req, res) {
          res.sendFile(path.join(__dirname, 'public', 'index.html'));
});

app.listen(80)

const httpsServer = https.createServer(credentials, app);
httpsServer.listen(443);
2 Likes

The real domain is explogroup.ca
I have the certificates in the same folder than my express server. After renewing the certificates I delete the old ones and copy the new ones from /etc/letsencrypt/live/explogroup.ca
The fullchain.pem is the following :

-----BEGIN CERTIFICATE-----
MIIFHzCCBAegAwIBAgISBKtwalzKWKL8v1Qa+lpTjQVlMA0GCSqGSIb3DQEBCwUA
MDIxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBF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3UqQ9hVl3LEKQ73xF1O
yK5GhDDX8oVfGKF5u+decIsH4YaTw7mP3GFxJSqv3+0lUFJoi5Lc5da149p90Ids
hCExroL1+7mryIkXPeFM5TgO9r0rvZaBFOvV2z0gp35Z0+L4WPlbuEjN/lxPFin+
HlUjr8gRsI3qfJOQFy/9rKIJR0Y/8Omwt/8oTWgy1mdeHmmjk7j1nYsvC9JSQ6Zv
MldlTTKB3zhThV1+XWYp6rjd5JW1zbVWEkLNxE7GJThEUG3szgBVGP7pSWTUTsqX
nLRbwHOoq7hHwg==
-----END CERTIFICATE-----
2 Likes

So you're not using fullchain.pem at all? Which is kinda weird, as your site is sending the short chain perfectly.

4 Likes

Oh sorry, I forgot to write that I'm currently trying to use fullchain.pem insteand of cert.pem

About what you wrote yesterday @Osiris , it seems that https://www.lencr.org is working for me, but not https://www.explogroup.ca. By "not working", I mean with Safari on my Macbook I have an issue "This connection is not Private"

Do you have an idea why ?

2 Likes

Thanks! So, your site is currently correctly sending the short chain as you requested to, and your certificate configuration is valid. Are you having some compatibility or validation problems that are still concerning you?

4 Likes

With Safari (version 14.1.2) on my Macbook Pro (macOS Bis Sur version 11.6) I still have the "This connection is not private" issue.
The trouble is that probably several of the visitors of the website will have the issue.
I was wondering if there is a way to fix this :thinking:

2 Likes

www.lencr.org sends the long chain. www.explogroup.ca is using the short chain. Have you tried using the long chain? Was there a reason you needed to use the short chain?

4 Likes

I'm not really familiar with the notions of short chain and long chain :sweat_smile:. So there is no reason why I'm using the short chain, and I think I didn't try to use the long one.
What do I have to do to use the long chain please ? :grin:

(I read the following article Providing a longer certificate chain by default to understand what a long chain is, but do I have it and am using the wrong file, and did I do something wrong when renewing ?)

2 Likes

The long chain is the default.
So the site has switched to using the shorter/alternate chain.

echo | openssl s_client -connect www.explogroup.ca:443 -servername www.explogroup.ca | head
depth=2 C = US, O = Internet Security Research Group, CN = ISRG Root X1
verify return:1
depth=1 C = US, O = Let's Encrypt, CN = R3
verify return:1
depth=0 CN = explogroup.ca
verify return:1
CONNECTED(00000005)
---
Certificate chain
 0 s:CN = explogroup.ca
   i:C = US, O = Let's Encrypt, CN = R3
 1 s:C = US, O = Let's Encrypt, CN = R3
   i:C = US, O = Internet Security Research Group, CN = ISRG Root X1
---

If you can't access the site securely, then your client system lacks the "ISRG Root X1" trusted root cert.

3 Likes

Remove the --preferred-chain option from your command. Then it should work the same for you as www.lencr.org

See:

5 Likes

Thanks for your answers @MikeMcQ @rg305 ,
How could I check if I'm currently using a long or a short chain ?
I try to renew without the preferred-chain and the result is currently in production, but it seems I still have the issue with the Macbook

(It was my 5th try for this domain, so now I reach the rateLimit :open_mouth:)

2 Likes

@jajoe You are still using the short chain. Rudy already showed the command to check the chain your server is currently using. The post I linked to about long/short chains also shows how right at the beginning.

If one of your previous certs was for the default long chain, you could temporarily change your server def to use a set from the /etc/letsencrypt/archive/... folder. Make sure to update your server def back to the live version once you finish.

You can check the chains for a local file a variety of ways - google has many - usually based on a script. But, this works for me:

openssl crl2pkcs7 -nocrl -certfile /etc/letsencrypt/archive/your-folder-name-here/fullchainX.pem | openssl pkcs7 -print_certs -noout

Iterate through each fullchain file until you find one using the long chain and use it and the related key/cert files as needed.

You really should read the "Long and Short Chains Explained" article I linked to previously. You should understand the tradeoffs involved between the two.

You can also make these chains by hand but I would not recommend that until you understand them well.

5 Likes

I found something in the archive, regarding https://decoder.link/sslchecker/explogroup.ca/443 (I tested too with the command shared by Rudy) things seem to be ok. Ok with Safari on my Macbook too !
I'm going to ask some users to check with their devices, but I think the issue is fixed now.
Thank you all for your help :slightly_smiling_face:

3 Likes

Hello,

I came across this thread after trying to use --preferred-chain "ISRG Root X1" without any effect .
in certbot 1.7 (python 3.5)
on debian stretch

I updated to python 3.7
certbot to 1.21
now it works :slight_smile:

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.