diff --git a/README.md b/README.md index 50a1771..37b9de8 100755 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ RewriteRule ^\.well-known/.+ - [END] Command-line (Linux): * Move script to user home directory on the server: `scp ./* username@ip:port:~` -* Login to server: `ssh user@ip -p port` +* Log in to server: `ssh user@ip -p port` * Make script executable: `chmod +x $HOME/acme-cpanel.sh` * Run script (ex. `$HOME/acme-cpanel.sh -s multisites`) * Follow prompts to enter credentials, issue certificates, and deploy them diff --git a/acme-cpanel.sh b/acme-cpanel.sh index 6ce63a9..b972dfd 100755 --- a/acme-cpanel.sh +++ b/acme-cpanel.sh @@ -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 }