-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlinuxfirewall.sh
More file actions
27 lines (26 loc) · 900 Bytes
/
linuxfirewall.sh
File metadata and controls
27 lines (26 loc) · 900 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
echo "0 Save iptables to file"
echo "1 Restore iptables from file"
echo "2 Enable Firewall"
echo "3 Disable Firewall"
echo -n "Enter the desired option > "
read text
if [ $text = "0" ]; then
echo -n "Enter the file where you want to save iptables > "
read dir
sudo iptables-save > $dir
elif [ $text = "1" ]; then
echo -n "Enter the file from you want to restore iptables > "
read dir
sudo iptables-restore $dir
elif [ $text = "2" ]; then
sudo delgroup internet-for-all
sudo addgroup internet-for-all
sudo iptables -D OUTPUT -m owner \! --gid-owner internet-for-all -j REJECT
sudo iptables -A OUTPUT -m owner \! --gid-owner internet-for-all -j REJECT
echo "Use 'sudo -g internet-for-all YOURCOMMAND' to start an application with internet access"
elif [ $text = "3" ]; then
sudo iptables -D OUTPUT -m owner \! --gid-owner internet-for-all -j REJECT
else
echo "Good choice"
fi