Skip to content

Instantly share code, notes, and snippets.

@cHolzberger
Created October 27, 2016 20:01
Show Gist options
  • Save cHolzberger/71a23f26bfda0c39b4339843d1916ac7 to your computer and use it in GitHub Desktop.
Save cHolzberger/71a23f26bfda0c39b4339843d1916ac7 to your computer and use it in GitHub Desktop.
A Skript to generate a certificate for each top domain in your plesk
STDHOST="xxx"
STDROOT="/xxx"
CARGS=(-w $STDROOT -d $STDHOST)
blacklist=(host1 host2)
SITESCMD="(xxx"
for blackl in ${blacklist[@]}; do
SITESCMD="$SITESCMD|$blackl"
done
SITESCMD="$SITESCMD)"
echo $SITESCMD
for site in $( /usr/local/psa/bin/site -l | grep -v -E "$SITESCMD" ); do
dots=$( echo "$site" | awk -F. '{ print NF - 1 }' )
if [ "$dots" = "1" ]; then
echo Found Site: $site
webroot=$(/usr/local/psa/bin/site -i $site |grep -- "--WWW-Root--" | cut -d " " -f 2)
if [ "x$webroot" != "x" ]; then
CARGS=(${CARGS[@]} -w $webroot -d $site)
fi
fi
done
echo ${CARGS[@]}
certbot-auto certonly --webroot ${CARGS[@]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment