Browse Source

Update nginx configuration files during upgrade

Kristan Kenney 5 years ago
parent
commit
1b63456416
1 changed files with 19 additions and 0 deletions
  1. 19 0
      install/upgrade/versions/1.3.1.sh

+ 19 - 0
install/upgrade/versions/1.3.1.sh

@@ -5,3 +5,22 @@
 #######################################################################################
 #######                      Place additional commands below.                   #######
 #######################################################################################
+
+# Update nginx configuration to block connections for unsigned (no SSL certificate) domains
+for ipaddr in $(ls /usr/local/hestia/data/ips/ 2>/dev/null); do
+    web_conf="/etc/$WEB_SYSTEM/conf.d/$ipaddr.conf"
+
+    if [ "$WEB_SYSTEM" = "nginx" ]; then
+        cp -f $HESTIA_INSTALL_DIR/nginx/unassigned.inc $web_conf
+        sed -i 's/directIP/'$ipaddr'/g' $web_conf
+    fi
+
+    if [ "$PROXY_SYSTEM" = "nginx" ]; then
+        echo "[ * ] Adding unassigned hosts configuration to Nginx..."
+        cat $WEBTPL/$PROXY_SYSTEM/proxy_ip.tpl |\
+        sed -e "s/%ip%/$ipaddr/g" \
+            -e "s/%web_port%/$WEB_PORT/g" \
+            -e "s/%proxy_port%/$PROXY_PORT/g" \
+        > /etc/$PROXY_SYSTEM/conf.d/$ipaddr.conf
+    fi
+done