Add more scripts

This commit is contained in:
Lauri Räsänen 2025-04-27 16:38:54 +03:00
parent 03ab6ee918
commit ddb6d7dcd1
10 changed files with 14 additions and 1 deletions

25
scripts/ufw.sh Executable file
View file

@ -0,0 +1,25 @@
#!/bin/bash
set -euo pipefail
sudo apt install -y ufw
sudo ufw default deny incoming
sudo ufw default allow outgoing
# Allow SSH port
port=$(cat /etc/ssh/sshd_config | grep -o 'Port [0-9]*' | grep -o '[0-9]*')
sudo ufw allow "$port/tcp"
# Allow Nginx if installed
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