certbot-duckdns/certbot-auth

16 lines
557 B
Text
Raw Normal View History

2020-10-29 16:38:49 +01:00
#!/usr/bin/env sh
2020-10-29 23:30:49 +01:00
echo "certbot txt record: $CERTBOT_VALIDATION" >&2
2020-10-29 16:38:49 +01:00
baseurl='https://www.duckdns.org/update?domains=%s&token=%s&txt=%s'
result="$(printf "url=$baseurl\n" "$DUCKDNS_DOMAIN" "$DUCKDNS_TOKEN" "$CERTBOT_VALIDATION" | curl -K -)"
2020-10-29 23:30:49 +01:00
2020-10-29 16:38:49 +01:00
# give some time for the record to update
2020-10-29 23:30:49 +01:00
echo "waiting for txt record" >&2
for i in $(seq 0 60); do
val="$(dig -t txt redxef2.duckdns.org | grep -A 1 ';; ANSWER SECTION:' | tail -n1 | sed -n 's/.*"\([^"]*\)".*/\1/p')"
test "$val" = "$CERTBOT_VALIDATION" && break
sleep 10
done
2020-10-29 16:38:49 +01:00
test "$result" = 'OK'