Skip to content

Commit

Permalink
comment changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Eddict committed Mar 4, 2024
1 parent b148a42 commit b5bca08
Showing 1 changed file with 8 additions and 24 deletions.
32 changes: 8 additions & 24 deletions deploy/directadmin.sh
Original file line number Diff line number Diff line change
@@ -1,34 +1,26 @@
#!/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:
# export DA_Api="https://remoteUser:[email protected]:8443"
# 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"
Expand Down Expand Up @@ -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."
Expand All @@ -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."
Expand All @@ -200,17 +188,14 @@ _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
fi

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)"
Expand All @@ -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)"
Expand Down

0 comments on commit b5bca08

Please sign in to comment.