Created
October 15, 2016 13:23
-
-
Save jomat/317ff347077ef7f07f531ad47dc7a405 to your computer and use it in GitHub Desktop.
This file contains hidden or 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/bash | |
user= | |
pass= | |
url= | |
echo $* | |
case $1 | |
in | |
deploy_challenge) | |
wget -qO- 'https://'${user}':'${pass}'@'${url}'?hostname=_acme-challenge.'${2}'&myip='${4}'&type=TXT'|grep good >/dev/null || exit 1 | |
sleep 23 | |
exit 0 | |
;; | |
clean_challenge) | |
wget -qO- 'https://'${user}':'${pass}'@'${url}'?hostname=_acme-challenge.'${2}'&myip=null&type=TXT'|grep good >/dev/null || exit 1 | |
exit 0 | |
;; | |
unchanged_cert) | |
# do nothing for now | |
exit 0 | |
;; | |
deploy_cert) | |
fp=$(openssl x509 -in ${4} -noout -sha512 -fingerprint) | |
hash=$(echo ${fp}|cut -d= -f2|tr -d :) | |
(sleep 1;echo user v v v v;sleep 1;echo nick ${2}|tr . _;sleep 1;echo 'notice #darkfasel :New SHA512 Fingerprint: '$fp' ')|openssl s_client -connect ${2}:9999 | |
wget -qO- 'https://'${user}':'${pass}'@'${url}'?hostname=_6697._tcp.'${2}'&myip=1%200%202%20'${hash}'&type=TLSA'|grep good >/dev/null || exit 1 | |
killall -HUP charybdis-ircd | |
exit 0 | |
;; | |
*) | |
echo Unkown hook "${1}" | |
exit 1 | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment