Explorar o código

firewall install check

MHSanaei %!s(int64=2) %!d(string=hai) anos
pai
achega
87f9c7b9f8
Modificáronse 1 ficheiros con 8 adicións e 0 borrados
  1. 8 0
      x-ui.sh

+ 8 - 0
x-ui.sh

@@ -455,6 +455,14 @@ ssl_cert_issue() {
 }
 
 open_ports() {
+if ! command -v ufw &> /dev/null
+then
+    echo "ufw firewall is not installed. Installing now..."
+    sudo apt-get update
+    sudo apt-get install -y ufw
+else
+    echo "ufw firewall is already installed"
+fi
 
   # Check if the firewall is inactive
   if sudo ufw status | grep -q "Status: active"; then