Skip to content

Commit

Permalink
fix: changes on ufw automatic open ports
Browse files Browse the repository at this point in the history
  • Loading branch information
Gorossy committed Jan 31, 2025
1 parent ef2e43b commit a9cad35
Showing 1 changed file with 8 additions and 34 deletions.
42 changes: 8 additions & 34 deletions scripts/installer/install_sn27.sh
Original file line number Diff line number Diff line change
Expand Up @@ -310,40 +310,14 @@ linux_configure_ufw() {
ohai "Allowing SSH (port 22) through UFW..."
sudo ufw allow 22/tcp

if [[ "$AUTOMATED" == "true" ]]; then
local default_range="2000-5000"
ohai "AUTOMATED mode: enabling UFW for port range $default_range"
sudo ufw allow "${default_range}/tcp"
ohai "Opening ports 8091 and 4444 for verifiers..."
sudo ufw allow 8091/tcp
sudo ufw allow 4444/tcp
sudo ufw enable
ohai "UFW configured automatically for port range $default_range (SSH is open, plus 8091 & 4444)."
else
echo "Please enter the port range for UFW (e.g., 2000-5000):"
read -p "Enter port range (start-end): " port_range

if [[ "$port_range" =~ ^[0-9]+-[0-9]+$ ]]; then
start_port=$(echo "$port_range" | cut -d'-' -f1)
end_port=$(echo "$port_range" | cut -d'-' -f2)

if [[ $start_port -lt $end_port ]]; then
ohai "Enabling UFW for port range $start_port-$end_port"
sudo ufw allow "${start_port}:${end_port}/tcp"
ohai "Opening ports 8091 and 4444 for verifiers..."
sudo ufw allow 8091/tcp
sudo ufw allow 4444/tcp
sudo ufw enable
ohai "UFW configured successfully with port range $port_range (SSH is open, plus 8091 & 4444)."
else
echo "Invalid port range. The start port should be less than the end port."
exit 1
fi
else
echo "Invalid port range format. Please use the format: start-end (e.g., 2000-5000)"
exit 1
fi
fi
ohai "Opening ports 8091 and 4444 for verifiers..."
sudo ufw allow 8091/tcp
sudo ufw allow 4444/tcp

ohai "Enabling UFW..."
sudo ufw --force enable

ohai "UFW configured. Open ports: 22 (SSH), 8091, 4444."
}


Expand Down

0 comments on commit a9cad35

Please sign in to comment.