-
Notifications
You must be signed in to change notification settings - Fork 2
/
firewall
executable file
·47 lines (42 loc) · 1021 Bytes
/
firewall
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
# Get include path.
dir="${BASH_SOURCE%/*}"
if [[ ! -d "$dir" ]]; then
dir="$PWD"
fi
# Include functions.
source "$dir"/include.sh
# Make sure we're running as root as required by iptables.
check_root
# Make sure that iptables is actually installed.
check_software "iptables"
case "$1" in
reset)
source "$dir"/reset.sh
echo "Resetting all firewall rules."
reset_firewall
;;
stateful)
source "$dir"/stateful.sh
echo "Setting the firewall to a stateful state."
set_stateful_firewall
;;
sshguard)
source "$dir"/sshguard.sh
check_software "sshguard"
echo "Adding sshguard rules."
add_sshguard_rules
;;
portscanner)
source "$dir"/portscanner.sh
echo "Adding the port scanner rules."
add_portscanner_rules
;;
open)
source "$dir"/open.sh
shift
open_port_entry "$@"
;;
*)
echo "unrecognized command" ;;
esac