so last week I issued a wildcard certificate for a domain. We are now moving from hosting provider and wonder if I should port the existing certificates to the new server or just issue a new one + revoke the old one.
Is it good practice to just change the server mantaining the certificate? If so, what is the best way to do it.
You should copy all of /etc/letsencrypt/, preserving the symlinks. Certbot won’t work right if its files get damaged. Particularly automatic renewal.
If there are multiple certificates and you don’t want to copy all of them, at least copy /etc/letsencrypt/accounts/, /etc/letsencrypt/archive/example.com/, /etc/letsencrypt/live/example.com/ and /etc/letsencrypt/renewal/example.com.conf.
Or copy everything and delete the others with “certbot delete”.
One benefit of issuing a new certificate, whether or not you also revoke the old one, is that it ensures Certbot is working. It would be unfortunate to discover something went wrong in the move only when it comes time to renew.
Thank you @jvanasco and @mnordhoff for your responses. I can also replicate your solution with success.
Don’t know if this is still relevant to this post, but what about backing up /etc/letsencrypt/accounts/, even if I just issue a new certificate. Are there any advantages in backing up accounts?
If you're not copying any other /etc/letsencrypt/ files, you normally don't need to copy the accounts. It's common for people to have numerous accounts on different servers.
The main exception is if you have a rate limit exemption tied to your account. (If you did file the form and get one, you would remember.)
There's also an account creation rate limit: if you were creating dozens of accounts all day, hit the rate limit, and can't create any more for 3 hours, you might want to copy one.
Yep. You can just find/replace the account string into a new account though.
A bonus for copying the accounts is that you don't have to agree to a TOS when the client authenticates to the ACME server. You also need them to revoke certificates.