Automating Let's Encrypt HTTPS certificate renewals on Namecheap hosts

bryan 1f063f2501 Fix permissions bit 4 年之前
multisites d3860e9a29 Initial commit 4 年之前
README.md d3860e9a29 Initial commit 4 年之前
acme-cpanel-dns.sh 1f063f2501 Fix permissions bit 4 年之前
acme-cpanel-webroot.sh d3860e9a29 Initial commit 4 年之前
domains.txt d3860e9a29 Initial commit 4 年之前

README.md

WIP

This project contains two files:

acme-cpanel-webroot.sh (for webroot challenges)

acme-cpanel-dns.sh (for dns challenges, legacy script)

Both of these scripts read in a list of domains from one or more files. These files may only contain domains and empty lines (see domains.txt).

Notes

acme-cpanel-webroot.sh may require the following additions to .htaccess so that challenges are not automatically redirected to https:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^\.well-known/.+ - [END]

Installation

Command-line (Linux):

  • Move script to user home directory on the server: scp ./* username@ip:port:~
  • Login to server: ssh user@ip -p port
  • Make script executable: chmod +x $HOME/acme-cpanel-webroot.s
  • Run script (ex. $HOME/acme-cpanel-webroot.sh -s multisites)
  • Follow prompts to enter credentials, issue certificates, and deploy them
  • Double-check that the acme cron job is enabled: crontab -l

cPanel:

  • Use File Manager to upload files to the home directory (/home/username/)
  • You may need to make file executable in Terminal: chmod +x $HOME/acme-cpanel-webroot.sh
  • Use Terminal to run the script (ex. $HOME/acme-cpanel-webroot.sh -s multisites)
  • Follow prompts to enter credentials, issue certificates, and deploy them
  • Use Cron Jobs app to double-check that the acme cron job is present

Usage

./acme-cpanel-webroot.sh [OPTIONS] [FILES...]

Options

--email, -e EMAIL
    E-mail not be notified of certificate renewal failures
--keep-grouping, -k
    Issue multidomain certificates based on grouping by input file
    The first domain in each file will be used to determine the shared webroot
    Default: issue certificates by independent domain
--sites-dir, -s DIR
    Load domain list files from this directory
--force, -f
    Override default debug
--debug, -d (default)
    Use --staging to issue certificates and do not deploy

Examples

./acme-cpanel-webroot.sh --force

Load sites from domains.txt, issue and deploy certificates

./acme-cpanel-webroot.sh --force -s multisites

Load sites from multisites directory, issue and deploy certificates

./acme-cpanel-webroot.sh --force -k multisites/flatwhitedesign.pw multisites/greengingerdesign.pw

Load sites from multisites directory, issue and deploy multidomain certificates based on the grouping in the file.

./acme_cpanel_dns.sh

This is a legacy script that takes no arguments. By default it will read all domain lists in a top-level "multisites" directory.