From e9f9e53fd9fe81dea20068a9bf3768fdbe6cd77e Mon Sep 17 00:00:00 2001 From: anonpenguin Date: Tue, 8 Apr 2025 11:21:14 +0300 Subject: [PATCH] updated installed script ufw settings --- package.json | 2 +- scripts/install.sh | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 9bf1cc3..6ac14ad 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@debros/node", "type": "module", - "version": "0.0.14-alpha", + "version": "0.0.15-alpha", "description": "DeBros Node", "main": "dist/index.js", "bin": "dist/cli.js", diff --git a/scripts/install.sh b/scripts/install.sh index 605923b..7800c11 100644 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -175,16 +175,22 @@ else sudo apt-get install -y ufw fi - log "${GREEN}Configuring firewall...${NOCOLOR}" + # Capture the initial state of ufw + UFW_INITIAL_STATUS=$(sudo ufw status | grep -o "Status: [a-z]*" | awk '{print $2}') + + log "${GREEN}Configuring firewall rules...${NOCOLOR}" sudo ufw allow 7777 sudo ufw allow 7778 - if [[ $(sudo ufw status) =~ "inactive" ]]; then - log "${GREEN}Enabling firewall...${NOCOLOR}" + # Only enable ufw if it was already active + if [[ "$UFW_INITIAL_STATUS" == "active" ]]; then + log "${GREEN}Ensuring firewall remains enabled...${NOCOLOR}" echo "y" | sudo ufw enable + else + log "${GREEN}Firewall rules added, but not enabling UFW as it was initially inactive.${NOCOLOR}" fi - log "${GREEN}Firewall configured successfully.${NOCOLOR}" + log "${GREEN}Firewall configuration completed.${NOCOLOR}" fi KEY_DIR="/var/lib/debros/keys"