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

ssl.sh: Use $ssldir instead of hardcoded literals. Make sure $ssldir ends with a trailing slash #314

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
9 changes: 5 additions & 4 deletions scripts_9.0/ssl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@
set -e

ssldir=${1:?"error params"}
ssldir=$(echo "$ssldir/" | sed 's|//|/|')
domain=${2:?"error params"}

mkdir -p /var/www/.well-known/acme-challenge/
chmod 755 /var/www/.well-known/acme-challenge/
ln -sf /var/www/.well-known/acme-challenge/ /var/www/challenges

domain_num=$(/root/.acme.sh/acme.sh --home /shared/ssl/ --list | grep "$domain" | grep -v "grep" | wc -l)
domain_num=$(/root/.acme.sh/acme.sh --home ${ssldir} --list | grep "$domain" | grep -v "grep" | wc -l)

if [ $domain_num -eq 0 ]; then
/root/.acme.sh/acme.sh --debug --issue --home /shared/ssl/ --server letsencrypt -d ${domain} -w /var/www/
/root/.acme.sh/acme.sh --home /shared/ssl/ --install-cert -d ${domain} --key-file /shared/ssl/${domain}.key --fullchain-file /shared/ssl/${domain}.crt
/root/.acme.sh/acme.sh --debug --issue --home ${ssldir} --server letsencrypt -d ${domain} -w /var/www/
/root/.acme.sh/acme.sh --home ${ssldir} --install-cert -d ${domain} --key-file ${ssldir}${domain}.key --fullchain-file ${ssldir}${domain}.crt
else
/root/.acme.sh/acme.sh --debug --home /shared/ssl/ --renew -d ${domain} --days 60
/root/.acme.sh/acme.sh --debug --home ${ssldir} --renew -d ${domain} --days 60
fi

nginx -s reload
Expand Down