Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- set -x
- TIMEOUT=600
- INTERVAL=10
- NAMESERVERS=("NS1.TRANSIP.NL" "NS0.TRANSIP.NET" "NS2.TRANSIP.EU")
- wait_until_response() {
- timer=0
- while [ $timer -lt $TIMEOUT ]; do
- ok_response=0
- for NS in ${NAMESERVERS[@]}; do
- dig_output=$(dig +short _acme-challenge.${CERTBOT_DOMAIN} TXT @${NS})
- [[ ${dig_output} == \"${CERTBOT_VALIDATION}\" ]] && ok_response=$((ok_response+1))
- done
- [[ ${ok_response} -eq ${#NAMESERVERS[@]} ]] && return 0
- timer=$((timer+$INTERVAL))
- sleep $INTERVAL
- done
- echo TIMEOUT
- exit 255
- }
- lexicon --config-dir /etc/lexicon transip \
- "$1" "${CERTBOT_DOMAIN}" TXT \
- --name "_acme-challenge.${CERTBOT_DOMAIN}" \
- --content "${CERTBOT_VALIDATION}" || exit 255
- if [ "$1" == "create" ]; then
- wait_until_response
- fi
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement