From 42943822db8c016191164800d871d9d5c976c790 Mon Sep 17 00:00:00 2001 From: fthielen Date: Fri, 13 Oct 2017 22:30:36 +0200 Subject: [PATCH] =?UTF-8?q?SSL-Option=20hinzugef=C3=BCgt=20(Lets=20Encrypt?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 16 ++++++++++++++++ make_cert | 7 +++++++ 2 files changed, 23 insertions(+) create mode 100644 make_cert diff --git a/install.sh b/install.sh index dbe1716..896c7cc 100755 --- a/install.sh +++ b/install.sh @@ -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!" diff --git a/make_cert b/make_cert new file mode 100644 index 0000000..924b734 --- /dev/null +++ b/make_cert @@ -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 \ No newline at end of file