浏览代码

firewall install check

MHSanaei 2 年之前
父节点
当前提交
87f9c7b9f8
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. 8 0
      x-ui.sh

+ 8 - 0
x-ui.sh

@@ -455,6 +455,14 @@ ssl_cert_issue() {
 }
 }
 
 
 open_ports() {
 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
   # Check if the firewall is inactive
   if sudo ufw status | grep -q "Status: active"; then
   if sudo ufw status | grep -q "Status: active"; then