Skip to content

Adding cert to multiple servers

serverco edited this page Dec 22, 2016 · 2 revisions

You can upload the cert to multiple servers by separating locations with a semi-colon for example

DOMAIN_PEM_LOCATION="ssh:server1:/etc/ssl/domain.pem;ssh:server2:/etc/ssl/domain.pem;ssh:server3:/etc/ssl/domain.pem"

would upload the certificate, via ssh, to server1, server2 and server3.

Whilst the getssl script can uploads the certificates to multiple location you specify, it only checks the server is installed correctly one server.

To overcome this, simply create a bash script which does the following;

loop over all servers 
- copy certificates to server x
- restart services on server x
- pause a couple of seconds 
- check cert is correctly installed on server x
end of loop
return an error if there were any problems. 

make sure this script has executable permissions, and then call it in the RELOAD_CMD in the config for that certificate.

Once a certificate has been obtained, this will then be run - and automatically copy the certificate to all the domains / servers you require and restart the services required.