SSL-Option hinzugefügt (Lets Encrypt)

This commit is contained in:
2017-10-13 22:30:36 +02:00
parent 202e9cdc4a
commit 42943822db
2 changed files with 23 additions and 0 deletions

View File

@@ -1,5 +1,8 @@
#!/bin/bash
rm -rf /usr/local/nginx
rm /etc/systemd/system/nginx.service
lowercase(){
echo "$1" | sed "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/"
}
@@ -56,6 +59,17 @@ else
fi
read -p 'Soll Nginx mit Lets Encrypt eingerichtet werden? (Y/n)' ifle
if [ "$ifle" == "Y" ] || [ "$ifle" == "y" ]; then
git clone https://github.com/certbot/certbot.git /opt/certbot
ln -s /opt/certbot/certbot-auto /usr/local/bin/certbot
ln -s /opt/certbot/certbot-auto /usr/local/bin/letsencrypt
cp make_cert /usr/local/bin
chmod +x /usr/local/bin/make_cert
crontab -l | { cat; echo "@weekly certbot renew --pre-hook 'systemctl stop nginx' --post-hook 'systemctl start nginx' --renew-hook 'systemctl reload nginx' --quiet"; } | crontab -
fi
if [ "$DIST" == "Fedora" ]; then
dnf install gcc gcc-c++ autoconf automake make perl -y
elif [ "$DIST" == "Ubuntu" ] || [ "$DistroBasedOn" == "debian" ]; then
@@ -113,6 +127,8 @@ cd /usr/local/nginx
mkdir sites-available
mkdir sites-enabled
ln -s /usr/local/nginx /usr/local/bin/nginx
echo ""
echo "----------------"
echo "Installation abgeschlossen!"

7
make_cert Normal file
View File

@@ -0,0 +1,7 @@
#!/bin/bash
if [[ -z $1 ]]; then
echo "Die Domain darf nicht leer sein!"
else
letsencrypt certonly -d $1 --pre-hook "systemctl stop nginx" --post-hook "systemctl start nginx"
fi