Fixed timout and other stuff.

This commit is contained in:
redxef 2020-10-30 11:58:53 +01:00
parent 7e8ad2ff27
commit 8c52b3a834
4 changed files with 16 additions and 14 deletions

View file

@ -1,16 +1,19 @@
#!/usr/bin/env sh
echo "certbot txt record: $CERTBOT_VALIDATION" >&2
echo "certbot txt record: $CERTBOT_VALIDATION"
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 -)"
# give some time for the record to update
echo "waiting for txt record" >&2
echo "waiting for txt record"
for i in $(seq 0 60); do
val="$(nslookup -type=TXT "$DUCKDNS_DOMAIN.duckdns.org" | grep "$DUCKDNS_DOMAIN.duckdns.org.*text.*=.*" | sed -n 's/.*"\([^"]*\)".*/\1/p')"
echo "$val" >&2
echo "current txt record: $val"
test "$val" = "$CERTBOT_VALIDATION" && break
sleep 10
done
echo "waiting 60s for propagation"
sleep 60
test "$result" = 'OK'

View file

@ -1,10 +1,13 @@
#!/usr/bin/env sh
certbot certonly --manual --preferred-challenges dns-01 --keep \
--email="$LE_EMAIL" --domains="$DUCKDNS_DOMAIN.duckdns.org,*.$DUCKDNS_DOMAIN.duckdns.org" \
--email="$LE_EMAIL" --domains="$DUCKDNS_DOMAIN.duckdns.org" \
--agree-tos --no-eff-email --manual-public-ip-logging-ok \
--manual-auth-hook=certbot-auth --manual-cleanup-hook=certbot-cleanup
--manual-auth-hook=certbot-auth --manual-cleanup-hook=certbot-cleanup \
"$@"
logfile=/var/log/duckdns.log
baseurl='https://www.duckdns.org/update?domains=%s&token=%s&txt=%s'
printf "url=$baseurl\n" "$DUCKDNS_DOMAIN" "$DUCKDNS_TOKEN" "$txt" | curl -o "$logfile" -K -
certbot certonly --manual --preferred-challenges dns-01 --keep \
--email="$LE_EMAIL" --domains="*.$DUCKDNS_DOMAIN.duckdns.org" \
--agree-tos --no-eff-email --manual-public-ip-logging-ok \
--manual-auth-hook=certbot-auth --manual-cleanup-hook=certbot-cleanup \
"$@"

View file

@ -1,7 +1,5 @@
#!/usr/bin/env sh
set -x
logfile=/var/log/duckdns.log
baseurl='https://www.duckdns.org/update?domains=%s&token=%s&ip='
baseurl='https://www.duckdns.org/update?domains=%s&token=%s'
printf "url=$baseurl\n" "$DUCKDNS_DOMAIN" "$DUCKDNS_TOKEN" | curl -o "$logfile" -K -

View file

@ -1,13 +1,11 @@
#!/usr/bin/env sh
set -x
dhparamfile='/etc/letsencrypt/ssl-dhparams.pem'
ssl_includefile='/etc/letsencrypt/options-ssl-nginx.conf'
echo "Updating duckdns record"
duckdns
echo "Acquiering letsencrypt certificates"
certbot-duckdns
certbot-duckdns "$@"
echo "Starting crond"
exec crond -f