Fixed switch case and defult policy for home profile. Added exit option. Added separation lines in verbose output.

This commit is contained in:
K 2024-11-19 00:09:37 +05:30
parent 35d1748b8a
commit 32f9a93914
Signed by: notkshitij
GPG Key ID: C5B8BC7530F8F43F

View File

@ -2,8 +2,9 @@
echo -e "--- MAIN MENU ---\n1. Home profile\n2. Public profile\n3. PANIC MODE\n4. Exit"
read -p "Choose an option: " optn
line="--------------------------------------------"
case optn in
case $optn in
1) # Home profile
for i in {0..5}
do
@ -17,7 +18,9 @@ case optn in
sudo ufw allow in from 192.168.219.0/24 to any port 22000 # Syncthing TCP
sudo ufw allow in from 192.168.219.0/24 to any port 21027 proto udp # Syncthing UDP
sudo ufw reload
echo "$line"
sudo ufw status verbose
echo "$line"
;;
2) # Public profile
for i in {0..5}
@ -26,7 +29,10 @@ case optn in
done
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw reload
echo "$line"
sudo ufw status verbose
echo "$line"
;;
3) # Panic mode
for i in {0..7}
@ -34,8 +40,15 @@ case optn in
yes | sudo ufw delete 1
done
sudo ufw default deny incoming
sudo ufw default deny outcoming
sudo ufw default deny outgoing
sudo ufw reload
echo "$line"
sudo ufw status verbose
echo "$line"
;;
4) # Exit
echo '## END OF SCRIPT'
exit 0
;;
*) # Default
echo 'Please choose a valid option (1-4).'