Skip to content

Commit

Permalink
usefull debug info
Browse files Browse the repository at this point in the history
fix bug: incorrect rrid being sent on cleanup
  • Loading branch information
joshp23 committed Oct 30, 2018
1 parent e367268 commit fa909b4
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 11 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ $ certbot renew -- manual-auth-hook /path/to/hook.sh -- manual-cleanup-hook /pat
```
#### Note: There is a 15 minute wait for DNS propagation.

Debug data will be printed in case of error response from NameSilo.

### Support Dev
All of my published code is developed and maintained in spare time, if you would like to support development of this, or any of my published code, I have set up a Liberpay account for just this purpose. Thank you.

Expand Down
21 changes: 13 additions & 8 deletions cleanup.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# NameSileCertbot-DNS-01 0.2.0
# NameSileCertbot-DNS-01 0.2.1
## https://stackoverflow.com/questions/59895
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do
Expand All @@ -13,11 +13,8 @@ cd ${DIR}
source config.sh

DOMAIN=${CERTBOT_DOMAIN}
VALIDATION=${CERTBOT_VALIDATION}

if [ ! -f $CACHE$DOMAIN.xml ] ; then
curl -s "https://www.namesilo.com/api/dnsListRecords?version=1&type=xml&key=$APIKEY&domain=$DOMAIN" > $CACHE$DOMAIN.xml
fi
## Get current list (updating may alter rrid, etc)
curl -s "https://www.namesilo.com/api/dnsListRecords?version=1&type=xml&key=$APIKEY&domain=$DOMAIN" > $CACHE$DOMAIN.xml
## Check for existing ACME record
if grep -q "_acme-challenge" $CACHE$DOMAIN.xml ; then
## Get record ID
Expand All @@ -31,10 +28,18 @@ if grep -q "_acme-challenge" $CACHE$DOMAIN.xml ; then
echo "ACME challenge record successfully removed"
;;
280)
echo "Record removal failed, please check your NameSilo account."
RESPONSE_DETAIL=`xmllint --xpath "//namesilo/reply/detail/text()" $RESPONSE`
echo "Record removal failed."
echo "Domain: $DOMAIN"
echo "rrid: $RECORD_ID"
echo "reason: $RESPONSE_DETAIL"
;;
*)
echo "No valid response from Namesilo"
RESPONSE_DETAIL=`xmllint --xpath "//namesilo/reply/detail/text()" $RESPONSE`
echo "Namesilo returned code: $RESPONSE_CODE"
echo "Reason: $RESPONSE_DETAIL"
echo "Domain: $DOMAIN"
echo "rrid: $RECORD_ID"
;;
esac
fi
Expand Down
22 changes: 19 additions & 3 deletions hook.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# NameSileCertbot-DNS-01 0.2.0
# NameSileCertbot-DNS-01 0.2.1
## https://stackoverflow.com/questions/59895
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do
Expand Down Expand Up @@ -36,10 +36,17 @@ then
done
;;
280)
RESPONSE_DETAIL=`xmllint --xpath "//namesilo/reply/detail/text()" $RESPONSE`
echo "Update aborted, please check your NameSilo account."
echo "Domain: $DOMAIN"
echo "rrid: $RECORD_ID"
echo "reason: $RESPONSE_DETAIL"
;;
*)
echo "No valid response from Namesilo"
echo "Namesilo returned code: $RESPONSE_CODE"
echo "Reason: $RESPONSE_DETAIL"
echo "Domain: $DOMAIN"
echo "rrid: $RECORD_ID"
;;
esac
else
Expand All @@ -57,10 +64,19 @@ else
done
;;
280)

RESPONSE_DETAIL=`xmllint --xpath "//namesilo/reply/detail/text()" $RESPONSE`
echo "DNS addition aborted, please check your NameSilo account."
echo "Domain: $DOMAIN"
echo "rrid: $RECORD_ID"
echo "reason: $RESPONSE_DETAIL"
;;
*)
echo "No valid response from Namesilo"
RESPONSE_DETAIL=`xmllint --xpath "//namesilo/reply/detail/text()" $RESPONSE`
echo "Namesilo returned code: $RESPONSE_CODE"
echo "Reason: $RESPONSE_DETAIL"
echo "Domain: $DOMAIN"
echo "rrid: $RECORD_ID"
;;
esac
fi

0 comments on commit fa909b4

Please sign in to comment.