Skip to content

Commit 9a48d9f

Browse files
committed
Create 20-letsencrypt-renew.sh
1 parent 1449bb6 commit 9a48d9f

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

20-letsencrypt-renew.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
3+
if [[ -z "$1" ]]
4+
then echo "Missing mandatory path parameter"
5+
exit
6+
fi
7+
8+
DOMAIN_PATH="$HOME/build/dane/$1"
9+
10+
if [[ ! -d $DOMAIN_PATH ]]
11+
then echo "Path $PATH does not exist"
12+
exit
13+
fi
14+
15+
if [[ $1 == "mail" ]]
16+
then
17+
FILENAME="mail"
18+
else
19+
FILENAME="nginx"
20+
fi
21+
22+
cd $DOMAIN_PATH
23+
letsencrypt certonly --webroot -w /var/www/letsencrypt/letsencrypt-auth --key-path privkey.pem --cert-path cert.pem --fullchain-path fullchain.pem --csr request.csr
24+
25+
FULLCHAIN=`ls -t *_fullchain.pem | head -1`
26+
27+
sudo ln -snf $DOMAIN_PATH/$FULLCHAIN /etc/ssl/$1/$FILENAME.crt
28+
29+
sudo service postfix restart
30+
sudo service dovecot restart
31+
sudo service nginx restart
32+
33+
echo "New Certificates for \"$1\" created!"

0 commit comments

Comments
 (0)