Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

for IDN domains #48

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions letsencrypt-vesta
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,9 @@ fi
#Call letsencrypt
#using certonly ensures that the acme client doesn't try to install the cert for us
#as we'll do that in the next step
$LETSENCRYPT_COMMAND -m $EMAIL -d $ALLDOMAINS certonly
PUNYCODE=`echo $ALLDOMAINS | sed -n 1'p' | tr ',' '\n' | while read word; do echo $word | idn; done | tr '\n' ',' | sed 's/.$//'`
echo $LETSENCRYPT_COMMAND -m $EMAIL -d $PUNYCODE certonly
$LETSENCRYPT_COMMAND -m $EMAIL -d $PUNYCODE certonly

#Check that the Let's Encrypt client exited successfully
#if not, something went wrong (it probably dumpped an error), so we should abort so as not to break things
Expand All @@ -234,7 +236,8 @@ then
fi

#Get the first domain name from the list, which is what the cert will be listed as in /etc/letsencrypt/live
MAINDOMAIN=`echo -n $ALLDOMAINS | cut -d "," -f1`
MAINDOMAIN_P=`echo -n $PUNYCODE | cut -d "," -f1`
MAINDOMAIN=`echo -n $ALLDOMAINS | cut -d "," -f1`

I=0
while [[ $I -lt ${#USERLIST[@]} ]]
Expand All @@ -249,13 +252,13 @@ do
mkdir $TMPLOC

#Copy the Let's Encrypt Certs into it, using Vesta naming conventions
cp /etc/letsencrypt/live/$MAINDOMAIN/cert.pem $TMPLOC/$DOMAIN.crt
cp /etc/letsencrypt/live/$MAINDOMAIN/privkey.pem $TMPLOC/$DOMAIN.key
cp /etc/letsencrypt/live/$MAINDOMAIN/chain.pem $TMPLOC/$DOMAIN.ca
cp /etc/letsencrypt/live/$MAINDOMAIN_P/cert.pem $TMPLOC/$DOMAIN.crt
cp /etc/letsencrypt/live/$MAINDOMAIN_P/privkey.pem $TMPLOC/$DOMAIN.key
cp /etc/letsencrypt/live/$MAINDOMAIN_P/chain.pem $TMPLOC/$DOMAIN.ca

#Check if the site already has a cert
HAS_CERT=`$VESTA_PATH/bin/v-get-web-domain-value $USER $DOMAIN SSL`
if [[ $HAS_CERT == 'no' ]]
HAS_CERT=`$VESTA_PATH/bin/v-list-web-domain-ssl $USER $DOMAIN`
if [[ $HAS_CERT == '' ]]
then
#Configure SSL and install the cert
$VESTA_PATH/bin/v-add-web-domain-ssl $USER $DOMAIN $TMPLOC
Expand Down Expand Up @@ -308,4 +311,3 @@ then
echo "Renewal scheduled for $RENEWALDAYS days."
fi
fi