work-work.work-logo: A man with brains and a shovel

work-work.work

A blog about goals and obstacles, motivation and procrastination, life's random events and getting things done.

Migrate your letsencrypt certbot files

Running your webserver over https is so much easier nowadays thanks to letsencrypt.

How do you move your certificates to a new server? Simply copy your ./etc/letsencrypt folder.

Just pay attention to preserve the links.

Either use rsync with the -a option or create a tar archive that you move. If prevent root from ssh-ing into your server, you can create a tar archive and move that.

server1

joe  $ sudo -i
root $ tar -cf /etc/letsencrypt /home/joe/letsencrypt.tar

server 2

joe $ rsync -ave 'ssh' server1:/home/joe/letsencrypt.tar /home/joe/
joe $ sudo -i
root $ cd /etc/
root $ tar -xf /home/joe/letsencrypt.tar .

Now you can test if certbot works

root $ certbot --dry-run renew

It will try to obtain a certificate without installing it.