Skip to content

Instantly share code, notes, and snippets.

@chrisjung-dev
Last active February 27, 2016 14:52
Show Gist options
  • Save chrisjung-dev/8b649b158f7c993d9745 to your computer and use it in GitHub Desktop.
Save chrisjung-dev/8b649b158f7c993d9745 to your computer and use it in GitHub Desktop.
Uberspace Let's Encrypt
DOMAIN=$(ls ~/.config/letsencrypt/live/ | head -n 1)
uberspace-add-certificate -k ~/.config/letsencrypt/live/${DOMAIN}/privkey.pem -c ~/.config/letsencrypt/live/${DOMAIN}/cert.pem
cat >> ${HOME}/.config/letsencrypt/cli.ini <<__EOF__
# To prevent being forced to agree manually to the terms
agree-dev-preview = True
agree-tos = True
__EOF__
##########################################
cat > ${HOME}/bin/letsencrypt-renew <<__EOF__
#!/bin/bash
PATH=$PATH
DOMAIN=$(ls ~/.config/letsencrypt/live/ | head -n 1)
# sleep for a random time so not all certificates get renewed at the same time
sleep $(expr $RANDOM % 600)
# run let's encrypt
letsencrypt certonly
# import certificate
uberspace-add-certificate -k ~/.config/letsencrypt/live/$DOMAIN/privkey.pem -c ~/.config/letsencrypt/live/$DOMAIN/cert.pem
__EOF__
##########################################
chmod +x ${HOME}/bin/letsencrypt-renew
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment