Created
September 23, 2019 12:47
-
-
Save iav/d1dac703065b4eadc5561e7ad778077b to your computer and use it in GitHub Desktop.
This file contains 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 | |
#Here is a sample custom api script. | |
#This file name is "dns_myapi.sh" | |
#So, here must be a method dns_myapi_add() | |
#Which will be called by acme.sh to add the txt record to your api system. | |
#returns 0 means success, otherwise error. | |
# | |
#Author: Neilpang | |
#Report Bugs here: https://github.com/Neilpang/acme.sh | |
# | |
######## Public functions ##################### | |
CUTFILE=/tmp/bindcut.conf | |
#Usage: dns_myapi_add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs" | |
dns_bindconf_add() { | |
fulldomain=$1 | |
txtvalue=$2 | |
CUTFILE=/tmp/bindcut.conf | |
_info "Using bindconf; look for data in $(__green "cat $CUTFILE")" | |
_debug fulldomain "$fulldomain" | |
_debug txtvalue "$txtvalue" | |
_debug "Add record" | |
# _info "$(__red "Add the following TXT record:")" | |
# _info "$(__red "Domain: '$(__green "$txtdomain")'")" | |
# _info "$(__red "TXT value: '$(__green "$txt")'")" | |
# _info "$(__red "Please be aware that you prepend _acme-challenge. before your domain")" | |
# _info "$(__red "so the resulting subdomain will be: $txtdomain")" | |
_info "$(__green "$txtdomain".\ 5\ IN\ TXT\ "$txt")" | |
echo "$txtdomain". 5 IN TXT \"$txt\" >> $CUTFILE | |
# _add_record_query "$_domain" "$_sub_domain" 10 TXT "$txtvalue" | |
# _err "Not implemented!" | |
return 0 | |
} | |
#Usage: fulldomain txtvalue | |
#Remove the txt record after validation. | |
dns_bindconf_rm() { | |
fulldomain=$1 | |
txtvalue=$2 | |
_info "Using bindconf" | |
_debug fulldomain "$fulldomain" | |
_debug txtvalue "$txtvalue" | |
[ -f $CUTFILE ]&& rm $CUTFILE | |
return 0 | |
} | |
#################### Private functions below ################################## |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment