Set default CN name for multiple certificate?

Hey folks,

i renew my certificate via certbot and now the CN-name points to dyndns.ambiente.one instead of ambiente.one as it was before.

The certificate which i have requested contains further DNS-names.

For that i'm using a config-file which i parse to certbot.

authenticator = webroot
rsa-key-size = 4096
text = True
webroot-map = {"ambiente.one,www.ambiente.one,mail.ambiente.one,imap.ambiente.one,smtp.ambiente.one":"/full/path/1", "dyndns.ambiente.one":"/full/path/2", "preview.ambiente.one":"/full/path/3"}

Is there an option where i can prefer a default CN-name for this certificate?

Hmm… seems it isn’t possible?

Can you confirm that you’re using the latest version of certbot? The client should preserve the common name during renewal since version 0.8.1. I assume you used the renew subcommand here.

If this is indeed the reason, upgrading won’t fix this, as the now incorrect common name will be preserved instead of the original one. You’d have to re-issue the certificate using the command you originally used to get the certificate, and after that the common name should stick.

Thanks @pfg for looking into this. :slight_smile:

My version is 0.9.3-r1 on Gentoo Linux.

Sure, i used renew mostly for automation but tried certonly right now too - same result:

certbot certonly --config /etc/letsencrypt/configs/ambiente.one.conf

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org
Cert not yet due for renewal

You have an existing certificate that contains exactly the same domains you requested and isn't close to expiry.
(ref: /etc/letsencrypt/renewal/ambiente.one.conf)

What would you like to do?

1: Keep the existing certificate for now
2: Renew & replace the cert (limit ~5 per 7 days)

Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
Renewing an existing certificate
Performing the following challenges:
http-01 challenge for dyndns.ambiente.one
http-01 challenge for ambiente.one
http-01 challenge for www.ambiente.one
http-01 challenge for mail.ambiente.one
http-01 challenge for imap.ambiente.one
http-01 challenge for smtp.ambiente.one
http-01 challenge for preview.ambiente.one
Waiting for verification...
Cleaning up challenges

The content of ambiente.one.conf is a post above.

Thanks. I did some further testing and can confirm that webroot-map, unlike domain (or -d), does not preserve the domain order for setting the CN. As a workaround, try adding the following line to your configuration and then re-issue with certonly:

domain = ambiente.one,www.ambiente.one,mail.ambiente.one,imap.ambiente.one,smtp.ambiente.one,dyndns.ambiente.one,preview.ambiente.one

The CN field should be set to the first domain in that list.

I’ve filed a bug for this:

2 Likes

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