summary refs log tree commit diff
path: root/noarch/firewall.sh
blob: f760593a875374795c6e783ef7cf7dd8ecff5684 (plain) (blame)
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
48
49
#!/bin/sh
#
# @Usage:
#
# . ./firewall/firewall.sh
# make_hole_in_firewall [ port ]
# make_hole_in_firewall [ port ]
#

DEFAULT_SNMP_BROADCAST_PORT="22161"
FIREWALL_NAME_TEMPL="firewall-"

make_hole_in_firewall() {
	local path="."
	if [ -n "$1" ]; then
		path="$1"
	fi
	local PORT=$DEFAULT_SNMP_BROADCAST_PORT
	local FILE_LIST="$(ls "$path/$FIREWALL_NAME_TEMPL"*)"

	for i in $FILE_LIST	; do
		. $i
		make_hifw_${i#*${FIREWALL_NAME_TEMPL}} $PORT
	done
}

plug_hole_in_firewall() {
	local path="."
	if [ -n "$1" ]; then
		path="$1"
	fi
	local PORT=$DEFAULT_SNMP_BROADCAST_PORT
	local FILE_LIST="$(ls "$path/$FIREWALL_NAME_TEMPL"*)"


	for i in $FILE_LIST	; do
		. "$i"
		plug_hifw_${i#*${FIREWALL_NAME_TEMPL}} $PORT
	done
}

test_iptables() {
	log_message "TEST IPTABLES"
	/sbin/iptables -L
	log_message "TEST IP6TABLES"
	/sbin/ip6tables -L
}