Add more scripts
This commit is contained in:
parent
03ab6ee918
commit
ddb6d7dcd1
10 changed files with 14 additions and 1 deletions
25
scripts/ufw.sh
Executable file
25
scripts/ufw.sh
Executable 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
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue