A free, open, self-hosted app platform (GNU AGPLv3): one-click app deploys, Traefik reverse proxy with automatic SSL, rootless Docker support, gluetun VPN routing, and a web dashboard to manage it all. Free & open forever to self-host; optional paid hosted services fund it. See PROMISE.md. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Signed-off-by: librelad <librelad@digitalangels.vip>
69 lines
2.3 KiB
Bash
Executable File
69 lines
2.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
installUFW()
|
|
{
|
|
if [[ "$CFG_REQUIREMENT_UFW" == "true" ]]; then
|
|
ISUFW=$( (sudo ufw status ) 2>&1 )
|
|
if [[ "$ISUFW" == *"command not found"* ]]; then
|
|
isHeader "Install UFW Firewall"
|
|
|
|
((menu_number++))
|
|
echo ""
|
|
echo "---- $menu_number. Installing using linux package installer"
|
|
echo ""
|
|
|
|
local result=$(yes | sudo apt-get install ufw )
|
|
checkSuccess "Installing UFW package"
|
|
|
|
# ((menu_number++))
|
|
# echo ""
|
|
# echo "---- $menu_number. Updating Firewall Rules"
|
|
# echo ""
|
|
|
|
# # Detect SSH port if not provided
|
|
# if [[ -z "$ssh_port" ]]; then
|
|
# SSH_CONFIG="/etc/ssh/sshd_config"
|
|
# ssh_port=$(grep "^Port" "$SSH_CONFIG" 2>/dev/null | awk '{print $2}' | head -n1)
|
|
# ssh_port=${ssh_port:-22} # Default to 22 if not found
|
|
# fi
|
|
|
|
# local result=$(sudo ufw allow $ssh_port)
|
|
# checkSuccess "Enabling Port $ssh_port through the firewall"
|
|
# local result=$(sudo ufw allow ssh)
|
|
# checkSuccess "Enabling SSH through the firewall"
|
|
|
|
# while true; do
|
|
# isQuestion "Do you want to keep port $ssh_port (SSH) open? (y/n): "
|
|
# read -rp "" UFWSSH
|
|
# if [[ "$UFWSSH" =~ ^[yYnN]$ ]]; then
|
|
# break
|
|
# fi
|
|
# isNotice "Please provide a valid input (y/n)."
|
|
# done
|
|
|
|
# if [[ "$UFWSSH" == [nN] ]]; then
|
|
# local result=$(sudo ufw deny $ssh_port)
|
|
# checkSuccess "Blocking Port $ssh_port through the firewall"
|
|
# local result=$(sudo ufw deny ssh)
|
|
# checkSuccess "Blocking SSH through the firewall"
|
|
# fi
|
|
|
|
local result=$(sudo ufw --force enable)
|
|
checkSuccess "Enabling UFW Firewall"
|
|
|
|
((menu_number++))
|
|
echo ""
|
|
echo "---- $menu_number. Changing logging options"
|
|
echo ""
|
|
|
|
local result=$(yes | sudo ufw logging $CFG_UFW_LOGGING)
|
|
checkSuccess "Disabling UFW Firewall Logging"
|
|
|
|
isSuccessful "UFW Firewall has been installed, you can use ufw status to see the status"
|
|
|
|
menu_number=0
|
|
cd
|
|
fi
|
|
fi
|
|
}
|