mirror of
https://github.com/acmesh-official/acme.sh.git
synced 2026-08-13 12:33:30 +02:00
Some checks are pending
Apache / Apache (push) Waiting to run
DNS / CheckToken (push) Waiting to run
DNS / Fail (push) Blocked by required conditions
DNS / Docker (push) Blocked by required conditions
DNS / MacOS (push) Blocked by required conditions
DNS / Windows (push) Blocked by required conditions
DNS / FreeBSD (push) Blocked by required conditions
DNS / GhostBSD (push) Blocked by required conditions
DNS / OpenBSD (push) Blocked by required conditions
DNS / NetBSD (push) Blocked by required conditions
DNS / DragonFlyBSD (push) Blocked by required conditions
DNS / MidnightBSD (push) Blocked by required conditions
DNS / Solaris (push) Blocked by required conditions
DNS / Omnios (push) Blocked by required conditions
DNS / OpenIndiana (push) Blocked by required conditions
DNS / Tribblix (push) Blocked by required conditions
DNS / Haiku (push) Blocked by required conditions
DragonFlyBSD / DragonFlyBSD (, , , LetsEncrypt.org_test, (STAGING)) (push) Waiting to run
FreeBSD / FreeBSD (, , , LetsEncrypt.org_test, (STAGING)) (push) Waiting to run
FreeBSD / FreeBSD (1, , , , LetsEncrypt.org_test, (STAGING)) (push) Waiting to run
GhostBSD / GhostBSD (, , , LetsEncrypt.org_test, (STAGING)) (push) Waiting to run
GhostBSD / GhostBSD (1, , , , LetsEncrypt.org_test, (STAGING)) (push) Waiting to run
Haiku / Haiku (, , , LetsEncrypt.org_test, (STAGING)) (push) Waiting to run
Haiku / Haiku (1, , , , LetsEncrypt.org_test, (STAGING)) (push) Waiting to run
Linux / Linux (almalinux:latest) (push) Waiting to run
Linux / Linux (alpine:latest) (push) Waiting to run
Linux / Linux (archlinux:latest) (push) Waiting to run
Linux / Linux (debian:latest) (push) Waiting to run
Linux / Linux (fedora:latest) (push) Waiting to run
Linux / Linux (gentoo/stage3) (push) Waiting to run
Linux / Linux (kalilinux/kali) (push) Waiting to run
Linux / Linux (opensuse/leap:latest) (push) Waiting to run
Linux / Linux (oraclelinux:8) (push) Waiting to run
Linux / Linux (ubuntu:latest) (push) Waiting to run
MacOS / MacOS (, , , LetsEncrypt.org_test, (STAGING)) (push) Waiting to run
MidnightBSD / MidnightBSD (, , , LetsEncrypt.org_test, (STAGING)) (push) Waiting to run
NetBSD / NetBSD (, , , LetsEncrypt.org_test, (STAGING)) (push) Waiting to run
Nginx / Nginx (push) Waiting to run
Omnios / Omnios (, , , LetsEncrypt.org_test, (STAGING)) (push) Waiting to run
Omnios / Omnios (1, , , , LetsEncrypt.org_test, (STAGING)) (push) Waiting to run
OpenBSD / OpenBSD (, , , LetsEncrypt.org_test, (STAGING)) (push) Waiting to run
OpenBSD / OpenBSD (1, , , , LetsEncrypt.org_test, (STAGING)) (push) Waiting to run
OpenIndiana / OpenIndiana (, , , LetsEncrypt.org_test, (STAGING)) (push) Waiting to run
OpenIndiana / OpenIndiana (1, , , , LetsEncrypt.org_test, (STAGING)) (push) Waiting to run
PebbleStrict / PebbleStrict (push) Waiting to run
PebbleStrict / PebbleStrict_IPCert (push) Waiting to run
Solaris / Solaris (, , , LetsEncrypt.org_test, (STAGING)) (push) Waiting to run
Solaris / Solaris (1, , , , LetsEncrypt.org_test, (STAGING)) (push) Waiting to run
Tribblix / Tribblix (, , , LetsEncrypt.org_test, (STAGING)) (push) Waiting to run
Tribblix / Tribblix (1, , , , LetsEncrypt.org_test, (STAGING)) (push) Waiting to run
Ubuntu / Ubuntu (, , , LetsEncrypt.org_test, (STAGING)) (push) Waiting to run
Ubuntu / Ubuntu (1, , , , LetsEncrypt.org_test, (STAGING)) (push) Waiting to run
Ubuntu / Ubuntu (Smallstep Intermediate CA, Smallstep Intermediate CA, , 1, https://localhost:9000/acme/acme/directory, ) (push) Waiting to run
Ubuntu / Ubuntu (Smallstep Intermediate CA, Smallstep Intermediate CA, , 1, https://localhost:9000/acme/acme/directory, 1, , 172.17.0.1) (push) Waiting to run
Ubuntu / Ubuntu (ZeroSSL RSA DV SSL CA 2, ZeroSSL ECC DV SSL CA 2, githubtest@acme.sh, ZeroSSL.com, ) (push) Waiting to run
Windows / Windows (, , , LetsEncrypt.org_test, (STAGING)) (push) Waiting to run
Build DockerHub / CheckToken (push) Waiting to run
Build DockerHub / build (push) Blocked by required conditions
Shellcheck / ShellCheck (push) Waiting to run
Shellcheck / shfmt (push) Waiting to run
dnsapi/deploy: remove POSIX character classes from sed/grep patterns Solaris /usr/bin/sed and /usr/bin/grep parse [[:space:]] etc. as a literal bracket set and silently mis-match. Replace with [ ]* for JSON matching, a printf-tab bracket for user-input trimming, and [0-9] for digits; also drop GNU-only sed -r/-E in rage4, selfhost and selectel, and reuse _strip_blank_lines in byteplus_alb.
181 lines
5.2 KiB
Bash
181 lines
5.2 KiB
Bash
#!/usr/bin/env sh
|
|
# shellcheck disable=SC2034
|
|
dns_creoline_info='creoline
|
|
Site: https://www.creoline.com/de
|
|
Docs: github.com/acmesh-official/acme.sh/wiki/dnsapi2#dns_creoline
|
|
Help: https://help.creoline.com
|
|
Options:
|
|
creolineApiToken
|
|
creolineApiSecret
|
|
Issues: github.com/acmesh-official/acme.sh/issues/7103
|
|
'
|
|
|
|
creolineApi="https://api.creoline.com/v1"
|
|
|
|
######## Public functions #####################
|
|
|
|
# Usage: add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPB8"
|
|
dns_creoline_add() {
|
|
fulldomain=$1
|
|
txtvalue=$2
|
|
|
|
creolineApiToken="${creolineApiToken:-$(_readaccountconf_mutable creolineApiToken)}"
|
|
creolineApiSecret="${creolineApiSecret:-$(_readaccountconf_mutable creolineApiSecret)}"
|
|
|
|
if [ -z "$creolineApiToken" ] || [ -z "$creolineApiSecret" ]; then
|
|
_err "Error required creoline API Token or creoline API Secret not specified."
|
|
_err "Please set it with the Command 'export creolineApiToken=<YourToken>' and 'export creolineApiSecret=<YourSecret>'."
|
|
return 1
|
|
else
|
|
_saveaccountconf_mutable creolineApiToken "$creolineApiToken"
|
|
_saveaccountconf_mutable creolineApiSecret "$creolineApiSecret"
|
|
fi
|
|
|
|
_debug "Detecting the root dns zone."
|
|
if ! _get_root "$fulldomain"; then
|
|
_err "Error on detecting the root dns zone."
|
|
return 1
|
|
fi
|
|
|
|
_info "Adding record"
|
|
if _creoline_rest POST "dns/zone/$_domain/record" "{\"type\":\"TXT\",\"host\":\"$_sub_domain\",\"record\":\"$txtvalue\",\"ttl\":\"60\"}"; then
|
|
if _contains "$response" "$txtvalue"; then
|
|
_info "Added, OK"
|
|
return 0
|
|
else
|
|
_err "Add txt record error."
|
|
return 1
|
|
fi
|
|
fi
|
|
_err "Add txt record error."
|
|
return 1
|
|
}
|
|
|
|
#fulldomain txtvalue
|
|
dns_creoline_rm() {
|
|
fulldomain=$1
|
|
txtvalue=$2
|
|
|
|
creolineApiToken="${creolineApiToken:-$(_readaccountconf_mutable creolineApiToken)}"
|
|
creolineApiSecret="${creolineApiSecret:-$(_readaccountconf_mutable creolineApiSecret)}"
|
|
|
|
_debug "Detecting the root dns zone."
|
|
if ! _get_root "$fulldomain"; then
|
|
_err "Error on detecting the root dns zone."
|
|
return 1
|
|
fi
|
|
|
|
_info "Getting earlier created txt record."
|
|
if ! _creoline_rest GET "dns/zone/$_domain/record/type/TXT/record/$txtvalue"; then
|
|
if _contains "$response" "errors" || _contains "$response" "message"; then
|
|
_err "Error on getting earlier created txt record."
|
|
return 1
|
|
fi
|
|
_err "Error on getting earlier created txt record."
|
|
return 1
|
|
fi
|
|
|
|
record_id=$(echo "$response" | _egrep_o "\"id\"[ ]*:[ ]*[0-9]+" | cut -d : -f 2 | tr -d \" | _head_n 1 | tr -d " ")
|
|
_debug "record_id" "$record_id"
|
|
|
|
if [ -z "$record_id" ]; then
|
|
_err "Error on deleting earlier created txt record. No record id found in response."
|
|
return 1
|
|
fi
|
|
|
|
_info "Deleting earlier created txt record."
|
|
if ! _creoline_rest DELETE "dns/zone/$_domain/record/$record_id"; then
|
|
if _contains "$response" "errors" || _contains "$response" "message"; then
|
|
_err "Error on deleting earlier created txt record."
|
|
return 1
|
|
fi
|
|
_err "Error on deleting earlier created txt record."
|
|
return 1
|
|
fi
|
|
|
|
_info "Deleted, OK"
|
|
return 0
|
|
}
|
|
|
|
#################### Private functions below ##################################
|
|
#_acme-challenge.www.domain.com
|
|
#returns
|
|
# _sub_domain=_acme-challenge.www
|
|
# _domain=domain.com
|
|
_get_root() {
|
|
domain=$1
|
|
if ! _creoline_rest GET "dns/zone/root/$domain"; then
|
|
return 1
|
|
fi
|
|
|
|
_sub_domain=$(echo "$response" | _egrep_o "\"subDomain\"[ ]*:[ ]*\"[^\"]+\"" | cut -d : -f 2 | tr -d \" | _head_n 1 | tr -d " ")
|
|
_debug _sub_domain "$_sub_domain"
|
|
|
|
_domain=$(echo "$response" | _egrep_o "\"domain\"[ ]*:[ ]*\"[^\"]+\"" | cut -d : -f 2 | tr -d \" | _head_n 1 | tr -d " ")
|
|
_debug _domain "$_domain"
|
|
|
|
if [ -z "$_domain" ] || [ -z "$_sub_domain" ]; then
|
|
return 1
|
|
fi
|
|
}
|
|
|
|
_creoline_rest() {
|
|
method=$1
|
|
uri="$2"
|
|
data="$3"
|
|
timestamp=$(_time)
|
|
canonical_request="${timestamp}.${creolineApi}/${uri}"
|
|
signature_hash=$(printf "%s" "$canonical_request" | _hmac sha256 "$(printf "%s" "$creolineApiSecret" | _hex_dump | tr -d " ")" hex)
|
|
|
|
_debug method "$method"
|
|
_debug uri "$uri"
|
|
_debug data "$data"
|
|
|
|
_debug2 timestamp "$timestamp"
|
|
_debug2 canonical_request "$canonical_request"
|
|
_debug2 signature_hash "$signature_hash"
|
|
|
|
token_trimmed=$(echo "$creolineApiToken" | tr -d '"')
|
|
hmac_trimmed=$(echo "$signature_hash" | tr -d '"')
|
|
|
|
export _H1="Content-Type: application/json"
|
|
|
|
if [ "$token_trimmed" ]; then
|
|
export _H2="X-Api-Token: $token_trimmed"
|
|
fi
|
|
|
|
if [ "$hmac_trimmed" ]; then
|
|
export _H3="X-Creoline-Api-Signature: $hmac_trimmed"
|
|
fi
|
|
|
|
if [ "$timestamp" ]; then
|
|
export _H4="X-Creoline-Api-Timestamp: $timestamp"
|
|
fi
|
|
|
|
if [ "$method" != "GET" ]; then
|
|
response="$(_post "$data" "$creolineApi/$uri" "" "$method")"
|
|
else
|
|
response="$(_get "$creolineApi/$uri")"
|
|
fi
|
|
|
|
if [ "$?" != "0" ]; then
|
|
_err "error $uri"
|
|
return 1
|
|
fi
|
|
|
|
_debug response "$response"
|
|
|
|
if _contains "$response" "errors"; then
|
|
error=$(echo "$response" | _egrep_o "\"errors\":[[]*\"[^\"]+\"" | cut -d : -f 2 | tr -d \" | tr -d "[")
|
|
_err "Error: $error"
|
|
_err "URI:$uri"
|
|
return 1
|
|
elif _contains "$response" "message"; then
|
|
message=$(echo "$response" | _egrep_o "\"message\"[ ]*:[ ]*\"[^\"]+\"" | cut -d : -f 2 | tr -d \")
|
|
_err "Error: $message"
|
|
_err "URI:$uri"
|
|
return 1
|
|
fi
|
|
|
|
return 0
|
|
}
|