Add interactive dns

This commit is contained in:
2020-08-01 21:40:01 -04:00
parent b93f43f6fe
commit e92c6c2fef
2 changed files with 22 additions and 2 deletions

View File

@@ -20,7 +20,7 @@
# Certificates will automatically be issued and deployed for DOMAIN and www.DOMAIN using the webroot method
#
# NOTE: The webroot method does NOT support wildcard domains, Let's Encrypt requires wildcard domains to
# use DNS challenges, which the CPANEL uapi does not support (use dns_cpaneldns plugin instead)
# use DNS challenges, which the cPanel uapi does not support (use dns method instead)
unset SITES_DIR USEREMAIL DOMAIN_FILES DOMAIN_GROUPS DEPLOY_CMD_PREFIX ISSUE_CMD_PREFIX DEBUG GROUP
@@ -86,6 +86,25 @@ parse_input() {
}
interactive_dns() {
local conf="$HOME/.acme.sh/account.conf"
if [[ -f "$conf" ]] && grep -q "CPANELDNS_AUTH_PASSWORD" "$conf"; then
echo "cPanel credentials already present, skipping configuration..."
echo "To rerun the configuration, first run 'rm $conf'"
else
read -rp 'Enter your cPanel username: ' CPANELDNS_AUTH_ID
echo
export CPANELDNS_AUTH_ID
read -rp 'Enter your cPanel password: ' CPANELDNS_AUTH_PASSWORD
echo
export CPANELDNS_AUTH_PASSWORD
read -rp 'Enter your cPanel address and port number (example: "https://www.example.com:2083/"): ' CPANELDNS_API
echo
export CPANELDNS_API
fi
}
get_acme() {
curl https://get.acme.sh | sh
source "$HOME/.bashrc"
@@ -205,6 +224,7 @@ main() {
update_email
command_prefixes
load_domains
[[ "$METHOD" == "dns" ]] && interactive_dns
issue_and_deploy_certs
}