mirror of
https://github.com/acmesh-official/acme.sh.git
synced 2025-05-10 02:42:45 +00:00
Add DNS API for Hosteurope
This commit is contained in:
parent
d670ea4f59
commit
157de18e43
@ -319,6 +319,7 @@ You don't have to do anything manually!
|
|||||||
1. Zilore (https://zilore.com)
|
1. Zilore (https://zilore.com)
|
||||||
1. Loopia.se API
|
1. Loopia.se API
|
||||||
1. acme-dns (https://github.com/joohoi/acme-dns)
|
1. acme-dns (https://github.com/joohoi/acme-dns)
|
||||||
|
1. Hosteurope (https://www.hosteurope.de/)
|
||||||
|
|
||||||
And:
|
And:
|
||||||
|
|
||||||
|
@ -852,6 +852,21 @@ acme.sh --issue --dns dns_acmedns -d example.com -d www.example.com
|
|||||||
The credentials will be saved in `~/.acme.sh/account.conf` and will
|
The credentials will be saved in `~/.acme.sh/account.conf` and will
|
||||||
be reused when needed.
|
be reused when needed.
|
||||||
|
|
||||||
|
## 46. Hosteurope
|
||||||
|
|
||||||
|
Set the login credentials:
|
||||||
|
```
|
||||||
|
export HOSTEUROPE_Username="username"
|
||||||
|
export HOSTEUROPE_Password="password"
|
||||||
|
```
|
||||||
|
|
||||||
|
And to issue a cert:
|
||||||
|
```
|
||||||
|
acme.sh --issue --dns dns_hosteurope -d example.com -d *.example.com
|
||||||
|
```
|
||||||
|
|
||||||
|
The username and password will be saved in `~/.acme.sh/account.conf` and will be reused when needed.
|
||||||
|
|
||||||
# Use custom API
|
# Use custom API
|
||||||
|
|
||||||
If your API is not supported yet, you can write your own DNS API.
|
If your API is not supported yet, you can write your own DNS API.
|
||||||
|
152
dnsapi/dns_hosteurope.sh
Normal file
152
dnsapi/dns_hosteurope.sh
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Hosteurope API
|
||||||
|
#
|
||||||
|
# Author: Peter Postmann
|
||||||
|
# Report Bugs here: https://github.com/peterpostmann/acme.sh
|
||||||
|
# --
|
||||||
|
#
|
||||||
|
# Pass credentials before "acme.sh --issue --dns dns_hosteurope ..."
|
||||||
|
# --
|
||||||
|
# export HOSTEUROPE_Username="username"
|
||||||
|
# export HOSTEUROPE_Password="password"
|
||||||
|
# --
|
||||||
|
|
||||||
|
HOSTEUROPE_Api="https://kis.hosteurope.de/administration/domainservices/index.php?menu=2&mode=autodns"
|
||||||
|
|
||||||
|
######## Public functions #####################
|
||||||
|
|
||||||
|
# Usage: add _acme-challenge.www.domain.com "XKrxpRBosdIKFzxW_CT3KLZNf6q0HG9i01zxXp5CPBs"
|
||||||
|
dns_hosteurope_add() {
|
||||||
|
fulldomain="$1"
|
||||||
|
txtvalue="$2"
|
||||||
|
|
||||||
|
HOSTEUROPE_Username="${HOSTEUROPE_Username:-$(_readaccountconf_mutable HOSTEUROPE_Username)}"
|
||||||
|
HOSTEUROPE_Password="${HOSTEUROPE_Password:-$(_readaccountconf_mutable HOSTEUROPE_Password)}"
|
||||||
|
if [ -z "$HOSTEUROPE_Username" ] || [ -z "$HOSTEUROPE_Password" ]; then
|
||||||
|
HOSTEUROPE_Username=""
|
||||||
|
HOSTEUROPE_Password=""
|
||||||
|
_err "You don't specify hosteurope username and password."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
#save the credentials to the account conf file.
|
||||||
|
_saveaccountconf_mutable HOSTEUROPE_Username "$HOSTEUROPE_Username"
|
||||||
|
_saveaccountconf_mutable HOSTEUROPE_Password "$HOSTEUROPE_Password"
|
||||||
|
|
||||||
|
_debug "detect the root zone"
|
||||||
|
if ! _get_root "$fulldomain"; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
_debug _sub_domain "$_sub_domain"
|
||||||
|
_debug _domain "$_domain"
|
||||||
|
|
||||||
|
_debug "add txt record"
|
||||||
|
_hosteurope_get "&submode=edit&domain=$_domain&hostadd=$_sub_domain&record=11&pointeradd=$txtvalue&truemode=host&action=add&submit=Neu+anlegen&dubnachfrage=1"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Usage: fulldomain txtvalue
|
||||||
|
dns_hosteurope_rm() {
|
||||||
|
fulldomain="$1"
|
||||||
|
txtvalue="$2"
|
||||||
|
|
||||||
|
HOSTEUROPE_Username="${HOSTEUROPE_Username:-$(_readaccountconf_mutable HOSTEUROPE_Username)}"
|
||||||
|
HOSTEUROPE_Password="${HOSTEUROPE_Password:-$(_readaccountconf_mutable HOSTEUROPE_Password)}"
|
||||||
|
if [ -z "$HOSTEUROPE_Username" ] || [ -z "$HOSTEUROPE_Password" ]; then
|
||||||
|
HOSTEUROPE_Username=""
|
||||||
|
HOSTEUROPE_Password=""
|
||||||
|
_err "You don't specify hosteurope username and password."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
_debug "detect the root zone"
|
||||||
|
if ! _get_root "$fulldomain"; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
_debug _sub_domain "$_sub_domain"
|
||||||
|
_debug _domain "$_domain"
|
||||||
|
|
||||||
|
_debug "get records"
|
||||||
|
|
||||||
|
_hosteurope_get "&submode=edit&domain=$_domain"
|
||||||
|
_hostid="$(echo "$response" | grep -a -A 50 "$txtvalue" | grep -m 1 "hostid" | grep -o 'value="[^"]*' | grep -o '[^"]*$')"
|
||||||
|
_debug _hostid "$_hostid"
|
||||||
|
|
||||||
|
if [ -z "$_hostid" ] ; then
|
||||||
|
_err "record not found"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
_debug "rm txt record"
|
||||||
|
_hosteurope_get "&submode=edit&domain=$_domain&hostadd=$_sub_domain&record=11&pointer=$txtvalue&submit=L%F6schen&truemode=host&hostid=$_hostid&nachfrage=1"
|
||||||
|
}
|
||||||
|
|
||||||
|
#################### Private functions below ##################################
|
||||||
|
|
||||||
|
#_acme-challenge.www.domain.com
|
||||||
|
#returns
|
||||||
|
# _sub_domain=_acme-challenge.www
|
||||||
|
# _domain=domain.com
|
||||||
|
_get_root() {
|
||||||
|
domain=$1
|
||||||
|
|
||||||
|
if ! _hosteurope_get ''; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
_domains=$(echo "$response" | grep -a -o 'value="edit"><input type="hidden" name="domain" value="[^"]*' | grep -o '[^"]*$')
|
||||||
|
_debug2 domains "$_domains"
|
||||||
|
|
||||||
|
for _d in $_domains; do
|
||||||
|
if echo "$domain" | grep "$_d$" > /dev/null; then
|
||||||
|
_domain="$_d"
|
||||||
|
_sub_domain="$(echo "$domain" | sed "s/$_d$//g" | sed "s/\\.$//g")"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
_err "invalid domain"
|
||||||
|
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
_hosteurope_get() {
|
||||||
|
ep="$1"
|
||||||
|
_debug "$ep"
|
||||||
|
|
||||||
|
kdnummer="$(printf '%s' "$HOSTEUROPE_Username" | _url_encode)"
|
||||||
|
passwd="$(printf '%s' "$HOSTEUROPE_Password" | _url_encode)"
|
||||||
|
url="$HOSTEUROPE_Api&kdnummer=$kdnummer&passwd=$passwd"
|
||||||
|
|
||||||
|
response="$(_get "${url}${ep}")"
|
||||||
|
res="$?"
|
||||||
|
_debug2 response "$response"
|
||||||
|
|
||||||
|
if [ "$res" != "0" ]; then
|
||||||
|
_err "error $ep"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if echo "$response" | grep "<title>KIS Login</title>" > /dev/null; then
|
||||||
|
_err "Invalid Credentials"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if echo "$response" | grep "FEHLER" > /dev/null; then
|
||||||
|
_err "$(_hosteurope_result "$response" "FEHLER")"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if echo "$response" | grep "INFO" > /dev/null; then
|
||||||
|
_info "$(_hosteurope_result "$response" "INFO")"
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
_hosteurope_result() {
|
||||||
|
echo "$1" | grep -a -A 10 "$2" | grep -a "<li>" | sed 's/^\s*<li>//g' | sed 's/<\/li>*$//g'
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user