Last active
January 9, 2017 16:13
-
-
Save alainwolf/001d3a17d09bbb5baacf76b62265af9d to your computer and use it in GitHub Desktop.
SSL Certficate for Servers on Dynamic IP Addresses
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Cronjob for Let's Encrypt certifcate for hosts on dynamic IP. | |
# | |
# Uses letsencrypt/acme client implemented as a shell-script | |
# – just add water https://dehydrated.de | |
# | |
# Please don't use HSTS or HPKP headers on dynamic IPs as they | |
# will affect other customers using your IP in the future. | |
# | |
# Hostname for dynamic IP | |
dyndomain=$(dig +short -x $(curl --ipv4 --silent icanhazip.com)) | |
# Remove trailing dot | |
dyndomain=${dyndomain%.} | |
# Get cert | |
/usr/local/lib/dehydrated/dehydrated --cron --domain ${dyndomain} | |
# Update symlink (could also be implemeted in hook script) | |
ln --symbolic --force /etc/dehydrated/certs/${dyndomain} /etc/dehydrated/certs/dyndomain |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please don't use HSTS or HPKP headers on dynamic IPs as they will affect other customers using your IP in the future.