Update setup.sh

This commit is contained in:
borekon 2022-03-14 14:03:16 +01:00
parent 05f4db10f2
commit 80d9a9e5f5

View File

@ -46,7 +46,7 @@ case ${answer:0:1} in
wget https://download.webmin.com/jcameron-key.asc wget https://download.webmin.com/jcameron-key.asc
${SUDO} sudo gpg --dearmor jcameron-key.asc ${SUDO} sudo gpg --dearmor jcameron-key.asc
${SUDO} sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys d97a3ae911f63c51 ${SUDO} sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys d97a3ae911f63c51
rm jcameron-key.asc ${SUDO} rm jcameron-key.asc
${SUDO} apt update && ${SUDO} apt install webmin && WEBMIN=1 ${SUDO} apt update && ${SUDO} apt install webmin && WEBMIN=1
read -p "Press enter to continue" read -p "Press enter to continue"
;; ;;
@ -68,46 +68,46 @@ case ${answer:0:1} in
;; ;;
esac esac
if [ $WEBMIN != 0 ] if [ $WEBMIN != 0 ]
then then
echo -e "${ITALICGREEN}Stopping Webmin${ENDCOLOR}" echo -e "${ITALICGREEN}Stopping Webmin${ENDCOLOR}"
${SUDO} systemctl stop webmin ${SUDO} systemctl stop webmin
${SUDO} certbot certonly --standalone ${SUDO} certbot certonly --standalone
${SUDO} cat /etc/letsencrypt/live/$HOSTNAME/privkey.pem /etc/letsencrypt/live/$HOSTNAME/cert.pem | ${SUDO} tee /etc/letsencrypt/live/$HOSTNAME/combined.pem ${SUDO} cat /etc/letsencrypt/live/$HOSTNAME/privkey.pem /etc/letsencrypt/live/$HOSTNAME/cert.pem | ${SUDO} tee /etc/letsencrypt/live/$HOSTNAME/combined.pem
rm /etc/webmin/miniserv.pem rm /etc/webmin/miniserv.pem
${SUDO} ln -s /etc/letsencrypt/live/$HOSTNAME/combined.pem /etc/webmin/miniserv.pem ${SUDO} ln -s /etc/letsencrypt/live/$HOSTNAME/combined.pem /etc/webmin/miniserv.pem
${SUDO} systemctl start webmin ${SUDO} systemctl start webmin
else else
#echo No #echo No
fi fi
if [ -d "/etc/lighttpd" ] if [ -d "/etc/lighttpd" ]
then then
read -p "Request let's encrypt certificate for lighttpd(y/n)" answer read -p "Request let's encrypt certificate for lighttpd(y/n)" answer
case ${answer:0:1} in case ${answer:0:1} in
y|Y ) y|Y )
echo -e "${ITALICGREEN}Stopping lighttpd${ENDCOLOR}" echo -e "${ITALICGREEN}Stopping lighttpd${ENDCOLOR}"
${SUDO} systemctl stop lighttpd ${SUDO} systemctl stop lighttpd
${SUDO} echo '# /usr/share/doc/lighttpd/ssl.txt' > /etc/lighttpd/conf-available/10-ssl.conf ${SUDO} echo '# /usr/share/doc/lighttpd/ssl.txt' > /etc/lighttpd/conf-available/10-ssl.conf
${SUDO} echo '$SERVER["socket"] == "0.0.0.0:443" {' >> /etc/lighttpd/conf-available/10-ssl.conf ${SUDO} echo '$SERVER["socket"] == "0.0.0.0:443" {' >> /etc/lighttpd/conf-available/10-ssl.conf
${SUDO} echo ' ssl.engine = "enable"' >> /etc/lighttpd/conf-available/10-ssl.conf ${SUDO} echo ' ssl.engine = "enable"' >> /etc/lighttpd/conf-available/10-ssl.conf
${SUDO} echo " ssl.pemfile = \"/etc/letsencrypt/live/$HOSTNAME/combined.pem\"" >> /etc/lighttpd/conf-available/10-ssl.conf ${SUDO} echo " ssl.pemfile = \"/etc/letsencrypt/live/$HOSTNAME/combined.pem\"" >> /etc/lighttpd/conf-available/10-ssl.conf
${SUDO} echo " ssl.ca-file = \"/etc/letsencrypt/live/$HOSTNAME/fullchain.pem\"" >> /etc/lighttpd/conf-available/10-ssl.conf ${SUDO} echo " ssl.ca-file = \"/etc/letsencrypt/live/$HOSTNAME/fullchain.pem\"" >> /etc/lighttpd/conf-available/10-ssl.conf
${SUDO} echo ' ssl.cipher-list = "ECDHE-RSA-AES256-SHA384:AES256-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH:!AESGCM"' >> /etc/lighttpd/conf-available/10-ssl.conf ${SUDO} echo ' ssl.cipher-list = "ECDHE-RSA-AES256-SHA384:AES256-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH:!AESGCM"' >> /etc/lighttpd/conf-available/10-ssl.conf
${SUDO} echo ' ssl.honor-cipher-order = "enable"' >> /etc/lighttpd/conf-available/10-ssl.conf ${SUDO} echo ' ssl.honor-cipher-order = "enable"' >> /etc/lighttpd/conf-available/10-ssl.conf
${SUDO} echo ' ssl.use-sslv2 = "disable"' >> /etc/lighttpd/conf-available/10-ssl.conf ${SUDO} echo ' ssl.use-sslv2 = "disable"' >> /etc/lighttpd/conf-available/10-ssl.conf
${SUDO} echo ' ssl.use-sslv3 = "disable"' >> /etc/lighttpd/conf-available/10-ssl.conf ${SUDO} echo ' ssl.use-sslv3 = "disable"' >> /etc/lighttpd/conf-available/10-ssl.conf
${SUDO} echo '}' >> /etc/lighttpd/conf-available/10-ssl.conf ${SUDO} echo '}' >> /etc/lighttpd/conf-available/10-ssl.conf
${SUDO} echo '$HTTP["scheme"] == "http" {' >> /etc/lighttpd/conf-available/10-ssl.conf ${SUDO} echo '$HTTP["scheme"] == "http" {' >> /etc/lighttpd/conf-available/10-ssl.conf
${SUDO} echo ' $HTTP["host"] =~ ".*" {' >> /etc/lighttpd/conf-available/10-ssl.conf ${SUDO} echo ' $HTTP["host"] =~ ".*" {' >> /etc/lighttpd/conf-available/10-ssl.conf
${SUDO} echo ' url.redirect = ("^/admin/.*" => "https://%0$0")' >> /etc/lighttpd/conf-available/10-ssl.conf ${SUDO} echo ' url.redirect = ("^/admin/.*" => "https://%0$0")' >> /etc/lighttpd/conf-available/10-ssl.conf
${SUDO} echo ' }' >> /etc/lighttpd/conf-available/10-ssl.conf ${SUDO} echo ' }' >> /etc/lighttpd/conf-available/10-ssl.conf
${SUDO} echo '}' >> /etc/lighttpd/conf-available/10-ssl.conf ${SUDO} echo '}' >> /etc/lighttpd/conf-available/10-ssl.conf
${SUDO} ln -s /etc/lighttpd/conf-available/10-ssl.conf /etc/lighttpd/conf-enabled/ ${SUDO} ln -s /etc/lighttpd/conf-available/10-ssl.conf /etc/lighttpd/conf-enabled/
${SUDO} systemctl start lighttpd ${SUDO} systemctl start lighttpd
;; ;;
* ) * )
echo -e SSL certificate was "${BOLDRED}NOT${ENDCOLOR}" installed echo -e SSL certificate was "${BOLDRED}NOT${ENDCOLOR}" installed
;; ;;
esac esac
else else
#echo No #echo No
fi fi