1

Blindly following an installation tutorial, I ended up with both certbot-auto (git clone to /etc/letsencrypt) and the actual certbot tool. Now I would really like to clean-up my Ubuntu installation and ultimatelly end up with only the up-to-date certbot, but also keep the existing certificates and configuration.

Vince
  • 11
  • 4

1 Answers1

0

Here is what I ended up doing. Hope someone finds it usefull.

  1. backup the entire /etc/letsencrypt directory to root's home cp -r /etc/letsencrypt ~

  2. remove everything rm -rf /etc/letsencrypt

  3. force reinstall certbot sudo apt-get install certbot --reinstall

  4. request a new certificate using certbot:

sudo certbot certonly --authenticator standalone -d webmail.hell.org --pre-hook "service nginx stop" --post-hook "service nginx start"

This created the directory structure under /etc/letsencrypt

accounts      
archive       
csr           
keys          
live          
renewal       
renewal-hooks 
  1. from the above backup path, overwrite one-by-one the original directories
cd /etc/letsencrypt/
cp -r ~/letsencrypt/accounts ./
cp -r ~/letsencrypt/accounts/ ./
cp -r ~/letsencrypt/archive ./
cp -r ~/letsencrypt/csr ./
cp -r ~/letsencrypt/keys ./
cp -r ~/letsencrypt/live ./
cp -r ~/letsencrypt/renewal ./
cp -r ~/letsencrypt/renewal-hooks ./
  1. Reboot to be absolutely sure.

  2. Test email, webmail and web servers are all up and running.

  3. Do a mock certbot renewal

certbot renew --dry-run

If you get a warning message akin to:

Attempting to parse the version 1.9.0 renewal configuration file found at /etc/letsencrypt/renewal/mail.hell.org.conf with version 0.31.0 of Certbot. This might not work.

a) ignore it,

b) edit the file in question and set the version to 0.31.0

This is becasue the renewal configuration was made with certbot-auto which had a version number completely unrelated to certbot.

Vince
  • 11
  • 4
  • To fix the "Attempting to parse the version 1.9.0…" notice, a simple shorthand replaces the version number for all configurations: `sed -i 's/1.9.0/0.31.0/' /etc/letsencrypt/renewal/*.conf`. – royarisse Feb 14 '23 at 12:12