Commit 19c43451 authored by neil's avatar neil
Browse files

fix shfmt

parent d5d38b33
...@@ -524,27 +524,27 @@ _math() { ...@@ -524,27 +524,27 @@ _math() {
_h_char_2_dec() { _h_char_2_dec() {
_ch=$1 _ch=$1
case "${_ch}" in case "${_ch}" in
a | A) a | A)
printf "10" printf "10"
;; ;;
b | B) b | B)
printf "11" printf "11"
;; ;;
c | C) c | C)
printf "12" printf "12"
;; ;;
d | D) d | D)
printf "13" printf "13"
;; ;;
e | E) e | E)
printf "14" printf "14"
;; ;;
f | F) f | F)
printf "15" printf "15"
;; ;;
*) *)
printf "%s" "$_ch" printf "%s" "$_ch"
;; ;;
esac esac
} }
...@@ -652,211 +652,211 @@ _url_encode() { ...@@ -652,211 +652,211 @@ _url_encode() {
for _hex_code in $_hex_str; do for _hex_code in $_hex_str; do
#upper case #upper case
case "${_hex_code}" in case "${_hex_code}" in
"41") "41")
printf "%s" "A" printf "%s" "A"
;; ;;
"42") "42")
printf "%s" "B" printf "%s" "B"
;; ;;
"43") "43")
printf "%s" "C" printf "%s" "C"
;; ;;
"44") "44")
printf "%s" "D" printf "%s" "D"
;; ;;
"45") "45")
printf "%s" "E" printf "%s" "E"
;; ;;
"46") "46")
printf "%s" "F" printf "%s" "F"
;; ;;
"47") "47")
printf "%s" "G" printf "%s" "G"
;; ;;
"48") "48")
printf "%s" "H" printf "%s" "H"
;; ;;
"49") "49")
printf "%s" "I" printf "%s" "I"
;; ;;
"4a") "4a")
printf "%s" "J" printf "%s" "J"
;; ;;
"4b") "4b")
printf "%s" "K" printf "%s" "K"
;; ;;
"4c") "4c")
printf "%s" "L" printf "%s" "L"
;; ;;
"4d") "4d")
printf "%s" "M" printf "%s" "M"
;; ;;
"4e") "4e")
printf "%s" "N" printf "%s" "N"
;; ;;
"4f") "4f")
printf "%s" "O" printf "%s" "O"
;; ;;
"50") "50")
printf "%s" "P" printf "%s" "P"
;; ;;
"51") "51")
printf "%s" "Q" printf "%s" "Q"
;; ;;
"52") "52")
printf "%s" "R" printf "%s" "R"
;; ;;
"53") "53")
printf "%s" "S" printf "%s" "S"
;; ;;
"54") "54")
printf "%s" "T" printf "%s" "T"
;; ;;
"55") "55")
printf "%s" "U" printf "%s" "U"
;; ;;
"56") "56")
printf "%s" "V" printf "%s" "V"
;; ;;
"57") "57")
printf "%s" "W" printf "%s" "W"
;; ;;
"58") "58")
printf "%s" "X" printf "%s" "X"
;; ;;
"59") "59")
printf "%s" "Y" printf "%s" "Y"
;; ;;
"5a") "5a")
printf "%s" "Z" printf "%s" "Z"
;; ;;
#lower case #lower case
"61") "61")
printf "%s" "a" printf "%s" "a"
;; ;;
"62") "62")
printf "%s" "b" printf "%s" "b"
;; ;;
"63") "63")
printf "%s" "c" printf "%s" "c"
;; ;;
"64") "64")
printf "%s" "d" printf "%s" "d"
;; ;;
"65") "65")
printf "%s" "e" printf "%s" "e"
;; ;;
"66") "66")
printf "%s" "f" printf "%s" "f"
;; ;;
"67") "67")
printf "%s" "g" printf "%s" "g"
;; ;;
"68") "68")
printf "%s" "h" printf "%s" "h"
;; ;;
"69") "69")
printf "%s" "i" printf "%s" "i"
;; ;;
"6a") "6a")
printf "%s" "j" printf "%s" "j"
;; ;;
"6b") "6b")
printf "%s" "k" printf "%s" "k"
;; ;;
"6c") "6c")
printf "%s" "l" printf "%s" "l"
;; ;;
"6d") "6d")
printf "%s" "m" printf "%s" "m"
;; ;;
"6e") "6e")
printf "%s" "n" printf "%s" "n"
;; ;;
"6f") "6f")
printf "%s" "o" printf "%s" "o"
;; ;;
"70") "70")
printf "%s" "p" printf "%s" "p"
;; ;;
"71") "71")
printf "%s" "q" printf "%s" "q"
;; ;;
"72") "72")
printf "%s" "r" printf "%s" "r"
;; ;;
"73") "73")
printf "%s" "s" printf "%s" "s"
;; ;;
"74") "74")
printf "%s" "t" printf "%s" "t"
;; ;;
"75") "75")
printf "%s" "u" printf "%s" "u"
;; ;;
"76") "76")
printf "%s" "v" printf "%s" "v"
;; ;;
"77") "77")
printf "%s" "w" printf "%s" "w"
;; ;;
"78") "78")
printf "%s" "x" printf "%s" "x"
;; ;;
"79") "79")
printf "%s" "y" printf "%s" "y"
;; ;;
"7a") "7a")
printf "%s" "z" printf "%s" "z"
;; ;;
#numbers #numbers
"30") "30")
printf "%s" "0" printf "%s" "0"
;; ;;
"31") "31")
printf "%s" "1" printf "%s" "1"
;; ;;
"32") "32")
printf "%s" "2" printf "%s" "2"
;; ;;
"33") "33")
printf "%s" "3" printf "%s" "3"
;; ;;
"34") "34")
printf "%s" "4" printf "%s" "4"
;; ;;
"35") "35")
printf "%s" "5" printf "%s" "5"
;; ;;
"36") "36")
printf "%s" "6" printf "%s" "6"
;; ;;
"37") "37")
printf "%s" "7" printf "%s" "7"
;; ;;
"38") "38")
printf "%s" "8" printf "%s" "8"
;; ;;
"39") "39")
printf "%s" "9" printf "%s" "9"
;; ;;
"2d") "2d")
printf "%s" "-" printf "%s" "-"
;; ;;
"5f") "5f")
printf "%s" "_" printf "%s" "_"
;; ;;
"2e") "2e")
printf "%s" "." printf "%s" "."
;; ;;
"7e") "7e")
printf "%s" "~" printf "%s" "~"
;; ;;
#other hex #other hex
*) *)
printf '%%%s' "$_hex_code" printf '%%%s' "$_hex_code"
;; ;;
esac esac
done done
} }
...@@ -1077,11 +1077,11 @@ _isEccKey() { ...@@ -1077,11 +1077,11 @@ _isEccKey() {
return 1 return 1
fi fi
[ "$_length" != "1024" ] \ [ "$_length" != "1024" ] &&
&& [ "$_length" != "2048" ] \ [ "$_length" != "2048" ] &&
&& [ "$_length" != "3072" ] \ [ "$_length" != "3072" ] &&
&& [ "$_length" != "4096" ] \ [ "$_length" != "4096" ] &&
&& [ "$_length" != "8192" ] [ "$_length" != "8192" ]
} }
# _createkey 2048|ec-256 file # _createkey 2048|ec-256 file
...@@ -1630,22 +1630,22 @@ _calcjwk() { ...@@ -1630,22 +1630,22 @@ _calcjwk() {
crv_oid="$(${ACME_OPENSSL_BIN:-openssl} ec -in "$keyfile" -noout -text 2>/dev/null | grep "^ASN1 OID:" | cut -d ":" -f 2 | tr -d " \r\n")" crv_oid="$(${ACME_OPENSSL_BIN:-openssl} ec -in "$keyfile" -noout -text 2>/dev/null | grep "^ASN1 OID:" | cut -d ":" -f 2 | tr -d " \r\n")"
_debug3 crv_oid "$crv_oid" _debug3 crv_oid "$crv_oid"
case "${crv_oid}" in case "${crv_oid}" in
"prime256v1") "prime256v1")
crv="P-256" crv="P-256"
__ECC_KEY_LEN=256 __ECC_KEY_LEN=256
;; ;;
"secp384r1") "secp384r1")
crv="P-384" crv="P-384"
__ECC_KEY_LEN=384 __ECC_KEY_LEN=384
;; ;;
"secp521r1") "secp521r1")
crv="P-521" crv="P-521"
__ECC_KEY_LEN=512 __ECC_KEY_LEN=512
;; ;;
*) *)
_err "ECC oid : $crv_oid" _err "ECC oid : $crv_oid"
return 1 return 1
;; ;;
esac esac
_debug3 crv "$crv" _debug3 crv "$crv"
fi fi
...@@ -6772,501 +6772,501 @@ _process() { ...@@ -6772,501 +6772,501 @@ _process() {
while [ ${#} -gt 0 ]; do while [ ${#} -gt 0 ]; do
case "${1}" in case "${1}" in
--help | -h) --help | -h)
showhelp showhelp
return return
;; ;;
--version | -v) --version | -v)
version version
return return
;; ;;
--install) --install)
_CMD="install" _CMD="install"
;; ;;
--uninstall) --uninstall)
_CMD="uninstall" _CMD="uninstall"
;; ;;
--upgrade) --upgrade)
_CMD="upgrade" _CMD="upgrade"
;; ;;
--issue) --issue)
_CMD="issue" _CMD="issue"
;; ;;
--deploy) --deploy)
_CMD="deploy" _CMD="deploy"
;; ;;
--signcsr) --signcsr)
_CMD="signcsr" _CMD="signcsr"
;; ;;
--showcsr) --showcsr)
_CMD="showcsr" _CMD="showcsr"
;; ;;
--installcert | -i | --install-cert) --installcert | -i | --install-cert)
_CMD="installcert" _CMD="installcert"
;; ;;
--renew | -r) --renew | -r)
_CMD="renew" _CMD="renew"
;; ;;
--renewAll | --renewall | --renew-all) --renewAll | --renewall | --renew-all)
_CMD="renewAll" _CMD="renewAll"
;; ;;
--revoke) --revoke)
_CMD="revoke" _CMD="revoke"
;; ;;
--remove) --remove)
_CMD="remove" _CMD="remove"
;; ;;
--list) --list)
_CMD="list" _CMD="list"
;; ;;
--installcronjob | --install-cronjob) --installcronjob | --install-cronjob)
_CMD="installcronjob" _CMD="installcronjob"
;; ;;
--uninstallcronjob | --uninstall-cronjob) --uninstallcronjob | --uninstall-cronjob)
_CMD="uninstallcronjob" _CMD="uninstallcronjob"
;; ;;
--cron) --cron)
_CMD="cron" _CMD="cron"
;; ;;
--toPkcs) --toPkcs)
_CMD="toPkcs" _CMD="toPkcs"
;; ;;
--toPkcs8) --toPkcs8)
_CMD="toPkcs8" _CMD="toPkcs8"
;; ;;
--createAccountKey | --createaccountkey | -cak | --create-account-key) --createAccountKey | --createaccountkey | -cak | --create-account-key)
_CMD="createAccountKey" _CMD="createAccountKey"
;; ;;
--createDomainKey | --createdomainkey | -cdk | --create-domain-key) --createDomainKey | --createdomainkey | -cdk | --create-domain-key)
_CMD="createDomainKey" _CMD="createDomainKey"
;; ;;
--createCSR | --createcsr | -ccr) --createCSR | --createcsr | -ccr)
_CMD="createCSR" _CMD="createCSR"
;; ;;
--deactivate) --deactivate)
_CMD="deactivate" _CMD="deactivate"
;; ;;
--updateaccount | --update-account) --updateaccount | --update-account)
_CMD="updateaccount" _CMD="updateaccount"
;; ;;
--registeraccount | --register-account) --registeraccount | --register-account)
_CMD="registeraccount" _CMD="registeraccount"
;; ;;
--deactivate-account) --deactivate-account)
_CMD="deactivateaccount" _CMD="deactivateaccount"
;; ;;
--set-notify) --set-notify)
_CMD="setnotify" _CMD="setnotify"
;; ;;
--set-default-ca) --set-default-ca)
_CMD="setdefaultca" _CMD="setdefaultca"
;; ;;
--domain | -d) --domain | -d)
_dvalue="$2" _dvalue="$2"
if [ "$_dvalue" ]; then if [ "$_dvalue" ]; then
if _startswith "$_dvalue" "-"; then if _startswith "$_dvalue" "-"; then
_err "'$_dvalue' is not a valid domain for parameter '$1'" _err "'$_dvalue' is not a valid domain for parameter '$1'"
return 1 return 1
fi fi
if _is_idn "$_dvalue" && ! _exists idn; then if _is_idn "$_dvalue" && ! _exists idn; then
_err "It seems that $_dvalue is an IDN( Internationalized Domain Names), please install 'idn' command first." _err "It seems that $_dvalue is an IDN( Internationalized Domain Names), please install 'idn' command first."
return 1 return 1
fi fi
if _startswith "$_dvalue" "*."; then if _startswith "$_dvalue" "*."; then
_debug "Wildcard domain" _debug "Wildcard domain"
export ACME_VERSION=2 export ACME_VERSION=2
fi fi
if [ -z "$_domain" ]; then if [ -z "$_domain" ]; then
_domain="$_dvalue" _domain="$_dvalue"
else
if [ "$_altdomains" = "$NO_VALUE" ]; then
_altdomains="$_dvalue"
else else
if [ "$_altdomains" = "$NO_VALUE" ]; then _altdomains="$_altdomains,$_dvalue"
_altdomains="$_dvalue"
else
_altdomains="$_altdomains,$_dvalue"
fi
fi fi
fi fi
fi
shift shift
;; ;;
--force | -f) --force | -f)
FORCE="1" FORCE="1"
;; ;;
--staging | --test) --staging | --test)
STAGE="1" STAGE="1"
;; ;;
--server) --server)
_server="$2" _server="$2"
_selectServer "$_server" _selectServer "$_server"
shift shift
;; ;;
--debug) --debug)
if [ -z "$2" ] || _startswith "$2" "-"; then if [ -z "$2" ] || _startswith "$2" "-"; then
DEBUG="$DEBUG_LEVEL_DEFAULT" DEBUG="$DEBUG_LEVEL_DEFAULT"
else else
DEBUG="$2" DEBUG="$2"
shift
fi
;;
--output-insecure)
export OUTPUT_INSECURE=1
;;
--webroot | -w)
wvalue="$2"
if [ -z "$_webroot" ]; then
_webroot="$wvalue"
else
_webroot="$_webroot,$wvalue"
fi
shift
;;
--challenge-alias)
cvalue="$2"
_challenge_alias="$_challenge_alias$cvalue,"
shift
;;
--domain-alias)
cvalue="$DNS_ALIAS_PREFIX$2"
_challenge_alias="$_challenge_alias$cvalue,"
shift shift
;; fi
--standalone) ;;
wvalue="$NO_VALUE" --output-insecure)
if [ -z "$_webroot" ]; then export OUTPUT_INSECURE=1
_webroot="$wvalue" ;;
else --webroot | -w)
_webroot="$_webroot,$wvalue" wvalue="$2"
fi if [ -z "$_webroot" ]; then
;; _webroot="$wvalue"
--alpn) else
wvalue="$W_ALPN" _webroot="$_webroot,$wvalue"
if [ -z "$_webroot" ]; then fi
_webroot="$wvalue" shift
else ;;
_webroot="$_webroot,$wvalue" --challenge-alias)
fi cvalue="$2"
;; _challenge_alias="$_challenge_alias$cvalue,"
--stateless) shift
wvalue="$MODE_STATELESS" ;;
if [ -z "$_webroot" ]; then --domain-alias)
_webroot="$wvalue" cvalue="$DNS_ALIAS_PREFIX$2"
else _challenge_alias="$_challenge_alias$cvalue,"
_webroot="$_webroot,$wvalue" shift
fi ;;
;; --standalone)
--local-address) wvalue="$NO_VALUE"
lvalue="$2" if [ -z "$_webroot" ]; then
_local_address="$_local_address$lvalue," _webroot="$wvalue"
else
_webroot="$_webroot,$wvalue"
fi
;;
--alpn)
wvalue="$W_ALPN"
if [ -z "$_webroot" ]; then
_webroot="$wvalue"
else
_webroot="$_webroot,$wvalue"
fi
;;
--stateless)
wvalue="$MODE_STATELESS"
if [ -z "$_webroot" ]; then
_webroot="$wvalue"
else
_webroot="$_webroot,$wvalue"
fi
;;
--local-address)
lvalue="$2"
_local_address="$_local_address$lvalue,"
shift
;;
--apache)
wvalue="apache"
if [ -z "$_webroot" ]; then
_webroot="$wvalue"
else
_webroot="$_webroot,$wvalue"
fi
;;
--nginx)
wvalue="$NGINX"
if [ "$2" ] && ! _startswith "$2" "-"; then
wvalue="$NGINX$2"
shift shift
;; fi
--apache) if [ -z "$_webroot" ]; then
wvalue="apache" _webroot="$wvalue"
if [ -z "$_webroot" ]; then else
_webroot="$wvalue" _webroot="$_webroot,$wvalue"
else fi
_webroot="$_webroot,$wvalue" ;;
fi --dns)
;; wvalue="$W_DNS"
--nginx) if [ "$2" ] && ! _startswith "$2" "-"; then
wvalue="$NGINX" wvalue="$2"
if [ "$2" ] && ! _startswith "$2" "-"; then
wvalue="$NGINX$2"
shift
fi
if [ -z "$_webroot" ]; then
_webroot="$wvalue"
else
_webroot="$_webroot,$wvalue"
fi
;;
--dns)
wvalue="$W_DNS"
if [ "$2" ] && ! _startswith "$2" "-"; then
wvalue="$2"
shift
fi
if [ -z "$_webroot" ]; then
_webroot="$wvalue"
else
_webroot="$_webroot,$wvalue"
fi
;;
--dnssleep)
_dnssleep="$2"
Le_DNSSleep="$_dnssleep"
shift shift
;; fi
if [ -z "$_webroot" ]; then
_webroot="$wvalue"
else
_webroot="$_webroot,$wvalue"
fi
;;
--dnssleep)
_dnssleep="$2"
Le_DNSSleep="$_dnssleep"
shift
;;
--keylength | -k) --keylength | -k)
_keylength="$2" _keylength="$2"
shift shift
;; ;;
--accountkeylength | -ak) --accountkeylength | -ak)
_accountkeylength="$2" _accountkeylength="$2"
shift shift
;; ;;
--cert-file | --certpath) --cert-file | --certpath)
_cert_file="$2" _cert_file="$2"
shift shift
;; ;;
--key-file | --keypath) --key-file | --keypath)
_key_file="$2" _key_file="$2"
shift shift
;; ;;
--ca-file | --capath) --ca-file | --capath)
_ca_file="$2" _ca_file="$2"
shift shift
;; ;;
--fullchain-file | --fullchainpath) --fullchain-file | --fullchainpath)
_fullchain_file="$2" _fullchain_file="$2"
shift shift
;; ;;
--reloadcmd | --reloadCmd) --reloadcmd | --reloadCmd)
_reloadcmd="$2" _reloadcmd="$2"
shift shift
;; ;;
--password) --password)
_password="$2" _password="$2"
shift shift
;; ;;
--accountconf) --accountconf)
_accountconf="$2" _accountconf="$2"
ACCOUNT_CONF_PATH="$_accountconf" ACCOUNT_CONF_PATH="$_accountconf"
shift shift
;; ;;
--home) --home)
LE_WORKING_DIR="$2" LE_WORKING_DIR="$2"
shift shift
;; ;;
--certhome | --cert-home) --certhome | --cert-home)
_certhome="$2" _certhome="$2"
CERT_HOME="$_certhome" CERT_HOME="$_certhome"
shift shift
;; ;;
--config-home) --config-home)
_confighome="$2" _confighome="$2"
LE_CONFIG_HOME="$_confighome" LE_CONFIG_HOME="$_confighome"
shift shift
;; ;;
--useragent) --useragent)
_useragent="$2" _useragent="$2"
USER_AGENT="$_useragent" USER_AGENT="$_useragent"
shift shift
;; ;;
--accountemail | -m) --accountemail | -m)
_accountemail="$2" _accountemail="$2"
ACCOUNT_EMAIL="$_accountemail" ACCOUNT_EMAIL="$_accountemail"
shift shift
;; ;;
--accountkey) --accountkey)
_accountkey="$2" _accountkey="$2"
ACCOUNT_KEY_PATH="$_accountkey" ACCOUNT_KEY_PATH="$_accountkey"
shift shift
;; ;;
--days) --days)
_days="$2" _days="$2"
Le_RenewalDays="$_days" Le_RenewalDays="$_days"
shift shift
;; ;;
--httpport) --httpport)
_httpport="$2" _httpport="$2"
Le_HTTPPort="$_httpport" Le_HTTPPort="$_httpport"
shift shift
;; ;;
--tlsport) --tlsport)
_tlsport="$2" _tlsport="$2"
Le_TLSPort="$_tlsport" Le_TLSPort="$_tlsport"
shift shift
;; ;;
--listraw) --listraw)
_listraw="raw" _listraw="raw"
;; ;;
--stopRenewOnError | --stoprenewonerror | -se) --stopRenewOnError | --stoprenewonerror | -se)
_stopRenewOnError="1" _stopRenewOnError="1"
;; ;;
--insecure) --insecure)
#_insecure="1" #_insecure="1"
HTTPS_INSECURE="1" HTTPS_INSECURE="1"
;; ;;
--ca-bundle) --ca-bundle)
_ca_bundle="$(_readlink "$2")" _ca_bundle="$(_readlink "$2")"
CA_BUNDLE="$_ca_bundle" CA_BUNDLE="$_ca_bundle"
shift shift
;; ;;
--ca-path) --ca-path)
_ca_path="$2" _ca_path="$2"
CA_PATH="$_ca_path" CA_PATH="$_ca_path"
shift shift
;; ;;
--nocron) --nocron)
_nocron="1" _nocron="1"
;; ;;
--noprofile) --noprofile)
_noprofile="1" _noprofile="1"
;; ;;
--no-color) --no-color)
export ACME_NO_COLOR=1 export ACME_NO_COLOR=1
;; ;;
--force-color) --force-color)
export ACME_FORCE_COLOR=1 export ACME_FORCE_COLOR=1
;; ;;
--ecc) --ecc)
_ecc="isEcc" _ecc="isEcc"
;; ;;
--csr) --csr)
_csr="$2" _csr="$2"
shift shift
;; ;;
--pre-hook) --pre-hook)
_pre_hook="$2" _pre_hook="$2"
shift shift
;; ;;
--post-hook) --post-hook)
_post_hook="$2" _post_hook="$2"
shift shift
;; ;;
--renew-hook) --renew-hook)
_renew_hook="$2" _renew_hook="$2"
shift shift
;; ;;
--deploy-hook) --deploy-hook)
if [ -z "$2" ] || _startswith "$2" "-"; then if [ -z "$2" ] || _startswith "$2" "-"; then
_usage "Please specify a value for '--deploy-hook'" _usage "Please specify a value for '--deploy-hook'"
return 1 return 1
fi fi
_deploy_hook="$_deploy_hook$2," _deploy_hook="$_deploy_hook$2,"
shift shift
;; ;;
--ocsp-must-staple | --ocsp) --ocsp-must-staple | --ocsp)
Le_OCSP_Staple="1" Le_OCSP_Staple="1"
;; ;;
--always-force-new-domain-key) --always-force-new-domain-key)
if [ -z "$2" ] || _startswith "$2" "-"; then if [ -z "$2" ] || _startswith "$2" "-"; then
Le_ForceNewDomainKey=1 Le_ForceNewDomainKey=1
else else
Le_ForceNewDomainKey="$2" Le_ForceNewDomainKey="$2"
shift
fi
;;
--yes-I-know-dns-manual-mode-enough-go-ahead-please)
export FORCE_DNS_MANUAL=1
;;
--log | --logfile)
_log="1"
_logfile="$2"
if _startswith "$_logfile" '-'; then
_logfile=""
else
shift
fi
LOG_FILE="$_logfile"
if [ -z "$LOG_LEVEL" ]; then
LOG_LEVEL="$DEFAULT_LOG_LEVEL"
fi
;;
--log-level)
_log_level="$2"
LOG_LEVEL="$_log_level"
shift
;;
--syslog)
if ! _startswith "$2" '-'; then
_syslog="$2"
shift
fi
if [ -z "$_syslog" ]; then
_syslog="$SYSLOG_LEVEL_DEFAULT"
fi
;;
--auto-upgrade)
_auto_upgrade="$2"
if [ -z "$_auto_upgrade" ] || _startswith "$_auto_upgrade" '-'; then
_auto_upgrade="1"
else
shift
fi
AUTO_UPGRADE="$_auto_upgrade"
;;
--listen-v4)
_listen_v4="1"
Le_Listen_V4="$_listen_v4"
;;
--listen-v6)
_listen_v6="1"
Le_Listen_V6="$_listen_v6"
;;
--openssl-bin)
_openssl_bin="$2"
ACME_OPENSSL_BIN="$_openssl_bin"
shift
;;
--use-wget)
_use_wget="1"
ACME_USE_WGET="1"
;;
--branch | -b)
export BRANCH="$2"
shift
;;
--notify-hook)
_nhook="$2"
if _startswith "$_nhook" "-"; then
_err "'$_nhook' is not a hook name for '$1'"
return 1
fi
if [ "$_notify_hook" ]; then
_notify_hook="$_notify_hook,$_nhook"
else
_notify_hook="$_nhook"
fi
shift
;;
--notify-level)
_nlevel="$2"
if _startswith "$_nlevel" "-"; then
_err "'$_nlevel' is not a integer for '$1'"
return 1
fi
_notify_level="$_nlevel"
shift
;;
--notify-mode)
_nmode="$2"
if _startswith "$_nmode" "-"; then
_err "'$_nmode' is not a integer for '$1'"
return 1
fi
_notify_mode="$_nmode"
shift
;;
--revoke-reason)
_revoke_reason="$2"
if _startswith "$_revoke_reason" "-"; then
_err "'$_revoke_reason' is not a integer for '$1'"
return 1
fi
shift shift
;; fi
--eab-kid) ;;
_eab_kid="$2" --yes-I-know-dns-manual-mode-enough-go-ahead-please)
export FORCE_DNS_MANUAL=1
;;
--log | --logfile)
_log="1"
_logfile="$2"
if _startswith "$_logfile" '-'; then
_logfile=""
else
shift shift
;; fi
--eab-hmac-key) LOG_FILE="$_logfile"
_eab_hmac_key="$2" if [ -z "$LOG_LEVEL" ]; then
LOG_LEVEL="$DEFAULT_LOG_LEVEL"
fi
;;
--log-level)
_log_level="$2"
LOG_LEVEL="$_log_level"
shift
;;
--syslog)
if ! _startswith "$2" '-'; then
_syslog="$2"
shift shift
;; fi
--preferred-chain) if [ -z "$_syslog" ]; then
_preferred_chain="$2" _syslog="$SYSLOG_LEVEL_DEFAULT"
fi
;;
--auto-upgrade)
_auto_upgrade="$2"
if [ -z "$_auto_upgrade" ] || _startswith "$_auto_upgrade" '-'; then
_auto_upgrade="1"
else
shift shift
;; fi
*) AUTO_UPGRADE="$_auto_upgrade"
_err "Unknown parameter : $1" ;;
--listen-v4)
_listen_v4="1"
Le_Listen_V4="$_listen_v4"
;;
--listen-v6)
_listen_v6="1"
Le_Listen_V6="$_listen_v6"
;;
--openssl-bin)
_openssl_bin="$2"
ACME_OPENSSL_BIN="$_openssl_bin"
shift
;;
--use-wget)
_use_wget="1"
ACME_USE_WGET="1"
;;
--branch | -b)
export BRANCH="$2"
shift
;;
--notify-hook)
_nhook="$2"
if _startswith "$_nhook" "-"; then
_err "'$_nhook' is not a hook name for '$1'"
return 1 return 1
;; fi
if [ "$_notify_hook" ]; then
_notify_hook="$_notify_hook,$_nhook"
else
_notify_hook="$_nhook"
fi
shift
;;
--notify-level)
_nlevel="$2"
if _startswith "$_nlevel" "-"; then
_err "'$_nlevel' is not a integer for '$1'"
return 1
fi
_notify_level="$_nlevel"
shift
;;
--notify-mode)
_nmode="$2"
if _startswith "$_nmode" "-"; then
_err "'$_nmode' is not a integer for '$1'"
return 1
fi
_notify_mode="$_nmode"
shift
;;
--revoke-reason)
_revoke_reason="$2"
if _startswith "$_revoke_reason" "-"; then
_err "'$_revoke_reason' is not a integer for '$1'"
return 1
fi
shift
;;
--eab-kid)
_eab_kid="$2"
shift
;;
--eab-hmac-key)
_eab_hmac_key="$2"
shift
;;
--preferred-chain)
_preferred_chain="$2"
shift
;;
*)
_err "Unknown parameter : $1"
return 1
;;
esac esac
shift 1 shift 1
...@@ -7325,82 +7325,82 @@ _process() { ...@@ -7325,82 +7325,82 @@ _process() {
fi fi
_debug "Running cmd: ${_CMD}" _debug "Running cmd: ${_CMD}"
case "${_CMD}" in case "${_CMD}" in
install) install "$_nocron" "$_confighome" "$_noprofile" ;; install) install "$_nocron" "$_confighome" "$_noprofile" ;;
uninstall) uninstall "$_nocron" ;; uninstall) uninstall "$_nocron" ;;
upgrade) upgrade ;; upgrade) upgrade ;;
issue) issue)
issue "$_webroot" "$_domain" "$_altdomains" "$_keylength" "$_cert_file" "$_key_file" "$_ca_file" "$_reloadcmd" "$_fullchain_file" "$_pre_hook" "$_post_hook" "$_renew_hook" "$_local_address" "$_challenge_alias" "$_preferred_chain" issue "$_webroot" "$_domain" "$_altdomains" "$_keylength" "$_cert_file" "$_key_file" "$_ca_file" "$_reloadcmd" "$_fullchain_file" "$_pre_hook" "$_post_hook" "$_renew_hook" "$_local_address" "$_challenge_alias" "$_preferred_chain"
;; ;;
deploy) deploy)
deploy "$_domain" "$_deploy_hook" "$_ecc" deploy "$_domain" "$_deploy_hook" "$_ecc"
;; ;;
signcsr) signcsr)
signcsr "$_csr" "$_webroot" "$_cert_file" "$_key_file" "$_ca_file" "$_reloadcmd" "$_fullchain_file" "$_pre_hook" "$_post_hook" "$_renew_hook" "$_local_address" "$_challenge_alias" signcsr "$_csr" "$_webroot" "$_cert_file" "$_key_file" "$_ca_file" "$_reloadcmd" "$_fullchain_file" "$_pre_hook" "$_post_hook" "$_renew_hook" "$_local_address" "$_challenge_alias"
;; ;;
showcsr) showcsr)
showcsr "$_csr" "$_domain" showcsr "$_csr" "$_domain"
;; ;;
installcert) installcert)
installcert "$_domain" "$_cert_file" "$_key_file" "$_ca_file" "$_reloadcmd" "$_fullchain_file" "$_ecc" installcert "$_domain" "$_cert_file" "$_key_file" "$_ca_file" "$_reloadcmd" "$_fullchain_file" "$_ecc"
;; ;;
renew) renew)
renew "$_domain" "$_ecc" renew "$_domain" "$_ecc"
;; ;;
renewAll) renewAll)
renewAll "$_stopRenewOnError" renewAll "$_stopRenewOnError"
;; ;;
revoke) revoke)
revoke "$_domain" "$_ecc" "$_revoke_reason" revoke "$_domain" "$_ecc" "$_revoke_reason"
;; ;;
remove) remove)
remove "$_domain" "$_ecc" remove "$_domain" "$_ecc"
;; ;;
deactivate) deactivate)
deactivate "$_domain,$_altdomains" deactivate "$_domain,$_altdomains"
;; ;;
registeraccount) registeraccount)
registeraccount "$_accountkeylength" "$_eab_kid" "$_eab_hmac_key" registeraccount "$_accountkeylength" "$_eab_kid" "$_eab_hmac_key"
;; ;;
updateaccount) updateaccount)
updateaccount updateaccount
;; ;;
deactivateaccount) deactivateaccount)
deactivateaccount deactivateaccount
;; ;;
list) list)
list "$_listraw" "$_domain" list "$_listraw" "$_domain"
;; ;;
installcronjob) installcronjob "$_confighome" ;; installcronjob) installcronjob "$_confighome" ;;
uninstallcronjob) uninstallcronjob ;; uninstallcronjob) uninstallcronjob ;;
cron) cron ;; cron) cron ;;
toPkcs) toPkcs)
toPkcs "$_domain" "$_password" "$_ecc" toPkcs "$_domain" "$_password" "$_ecc"
;; ;;
toPkcs8) toPkcs8)
toPkcs8 "$_domain" "$_ecc" toPkcs8 "$_domain" "$_ecc"
;; ;;
createAccountKey) createAccountKey)
createAccountKey "$_accountkeylength" createAccountKey "$_accountkeylength"
;; ;;
createDomainKey) createDomainKey)
createDomainKey "$_domain" "$_keylength" createDomainKey "$_domain" "$_keylength"
;; ;;
createCSR) createCSR)
createCSR "$_domain" "$_altdomains" "$_ecc" createCSR "$_domain" "$_altdomains" "$_ecc"
;; ;;
setnotify) setnotify)
setnotify "$_notify_hook" "$_notify_level" "$_notify_mode" setnotify "$_notify_hook" "$_notify_level" "$_notify_mode"
;; ;;
setdefaultca) setdefaultca)
setdefaultca setdefaultca
;; ;;
*) *)
if [ "$_CMD" ]; then if [ "$_CMD" ]; then
_err "Invalid command: $_CMD" _err "Invalid command: $_CMD"
fi fi
showhelp showhelp
return 1 return 1
;; ;;
esac esac
_ret="$?" _ret="$?"
if [ "$_ret" != "0" ]; then if [ "$_ret" != "0" ]; then
......
...@@ -69,8 +69,8 @@ exim4_deploy() { ...@@ -69,8 +69,8 @@ exim4_deploy() {
cp "$_exim4_conf" "$_backup_conf" cp "$_exim4_conf" "$_backup_conf"
_info "Modify exim4 conf: $_exim4_conf" _info "Modify exim4 conf: $_exim4_conf"
if _setopt "$_exim4_conf" "tls_certificate" "=" "$_real_fullchain" \ if _setopt "$_exim4_conf" "tls_certificate" "=" "$_real_fullchain" &&
&& _setopt "$_exim4_conf" "tls_privatekey" "=" "$_real_key"; then _setopt "$_exim4_conf" "tls_privatekey" "=" "$_real_key"; then
_info "Set config success!" _info "Set config success!"
else else
_err "Config exim4 server error, please report bug to us." _err "Config exim4 server error, please report bug to us."
......
...@@ -195,8 +195,8 @@ then rm -rf \"\$fn\"; echo \"Backup \$fn deleted as older than 180 days\"; fi; d ...@@ -195,8 +195,8 @@ then rm -rf \"\$fn\"; echo \"Backup \$fn deleted as older than 180 days\"; fi; d
fi fi
if [ -n "$Le_Deploy_ssh_cafile" ]; then if [ -n "$Le_Deploy_ssh_cafile" ]; then
_pipe=">" _pipe=">"
if [ "$Le_Deploy_ssh_cafile" = "$Le_Deploy_ssh_keyfile" ] \ if [ "$Le_Deploy_ssh_cafile" = "$Le_Deploy_ssh_keyfile" ] ||
|| [ "$Le_Deploy_ssh_cafile" = "$Le_Deploy_ssh_certfile" ]; then [ "$Le_Deploy_ssh_cafile" = "$Le_Deploy_ssh_certfile" ]; then
# if filename is same as previous file then append. # if filename is same as previous file then append.
_pipe=">>" _pipe=">>"
elif [ "$Le_Deploy_ssh_backup" = "yes" ]; then elif [ "$Le_Deploy_ssh_backup" = "yes" ]; then
...@@ -222,9 +222,9 @@ then rm -rf \"\$fn\"; echo \"Backup \$fn deleted as older than 180 days\"; fi; d ...@@ -222,9 +222,9 @@ then rm -rf \"\$fn\"; echo \"Backup \$fn deleted as older than 180 days\"; fi; d
fi fi
if [ -n "$Le_Deploy_ssh_fullchain" ]; then if [ -n "$Le_Deploy_ssh_fullchain" ]; then
_pipe=">" _pipe=">"
if [ "$Le_Deploy_ssh_fullchain" = "$Le_Deploy_ssh_keyfile" ] \ if [ "$Le_Deploy_ssh_fullchain" = "$Le_Deploy_ssh_keyfile" ] ||
|| [ "$Le_Deploy_ssh_fullchain" = "$Le_Deploy_ssh_certfile" ] \ [ "$Le_Deploy_ssh_fullchain" = "$Le_Deploy_ssh_certfile" ] ||
|| [ "$Le_Deploy_ssh_fullchain" = "$Le_Deploy_ssh_cafile" ]; then [ "$Le_Deploy_ssh_fullchain" = "$Le_Deploy_ssh_cafile" ]; then
# if filename is same as previous file then append. # if filename is same as previous file then append.
_pipe=">>" _pipe=">>"
elif [ "$Le_Deploy_ssh_backup" = "yes" ]; then elif [ "$Le_Deploy_ssh_backup" = "yes" ]; then
......
...@@ -65,9 +65,9 @@ vsftpd_deploy() { ...@@ -65,9 +65,9 @@ vsftpd_deploy() {
cp "$_vsftpd_conf" "$_backup_conf" cp "$_vsftpd_conf" "$_backup_conf"
_info "Modify vsftpd conf: $_vsftpd_conf" _info "Modify vsftpd conf: $_vsftpd_conf"
if _setopt "$_vsftpd_conf" "rsa_cert_file" "=" "$_real_fullchain" \ if _setopt "$_vsftpd_conf" "rsa_cert_file" "=" "$_real_fullchain" &&
&& _setopt "$_vsftpd_conf" "rsa_private_key_file" "=" "$_real_key" \ _setopt "$_vsftpd_conf" "rsa_private_key_file" "=" "$_real_key" &&
&& _setopt "$_vsftpd_conf" "ssl_enable" "=" "YES"; then _setopt "$_vsftpd_conf" "ssl_enable" "=" "YES"; then
_info "Set config success!" _info "Set config success!"
else else
_err "Config vsftpd server error, please report bug to us." _err "Config vsftpd server error, please report bug to us."
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
ARVAN_API_URL="https://napi.arvancloud.com/cdn/4.0/domains" ARVAN_API_URL="https://napi.arvancloud.com/cdn/4.0/domains"
#Author: Ehsan Aliakbar #Author: Ehsan Aliakbar
#Report Bugs here: https://github.com/Neilpang/acme.sh #Report Bugs here: https://github.com/Neilpang/acme.sh
# #
######## Public functions ##################### ######## Public functions #####################
......
...@@ -222,21 +222,21 @@ _use_instance_role() { ...@@ -222,21 +222,21 @@ _use_instance_role() {
_use_metadata() { _use_metadata() {
_aws_creds="$( _aws_creds="$(
_get "$1" "" 1 \ _get "$1" "" 1 |
| _normalizeJson \ _normalizeJson |
| tr '{,}' '\n' \ tr '{,}' '\n' |
| while read -r _line; do while read -r _line; do
_key="$(echo "${_line%%:*}" | tr -d '"')" _key="$(echo "${_line%%:*}" | tr -d '"')"
_value="${_line#*:}" _value="${_line#*:}"
_debug3 "_key" "$_key" _debug3 "_key" "$_key"
_secure_debug3 "_value" "$_value" _secure_debug3 "_value" "$_value"
case "$_key" in case "$_key" in
AccessKeyId) echo "AWS_ACCESS_KEY_ID=$_value" ;; AccessKeyId) echo "AWS_ACCESS_KEY_ID=$_value" ;;
SecretAccessKey) echo "AWS_SECRET_ACCESS_KEY=$_value" ;; SecretAccessKey) echo "AWS_SECRET_ACCESS_KEY=$_value" ;;
Token) echo "AWS_SESSION_TOKEN=$_value" ;; Token) echo "AWS_SESSION_TOKEN=$_value" ;;
esac esac
done \ done |
| paste -sd' ' - paste -sd' ' -
)" )"
_secure_debug "_aws_creds" "$_aws_creds" _secure_debug "_aws_creds" "$_aws_creds"
......
...@@ -220,7 +220,7 @@ _azure_rest() { ...@@ -220,7 +220,7 @@ _azure_rest() {
export _H2="accept: application/json" export _H2="accept: application/json"
export _H3="Content-Type: application/json" export _H3="Content-Type: application/json"
# clear headers from previous request to avoid getting wrong http code on timeouts # clear headers from previous request to avoid getting wrong http code on timeouts
:>"$HTTP_HEADER" : >"$HTTP_HEADER"
_debug "$ep" _debug "$ep"
if [ "$m" != "GET" ]; then if [ "$m" != "GET" ]; then
_secure_debug2 "data $data" _secure_debug2 "data $data"
......
...@@ -115,9 +115,9 @@ dns_conoha_rm() { ...@@ -115,9 +115,9 @@ dns_conoha_rm() {
return 1 return 1
fi fi
record_id=$(printf "%s" "$response" | _egrep_o '{[^}]*}' \ record_id=$(printf "%s" "$response" | _egrep_o '{[^}]*}' |
| grep '"type":"TXT"' | grep "\"data\":\"$txtvalue\"" | _egrep_o "\"id\":\"[^\"]*\"" \ grep '"type":"TXT"' | grep "\"data\":\"$txtvalue\"" | _egrep_o "\"id\":\"[^\"]*\"" |
| _head_n 1 | cut -d : -f 2 | tr -d \") _head_n 1 | cut -d : -f 2 | tr -d \")
if [ -z "$record_id" ]; then if [ -z "$record_id" ]; then
_err "Can not get record id to remove." _err "Can not get record id to remove."
return 1 return 1
......
...@@ -18,23 +18,23 @@ ...@@ -18,23 +18,23 @@
######## ########
dns_cyon_add() { dns_cyon_add() {
_cyon_load_credentials \ _cyon_load_credentials &&
&& _cyon_load_parameters "$@" \ _cyon_load_parameters "$@" &&
&& _cyon_print_header "add" \ _cyon_print_header "add" &&
&& _cyon_login \ _cyon_login &&
&& _cyon_change_domain_env \ _cyon_change_domain_env &&
&& _cyon_add_txt \ _cyon_add_txt &&
&& _cyon_logout _cyon_logout
} }
dns_cyon_rm() { dns_cyon_rm() {
_cyon_load_credentials \ _cyon_load_credentials &&
&& _cyon_load_parameters "$@" \ _cyon_load_parameters "$@" &&
&& _cyon_print_header "delete" \ _cyon_print_header "delete" &&
&& _cyon_login \ _cyon_login &&
&& _cyon_change_domain_env \ _cyon_change_domain_env &&
&& _cyon_delete_txt \ _cyon_delete_txt &&
&& _cyon_logout _cyon_logout
} }
######################### #########################
......
...@@ -115,23 +115,23 @@ _da_api() { ...@@ -115,23 +115,23 @@ _da_api() {
_debug response "$response" _debug response "$response"
case "${cmd}" in case "${cmd}" in
CMD_API_DNS_CONTROL) CMD_API_DNS_CONTROL)
# Parse the result in general # Parse the result in general
# error=0&text=Records Deleted&details= # error=0&text=Records Deleted&details=
# error=1&text=Cannot View Dns Record&details=No domain provided # error=1&text=Cannot View Dns Record&details=No domain provided
err_field="$(_getfield "$response" 1 '&')" err_field="$(_getfield "$response" 1 '&')"
txt_field="$(_getfield "$response" 2 '&')" txt_field="$(_getfield "$response" 2 '&')"
details_field="$(_getfield "$response" 3 '&')" details_field="$(_getfield "$response" 3 '&')"
error="$(_getfield "$err_field" 2 '=')" error="$(_getfield "$err_field" 2 '=')"
text="$(_getfield "$txt_field" 2 '=')" text="$(_getfield "$txt_field" 2 '=')"
details="$(_getfield "$details_field" 2 '=')" details="$(_getfield "$details_field" 2 '=')"
_debug "error: ${error}, text: ${text}, details: ${details}" _debug "error: ${error}, text: ${text}, details: ${details}"
if [ "$error" != "0" ]; then if [ "$error" != "0" ]; then
_err "error $response" _err "error $response"
return 1 return 1
fi fi
;; ;;
CMD_API_SHOW_DOMAINS) ;; CMD_API_SHOW_DOMAINS) ;;
esac esac
return 0 return 0
} }
......
...@@ -67,14 +67,14 @@ _dns_do_list_rrs() { ...@@ -67,14 +67,14 @@ _dns_do_list_rrs() {
_err "getRRList origin ${_domain} failed" _err "getRRList origin ${_domain} failed"
return 1 return 1
fi fi
_rr_list="$(echo "${response}" \ _rr_list="$(echo "${response}" |
| tr -d "\n\r\t" \ tr -d "\n\r\t" |
| sed -e 's/<item xsi:type="ns2:Map">/\n/g' \ sed -e 's/<item xsi:type="ns2:Map">/\n/g' |
| grep ">$(_regexcape "$fulldomain")</value>" \ grep ">$(_regexcape "$fulldomain")</value>" |
| sed -e 's/<\/item>/\n/g' \ sed -e 's/<\/item>/\n/g' |
| grep '>id</key><value' \ grep '>id</key><value' |
| _egrep_o '>[0-9]{1,16}<' \ _egrep_o '>[0-9]{1,16}<' |
| tr -d '><')" tr -d '><')"
[ "${_rr_list}" ] [ "${_rr_list}" ]
} }
...@@ -120,10 +120,10 @@ _get_root() { ...@@ -120,10 +120,10 @@ _get_root() {
i=1 i=1
_dns_do_soap getDomainList _dns_do_soap getDomainList
_all_domains="$(echo "${response}" \ _all_domains="$(echo "${response}" |
| tr -d "\n\r\t " \ tr -d "\n\r\t " |
| _egrep_o 'domain</key><value[^>]+>[^<]+' \ _egrep_o 'domain</key><value[^>]+>[^<]+' |
| sed -e 's/^domain<\/key><value[^>]*>//g')" sed -e 's/^domain<\/key><value[^>]*>//g')"
while true; do while true; do
h=$(printf "%s" "$domain" | cut -d . -f $i-100) h=$(printf "%s" "$domain" | cut -d . -f $i-100)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
####################################################### #######################################################
# #
# easyDNS REST API for acme.sh by Neilpang based on dns_cf.sh # easyDNS REST API for acme.sh by Neilpang based on dns_cf.sh
# #
# API Documentation: https://sandbox.rest.easydns.net:3001/ # API Documentation: https://sandbox.rest.easydns.net:3001/
# #
# Author: wurzelpanzer [wurzelpanzer@maximolider.net] # Author: wurzelpanzer [wurzelpanzer@maximolider.net]
......
...@@ -303,10 +303,10 @@ _freedns_domain_id() { ...@@ -303,10 +303,10 @@ _freedns_domain_id() {
return 1 return 1
fi fi
domain_id="$(echo "$htmlpage" | tr -d " \t\r\n\v\f" | sed 's/<tr>/@<tr>/g' | tr '@' '\n' \ domain_id="$(echo "$htmlpage" | tr -d " \t\r\n\v\f" | sed 's/<tr>/@<tr>/g' | tr '@' '\n' |
| grep "<td>$search_domain</td>\|<td>$search_domain(.*)</td>" \ grep "<td>$search_domain</td>\|<td>$search_domain(.*)</td>" |
| sed -n 's/.*\(edit\.php?edit_domain_id=[0-9a-zA-Z]*\).*/\1/p' \ sed -n 's/.*\(edit\.php?edit_domain_id=[0-9a-zA-Z]*\).*/\1/p' |
| cut -d = -f 2)" cut -d = -f 2)"
# The above beauty extracts domain ID from the html page... # The above beauty extracts domain ID from the html page...
# strip out all blank space and new lines. Then insert newlines # strip out all blank space and new lines. Then insert newlines
# before each table row <tr> # before each table row <tr>
...@@ -349,11 +349,11 @@ _freedns_data_id() { ...@@ -349,11 +349,11 @@ _freedns_data_id() {
return 1 return 1
fi fi
data_id="$(echo "$htmlpage" | tr -d " \t\r\n\v\f" | sed 's/<tr>/@<tr>/g' | tr '@' '\n' \ data_id="$(echo "$htmlpage" | tr -d " \t\r\n\v\f" | sed 's/<tr>/@<tr>/g' | tr '@' '\n' |
| grep "<td[a-zA-Z=#]*>$record_type</td>" \ grep "<td[a-zA-Z=#]*>$record_type</td>" |
| grep "<ahref.*>$search_domain</a>" \ grep "<ahref.*>$search_domain</a>" |
| sed -n 's/.*\(edit\.php?data_id=[0-9a-zA-Z]*\).*/\1/p' \ sed -n 's/.*\(edit\.php?data_id=[0-9a-zA-Z]*\).*/\1/p' |
| cut -d = -f 2)" cut -d = -f 2)"
# The above beauty extracts data ID from the html page... # The above beauty extracts data ID from the html page...
# strip out all blank space and new lines. Then insert newlines # strip out all blank space and new lines. Then insert newlines
# before each table row <tr> # before each table row <tr>
......
...@@ -69,9 +69,9 @@ dns_gandi_livedns_rm() { ...@@ -69,9 +69,9 @@ dns_gandi_livedns_rm() {
_gandi_livedns_rest PUT \ _gandi_livedns_rest PUT \
"domains/$_domain/records/$_sub_domain/TXT" \ "domains/$_domain/records/$_sub_domain/TXT" \
"{\"rrset_ttl\": 300, \"rrset_values\": $_new_rrset_values}" \ "{\"rrset_ttl\": 300, \"rrset_values\": $_new_rrset_values}" &&
&& _contains "$response" '{"message": "DNS Record Created"}' \ _contains "$response" '{"message": "DNS Record Created"}' &&
&& _info "Removing record $(__green "success")" _info "Removing record $(__green "success")"
} }
#################### Private functions below ################################## #################### Private functions below ##################################
...@@ -125,9 +125,9 @@ _dns_gandi_append_record() { ...@@ -125,9 +125,9 @@ _dns_gandi_append_record() {
fi fi
_debug new_rrset_values "$_rrset_values" _debug new_rrset_values "$_rrset_values"
_gandi_livedns_rest PUT "domains/$_domain/records/$sub_domain/TXT" \ _gandi_livedns_rest PUT "domains/$_domain/records/$sub_domain/TXT" \
"{\"rrset_ttl\": 300, \"rrset_values\": $_rrset_values}" \ "{\"rrset_ttl\": 300, \"rrset_values\": $_rrset_values}" &&
&& _contains "$response" '{"message": "DNS Record Created"}' \ _contains "$response" '{"message": "DNS Record Created"}' &&
&& _info "Adding record $(__green "success")" _info "Adding record $(__green "success")"
} }
_dns_gandi_existing_rrset_values() { _dns_gandi_existing_rrset_values() {
...@@ -145,8 +145,8 @@ _dns_gandi_existing_rrset_values() { ...@@ -145,8 +145,8 @@ _dns_gandi_existing_rrset_values() {
return 1 return 1
fi fi
_debug "Already has TXT record." _debug "Already has TXT record."
_rrset_values=$(echo "$response" | _egrep_o 'rrset_values.*\[.*\]' \ _rrset_values=$(echo "$response" | _egrep_o 'rrset_values.*\[.*\]' |
| _egrep_o '\[".*\"]') _egrep_o '\[".*\"]')
return 0 return 0
} }
......
...@@ -78,8 +78,8 @@ _dns_gcloud_execute_tr() { ...@@ -78,8 +78,8 @@ _dns_gcloud_execute_tr() {
for i in $(seq 1 120); do for i in $(seq 1 120); do
if gcloud dns record-sets changes list \ if gcloud dns record-sets changes list \
--zone="$managedZone" \ --zone="$managedZone" \
--filter='status != done' \ --filter='status != done' |
| grep -q '^.*'; then grep -q '^.*'; then
_info "_dns_gcloud_execute_tr: waiting for transaction to be comitted ($i/120)..." _info "_dns_gcloud_execute_tr: waiting for transaction to be comitted ($i/120)..."
sleep 5 sleep 5
else else
...@@ -137,11 +137,11 @@ _dns_gcloud_find_zone() { ...@@ -137,11 +137,11 @@ _dns_gcloud_find_zone() {
# List domains and find the zone with the deepest sub-domain (in case of some levels of delegation) # List domains and find the zone with the deepest sub-domain (in case of some levels of delegation)
if ! match=$(gcloud dns managed-zones list \ if ! match=$(gcloud dns managed-zones list \
--format="value(name, dnsName)" \ --format="value(name, dnsName)" \
--filter="$filter" \ --filter="$filter" |
| while read -r dnsName name; do while read -r dnsName name; do
printf "%s\t%s\t%s\n" "$(echo "$name" | awk -F"." '{print NF-1}')" "$dnsName" "$name" printf "%s\t%s\t%s\n" "$(echo "$name" | awk -F"." '{print NF-1}')" "$dnsName" "$name"
done \ done |
| sort -n -r | _head_n 1 | cut -f2,3 | grep '^.*'); then sort -n -r | _head_n 1 | cut -f2,3 | grep '^.*'); then
_err "_dns_gcloud_find_zone: Can't find a matching managed zone! Perhaps wrong project or gcloud credentials?" _err "_dns_gcloud_find_zone: Can't find a matching managed zone! Perhaps wrong project or gcloud credentials?"
return 1 return 1
fi fi
......
...@@ -101,8 +101,8 @@ dns_he_rm() { ...@@ -101,8 +101,8 @@ dns_he_rm() {
body="$body&hosted_dns_editzone=1" body="$body&hosted_dns_editzone=1"
body="$body&hosted_dns_delrecord=1" body="$body&hosted_dns_delrecord=1"
body="$body&hosted_dns_delconfirm=delete" body="$body&hosted_dns_delconfirm=delete"
_post "$body" "https://dns.he.net/" \ _post "$body" "https://dns.he.net/" |
| grep '<div id="dns_status" onClick="hideThis(this);">Successfully removed record.</div>' \ grep '<div id="dns_status" onClick="hideThis(this);">Successfully removed record.</div>' \
>/dev/null >/dev/null
exit_code="$?" exit_code="$?"
if [ "$exit_code" -eq 0 ]; then if [ "$exit_code" -eq 0 ]; then
......
...@@ -123,10 +123,10 @@ _find_record() { ...@@ -123,10 +123,10 @@ _find_record() {
return 1 return 1
else else
_record_id=$( _record_id=$(
echo "$response" \ echo "$response" |
| grep -o "{[^\{\}]*\"name\":\"$_record_name\"[^\}]*}" \ grep -o "{[^\{\}]*\"name\":\"$_record_name\"[^\}]*}" |
| grep "\"value\":\"$_record_value\"" \ grep "\"value\":\"$_record_value\"" |
| while read -r record; do while read -r record; do
# test for type and # test for type and
if [ -n "$(echo "$record" | _egrep_o '"type":"TXT"')" ]; then if [ -n "$(echo "$record" | _egrep_o '"type":"TXT"')" ]; then
echo "$record" | _egrep_o '"id":"[^"]*"' | cut -d : -f 2 | tr -d \" echo "$record" | _egrep_o '"id":"[^"]*"' | cut -d : -f 2 | tr -d \"
......
...@@ -95,29 +95,29 @@ _ISPC_getZoneInfo() { ...@@ -95,29 +95,29 @@ _ISPC_getZoneInfo() {
server_id=$(echo "${curResult}" | _egrep_o "server_id.*" | cut -d ':' -f 2 | cut -d '"' -f 2) server_id=$(echo "${curResult}" | _egrep_o "server_id.*" | cut -d ':' -f 2 | cut -d '"' -f 2)
_debug "Server ID: '${server_id}'" _debug "Server ID: '${server_id}'"
case "${server_id}" in case "${server_id}" in
'' | *[!0-9]*) '' | *[!0-9]*)
_err "Server ID is not numeric." _err "Server ID is not numeric."
return 1 return 1
;; ;;
*) _info "Retrieved Server ID" ;; *) _info "Retrieved Server ID" ;;
esac esac
zone=$(echo "${curResult}" | _egrep_o "\"id.*" | cut -d ':' -f 2 | cut -d '"' -f 2) zone=$(echo "${curResult}" | _egrep_o "\"id.*" | cut -d ':' -f 2 | cut -d '"' -f 2)
_debug "Zone: '${zone}'" _debug "Zone: '${zone}'"
case "${zone}" in case "${zone}" in
'' | *[!0-9]*) '' | *[!0-9]*)
_err "Zone ID is not numeric." _err "Zone ID is not numeric."
return 1 return 1
;; ;;
*) _info "Retrieved Zone ID" ;; *) _info "Retrieved Zone ID" ;;
esac esac
client_id=$(echo "${curResult}" | _egrep_o "sys_userid.*" | cut -d ':' -f 2 | cut -d '"' -f 2) client_id=$(echo "${curResult}" | _egrep_o "sys_userid.*" | cut -d ':' -f 2 | cut -d '"' -f 2)
_debug "Client ID: '${client_id}'" _debug "Client ID: '${client_id}'"
case "${client_id}" in case "${client_id}" in
'' | *[!0-9]*) '' | *[!0-9]*)
_err "Client ID is not numeric." _err "Client ID is not numeric."
return 1 return 1
;; ;;
*) _info "Retrieved Client ID." ;; *) _info "Retrieved Client ID." ;;
esac esac
zoneFound="" zoneFound=""
zoneEnd="" zoneEnd=""
...@@ -135,11 +135,11 @@ _ISPC_addTxt() { ...@@ -135,11 +135,11 @@ _ISPC_addTxt() {
record_id=$(echo "${curResult}" | _egrep_o "\"response.*" | cut -d ':' -f 2 | cut -d '"' -f 2) record_id=$(echo "${curResult}" | _egrep_o "\"response.*" | cut -d ':' -f 2 | cut -d '"' -f 2)
_debug "Record ID: '${record_id}'" _debug "Record ID: '${record_id}'"
case "${record_id}" in case "${record_id}" in
'' | *[!0-9]*) '' | *[!0-9]*)
_err "Couldn't add ACME Challenge TXT record to zone." _err "Couldn't add ACME Challenge TXT record to zone."
return 1 return 1
;; ;;
*) _info "Added ACME Challenge TXT record to zone." ;; *) _info "Added ACME Challenge TXT record to zone." ;;
esac esac
} }
...@@ -153,24 +153,24 @@ _ISPC_rmTxt() { ...@@ -153,24 +153,24 @@ _ISPC_rmTxt() {
record_id=$(echo "${curResult}" | _egrep_o "\"id.*" | cut -d ':' -f 2 | cut -d '"' -f 2) record_id=$(echo "${curResult}" | _egrep_o "\"id.*" | cut -d ':' -f 2 | cut -d '"' -f 2)
_debug "Record ID: '${record_id}'" _debug "Record ID: '${record_id}'"
case "${record_id}" in case "${record_id}" in
'' | *[!0-9]*) '' | *[!0-9]*)
_err "Record ID is not numeric." _err "Record ID is not numeric."
return 1
;;
*)
unset IFS
_info "Retrieved Record ID."
curData="{\"session_id\":\"${sessionID}\",\"primary_id\":\"${record_id}\",\"update_serial\":true}"
curResult="$(_post "${curData}" "${ISPC_Api}?dns_txt_delete")"
_debug "Calling _ISPC_rmTxt: '${curData}' '${ISPC_Api}?dns_txt_delete'"
_debug "Result of _ISPC_rmTxt: '$curResult'"
if _contains "${curResult}" '"code":"ok"'; then
_info "Removed ACME Challenge TXT record from zone."
else
_err "Couldn't remove ACME Challenge TXT record from zone."
return 1 return 1
;; fi
*) ;;
unset IFS
_info "Retrieved Record ID."
curData="{\"session_id\":\"${sessionID}\",\"primary_id\":\"${record_id}\",\"update_serial\":true}"
curResult="$(_post "${curData}" "${ISPC_Api}?dns_txt_delete")"
_debug "Calling _ISPC_rmTxt: '${curData}' '${ISPC_Api}?dns_txt_delete'"
_debug "Result of _ISPC_rmTxt: '$curResult'"
if _contains "${curResult}" '"code":"ok"'; then
_info "Removed ACME Challenge TXT record from zone."
else
_err "Couldn't remove ACME Challenge TXT record from zone."
return 1
fi
;;
esac esac
fi fi
} }
...@@ -100,7 +100,7 @@ _get_root() { ...@@ -100,7 +100,7 @@ _get_root() {
fi fi
# Try to remove a test record. With correct root domain, username and password this will return "OK: ..." regardless # Try to remove a test record. With correct root domain, username and password this will return "OK: ..." regardless
# of record in question existing or not. # of record in question existing or not.
if _joker_rest "username=$JOKER_USERNAME&password=$JOKER_PASSWORD&zone=$h&label=jokerTXTUpdateTest&type=TXT&value="; then if _joker_rest "username=$JOKER_USERNAME&password=$JOKER_PASSWORD&zone=$h&label=jokerTXTUpdateTest&type=TXT&value="; then
if _startswith "$response" "OK"; then if _startswith "$response" "OK"; then
_sub_domain="$(echo "$fulldomain" | sed "s/\\.$h\$//")" _sub_domain="$(echo "$fulldomain" | sed "s/\\.$h\$//")"
......
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
# please report issues here: https://github.com/acmesh-official/acme.sh/issues/2977 # please report issues here: https://github.com/acmesh-official/acme.sh/issues/2977
#KAPPERNETDNS_Key="yourKAPPERNETapikey" #KAPPERNETDNS_Key="yourKAPPERNETapikey"
#KAPPERNETDNS_Secret="yourKAPPERNETapisecret" #KAPPERNETDNS_Secret="yourKAPPERNETapisecret"
KAPPERNETDNS_Api="https://dnspanel.kapper.net/API/1.2?APIKey=$KAPPERNETDNS_Key&APISecret=$KAPPERNETDNS_Secret" KAPPERNETDNS_Api="https://dnspanel.kapper.net/API/1.2?APIKey=$KAPPERNETDNS_Key&APISecret=$KAPPERNETDNS_Secret"
############################################################################### ###############################################################################
# called with # called with
# fullhostname: something.example.com # fullhostname: something.example.com
# txtvalue: someacmegenerated string # txtvalue: someacmegenerated string
dns_kappernet_add() { dns_kappernet_add() {
...@@ -97,7 +97,7 @@ dns_kappernet_rm() { ...@@ -97,7 +97,7 @@ dns_kappernet_rm() {
#################### Private functions below ################################## #################### Private functions below ##################################
# called with hostname # called with hostname
# e.g._acme-challenge.www.domain.com returns # e.g._acme-challenge.www.domain.com returns
# _sub_domain=_acme-challenge.www # _sub_domain=_acme-challenge.www
# _domain=domain.com # _domain=domain.com
_get_root() { _get_root() {
domain=$1 domain=$1
...@@ -127,7 +127,7 @@ _get_root() { ...@@ -127,7 +127,7 @@ _get_root() {
################################################################################ ################################################################################
# calls the kapper.net DNS Panel API # calls the kapper.net DNS Panel API
# with # with
# method # method
# param # param
_kappernet_api() { _kappernet_api() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment