Skip to content

Instantly share code, notes, and snippets.

@av1d
Created December 26, 2023 15:24
Show Gist options
  • Save av1d/535932e5a4158c0943f16de031fcef31 to your computer and use it in GitHub Desktop.
Save av1d/535932e5a4158c0943f16de031fcef31 to your computer and use it in GitHub Desktop.
use acme.sh to 'automatically' grab an SSL certificate and deploy it for a list of domains
#!/bin/bash
# use acme.sh to 'automatically' grab an SSL certificate and deploy it for a list of domains
# https://github.com/acmesh-official/acme.sh
# domains.txt contains the domain and its path, space-separated, one per line:
# example.com /home/luser/example.com
# example.org /home/luser/public_html
file="domains.txt"
# Read the file line by line
while read -r line; do
domainName=$(echo "$line" | awk '{print $1}')
domainPath=$(echo "$line" | awk '{print $2}')
./acme.sh --issue --webroot $domainPath -d $domainName --force
./acme.sh --deploy --deploy-hook cpanel_uapi --domain $domainName
done < "$file"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment