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.
- 11
- 4
1 Answers
Here is what I ended up doing. Hope someone finds it usefull.
backup the entire
/etc/letsencryptdirectory to root's homecp -r /etc/letsencrypt ~remove everything
rm -rf /etc/letsencryptforce reinstall certbot
sudo apt-get install certbot --reinstallrequest 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
- 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 ./
Reboot to be absolutely sure.
Test email, webmail and web servers are all up and running.
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.
- 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