Using Let’s encrypt with Gandi Simple Hosting in stand alone

Here is how to configure gandi simple hosting by configuring directly the simple hosting instance.
0) simple hosting, instance type M
1) you need SSH access enabled and connected
2) API key (https://wiki.gandi.net/fr/xml-api/activate)

1) install acme.sh
https://github.com/Neilpang/acme.sh
2) use the –force option to bypass the package check and be able to install it without being root 😉
3) modify the anacron file to schedule acme.sh (complete the installation)
edit /srv/data/etc/cron/anacrontab to add
0 0 * * * "/home/hosting-user/.acme.sh/acme.sh" --cron --home "/home/hosting-use
r/.acme.sh" > /dev/null

4) request the certificate once per instance
"/home/hosting-user/.acme.sh/acme.sh" --home "/home/hosting-user/.acme.sh" --issue -d your.domain.com -w /srv/data/web/vhosts/your.domain.com/htdocs
5) write the python script to save the generated certificate file
I called it install_shs.py and installed it in ~/.acme.sh
import xmlrpclib
import sys
api = xmlrpclib.ServerProxy('https://rpc.gandi.net/xmlrpc/')
apikey = 'The API key here'
#version = api.version.info(apikey)
host = sys.argv[1]
#print host
with open('/srv/data/web/vhosts/' + host + '/key.key', 'r') as content_key:
key = content_key.read()

with open('/srv/data/web/vhosts/' + host + '/cert.cer', 'r') as content_crt:
crt = content_crt.read()

options = {'crt': crt, 'key': key}
api.cert.hosted.create(apikey, options)

6) save the certificate
“/home/hosting-user/.acme.sh/acme.sh” –home “/home/hosting-user/.acme.sh” –installcert -d your.domain.com –certpath /srv/data/web/vhosts/your.domain.com/cert.cer –keypath /srv/data/web/vhosts/your.domain.com/key.key –fullchainpath /srv/data/web/vhosts/your.domain.com/fullchain.pem –reloadcmd “python /home/hosting-user/.acme.sh/install_shs.py your.domain.com”

Done 😉