neil
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 299 additions and 21 deletions
-
29.github/workflows/Ubuntu.yml
-
34acme.sh
-
21deploy/vault.sh
-
63dnsapi/dns_acmedns.sh
-
24dnsapi/dns_cloudns.sh
-
87dnsapi/dns_dnshome.sh
-
62notify/gotify.sh
@ -0,0 +1,87 @@ |
|||
#!/usr/bin/env sh |
|||
|
|||
# dnsHome.de API for acme.sh |
|||
# |
|||
# This Script adds the necessary TXT record to a Subdomain |
|||
# |
|||
# Author dnsHome.de (https://github.com/dnsHome-de) |
|||
# |
|||
# Report Bugs to https://github.com/acmesh-official/acme.sh/issues/3819 |
|||
# |
|||
# export DNSHOME_Subdomain="" |
|||
# export DNSHOME_SubdomainPassword="" |
|||
|
|||
# Usage: add subdomain.ddnsdomain.tld "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs" |
|||
# Used to add txt record |
|||
dns_dnshome_add() { |
|||
txtvalue=$2 |
|||
|
|||
DNSHOME_Subdomain="${DNSHOME_Subdomain:-$(_readdomainconf DNSHOME_Subdomain)}" |
|||
DNSHOME_SubdomainPassword="${DNSHOME_SubdomainPassword:-$(_readdomainconf DNSHOME_SubdomainPassword)}" |
|||
|
|||
if [ -z "$DNSHOME_Subdomain" ] || [ -z "$DNSHOME_SubdomainPassword" ]; then |
|||
DNSHOME_Subdomain="" |
|||
DNSHOME_SubdomainPassword="" |
|||
_err "Please specify/export your dnsHome.de Subdomain and Password" |
|||
return 1 |
|||
fi |
|||
|
|||
#save the credentials to the account conf file. |
|||
_savedomainconf DNSHOME_Subdomain "$DNSHOME_Subdomain" |
|||
_savedomainconf DNSHOME_SubdomainPassword "$DNSHOME_SubdomainPassword" |
|||
|
|||
DNSHOME_Api="https://$DNSHOME_Subdomain:$DNSHOME_SubdomainPassword@www.dnshome.de/dyndns.php" |
|||
|
|||
_DNSHOME_rest POST "acme=add&txt=$txtvalue" |
|||
if ! echo "$response" | grep 'successfully' >/dev/null; then |
|||
_err "Error" |
|||
_err "$response" |
|||
return 1 |
|||
fi |
|||
|
|||
return 0 |
|||
} |
|||
|
|||
# Usage: txtvalue |
|||
# Used to remove the txt record after validation |
|||
dns_dnshome_rm() { |
|||
txtvalue=$2 |
|||
|
|||
DNSHOME_Subdomain="${DNSHOME_Subdomain:-$(_readdomainconf DNSHOME_Subdomain)}" |
|||
DNSHOME_SubdomainPassword="${DNSHOME_SubdomainPassword:-$(_readdomainconf DNSHOME_SubdomainPassword)}" |
|||
|
|||
DNSHOME_Api="https://$DNSHOME_Subdomain:$DNSHOME_SubdomainPassword@www.dnshome.de/dyndns.php" |
|||
|
|||
if [ -z "$DNSHOME_Subdomain" ] || [ -z "$DNSHOME_SubdomainPassword" ]; then |
|||
DNSHOME_Subdomain="" |
|||
DNSHOME_SubdomainPassword="" |
|||
_err "Please specify/export your dnsHome.de Subdomain and Password" |
|||
return 1 |
|||
fi |
|||
|
|||
_DNSHOME_rest POST "acme=rm&txt=$txtvalue" |
|||
if ! echo "$response" | grep 'successfully' >/dev/null; then |
|||
_err "Error" |
|||
_err "$response" |
|||
return 1 |
|||
fi |
|||
|
|||
return 0 |
|||
} |
|||
|
|||
#################### Private functions below ################################## |
|||
_DNSHOME_rest() { |
|||
method=$1 |
|||
data="$2" |
|||
_debug "$data" |
|||
|
|||
_debug data "$data" |
|||
response="$(_post "$data" "$DNSHOME_Api" "" "$method")" |
|||
|
|||
if [ "$?" != "0" ]; then |
|||
_err "error $data" |
|||
return 1 |
|||
fi |
|||
_debug2 response "$response" |
|||
return 0 |
|||
} |
@ -0,0 +1,62 @@ |
|||
#!/usr/bin/env sh |
|||
|
|||
#Support Gotify |
|||
|
|||
#GOTIFY_URL="https://gotify.example.com" |
|||
#GOTIFY_TOKEN="123456789ABCDEF" |
|||
|
|||
#optional |
|||
#GOTIFY_PRIORITY=0 |
|||
|
|||
# subject content statusCode |
|||
gotify_send() { |
|||
_subject="$1" |
|||
_content="$2" |
|||
_statusCode="$3" #0: success, 1: error 2($RENEW_SKIP): skipped |
|||
_debug "_subject" "$_subject" |
|||
_debug "_content" "$_content" |
|||
_debug "_statusCode" "$_statusCode" |
|||
|
|||
GOTIFY_URL="${GOTIFY_URL:-$(_readaccountconf_mutable GOTIFY_URL)}" |
|||
if [ -z "$GOTIFY_URL" ]; then |
|||
GOTIFY_URL="" |
|||
_err "You didn't specify the gotify server url GOTIFY_URL." |
|||
return 1 |
|||
fi |
|||
_saveaccountconf_mutable GOTIFY_URL "$GOTIFY_URL" |
|||
|
|||
GOTIFY_TOKEN="${GOTIFY_TOKEN:-$(_readaccountconf_mutable GOTIFY_TOKEN)}" |
|||
if [ -z "$GOTIFY_TOKEN" ]; then |
|||
GOTIFY_TOKEN="" |
|||
_err "You didn't specify the gotify token GOTIFY_TOKEN." |
|||
return 1 |
|||
fi |
|||
_saveaccountconf_mutable GOTIFY_TOKEN "$GOTIFY_TOKEN" |
|||
|
|||
GOTIFY_PRIORITY="${GOTIFY_PRIORITY:-$(_readaccountconf_mutable GOTIFY_PRIORITY)}" |
|||
if [ -z "$GOTIFY_PRIORITY" ]; then |
|||
GOTIFY_PRIORITY=0 |
|||
else |
|||
_saveaccountconf_mutable GOTIFY_PRIORITY "$GOTIFY_PRIORITY" |
|||
fi |
|||
|
|||
export _H1="X-Gotify-Key: ${GOTIFY_TOKEN}" |
|||
export _H2="Content-Type: application/json" |
|||
|
|||
_content=$(echo "$_content" | _json_encode) |
|||
_subject=$(echo "$_subject" | _json_encode) |
|||
|
|||
_data="{\"title\": \"${_subject}\", \"message\": \"${_content}\", \"priority\": ${GOTIFY_PRIORITY}}" |
|||
|
|||
response="$(_post "${_data}" "${GOTIFY_URL}/message" "" "POST" "application/json")" |
|||
|
|||
if [ "$?" != "0" ]; then |
|||
_err "Failed to send message" |
|||
_err "$response" |
|||
return 1 |
|||
fi |
|||
|
|||
_debug2 response "$response" |
|||
|
|||
return 0 |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue