diff --git a/deploy/directadmin.sh b/deploy/directadmin.sh index cb2d19b35d..f727a46966 100644 --- a/deploy/directadmin.sh +++ b/deploy/directadmin.sh @@ -1,20 +1,13 @@ #!/usr/bin/env sh -# -*- mode: sh; tab-width: 2; indent-tabs-mode: s; coding: utf-8 -*- -# vim: et ts=2 sw=2 -# -# DirectAdmin 1.657 API -# The DirectAdmin interface has it's own Let's encrypt functionality, but this -# script can be used to upload certificates to DirectAdmin + +# DirectAdmin 1.58.2 API +# This script can be used to deploy certificates to DirectAdmin # -# User must provide login data and URL to DirectAdmin incl. port. +# User must provide login data and URL (incl. port) to DirectAdmin. # You can create login key, by using the Login Keys function # ( https://da.example.com:8443/CMD_LOGIN_KEYS ), which only has access to # - CMD_API_SSL # -# See also https://www.directadmin.com/api.php and -# https://www.directadmin.com/features.php?id=1298 and -# https://docs.directadmin.com/changelog/version-1.24.4.html#cmd-api-catch-all-pop-passwords-frontpage-protected-dirs-ssl-certs -# # Report bugs to https://github.com/Eddict/acme.sh/issues # # Values to export: @@ -22,13 +15,12 @@ # export DA_Api_Insecure=1 # # Set DA_Api_Insecure to 1 for insecure and 0 for secure -> difference is -# whether ssl cert is checked for validity (0) or whether it is just accepted -# (1) +# whether ssl cert is checked for validity (0) or whether it is just accepted (1) # +# Thanks to https://github.com/TigerP, creator of dnsapi/dns_da.sh +# That script helped a lot to create this one ######## Public functions ##################### - -#domain keyfile certfile cafile fullchain directadmin_deploy() { _cdomain="$1" _ckey="$2" @@ -160,8 +152,6 @@ _DA_setSSL() { if [ "$cacert_flat" != "$cca_flat" ]; then sameCaCert=0 - # cat <<< $cacert > ~/cacert.txt - # cat <<< $cca > ~/_cca.txt _info "Domain '${_cdomain}' is using $(__red 'a different') CA certificate." else _info "Domain '${_cdomain}' is using the same CA certificate." @@ -183,8 +173,6 @@ _DA_setSSL() { if [ "$key_flat" != "$ckey_flat" ]; then sameKey=0 - # cat <<< $key > ~/key.txt - # cat <<< $ckey > ~/_ckey.txt _info "Domain '${_cdomain}' is using $(__red 'a different') private key." else _info "Domain '${_cdomain}' is using the same private key." @@ -200,9 +188,7 @@ _DA_setSSL() { if [ "$cert_flat" != "$ccert_flat" ]; then sameCert=0 - # cat <<< $cert > ~/cert.txt - # cat <<< $ccert > ~/_ccert.txt - _info "Domain '${_cdomain}' is using $(__red 'a different') certificate." + _info "Domain '${_cdomain}' is using $(__red 'a different') certificate." else _info "Domain '${_cdomain}' is using the same certificate." fi @@ -210,7 +196,6 @@ _DA_setSSL() { if [ -n "$FORCE" ] || [ $sameCaCert -eq 0 ] || [ $sameKey -eq 0 ] || [ $sameCert -eq 0 ]; then if [ -n "$FORCE" ] || [ $sameCaCert -eq 0 ]; then - # Construct the HTTP Authorization header export _H1="Content-Type: application/x-www-form-urlencoded" encoded_cacert_value="$(printf "%s" "${cca}" | _url_encode)" @@ -227,7 +212,6 @@ _DA_setSSL() { fi if [ -n "$FORCE" ] || [ $sameKey -eq 0 ] || [ $sameCert -eq 0 ]; then - # Construct the HTTP Authorization header export _H1="Content-Type: application/x-www-form-urlencoded" encoded_keycert_value="$(printf "%s" "${ckey}$'\n'${ccert}" | _url_encode)"