Explorar el Código

Hardening repositories as well on upgrades.

Raphael Schneeberger hace 5 años
padre
commit
d8c43d320b
Se han modificado 1 ficheros con 32 adiciones y 0 borrados
  1. 32 0
      install/upgrade/versions/latest.sh

+ 32 - 0
install/upgrade/versions/latest.sh

@@ -15,3 +15,35 @@ echo "[ ! ] Updating default mail domain templates..."
 $BIN/v-update-mail-templates
 echo "[ ! ] Updating default DNS zone templates..."
 $BIN/v-update-dns-templates
+
+# Rework apt repositories
+apt="/etc/apt/sources.list.d"
+echo "[*] Hardening apt repositories..."
+
+if [ -f "$apt/nginx.list" ]; then
+    if grep -q "http://nginx.org/packages/mainline/" $apt/nginx.list; then
+        echo "    [ * ] NGINX"
+        sed -i "s/http\:\/\/nginx.org/https\:\/\/nginx.org/g" $apt/nginx.list
+    fi
+fi
+
+if [ -f "$apt/php.list" ]; then
+    if grep -q "http://packages.sury.org/" $apt/php.list; then
+        echo "    [ * ] PHP"
+        sed -i "s/http\:\/\/packages.sury.org/https\:\/\/packages.sury.org/g" $apt/php.list
+    fi
+fi
+
+if [ -f "$apt/mariadb.list" ]; then
+    if grep -q "http://ams2.mirrors.digitalocean.com" $apt/mariadb.list; then
+        echo "    [ * ] MariaDB"
+        sed -i "s/http\:\/\/ams2.mirrors.digitalocean.com/https\:\/\/mirror.mva-n.net/g" $apt/mariadb.list
+    fi
+fi
+
+if [ -f "$apt/postgresql.list" ]; then
+    if grep -q "http://apt.postgresql.org" $apt/postgresql.list; then
+        echo "    [ * ] PostgreSQL"
+        sed -i "s/http\:\/\/apt.postgresql.org/https\:\/\/apt.postgresql.org/g" $apt/postgresql.list
+    fi
+fi