This commit is contained in:
Lauri Räsänen 2025-04-27 01:19:08 +03:00
commit 58328a42d5
6 changed files with 89 additions and 0 deletions

23
ufw.sh Executable file
View file

@ -0,0 +1,23 @@
#!/bin/bash
set -euo pipefail
sudo apt install -y ufw
sudo ufw default deny incoming
sudo ufw default allow outgoing
port=$(cat /etc/ssh/sshd_config | grep -o 'Port [0-9]*' | grep -o '[0-9]*')
sudo ufw allow "$port/tcp"
if ! which nginx; then
sudo ufw allow "Nginx Full"
fi
sudo ufw show added
read -p "Rules good? [y/N]: " prompt
if [[ $prompt == "y" ]]; then
sudo ufw enable
fi