summary refs log tree commit diff
path: root/noarch/firewall-firewalld
blob: 5753cc4fa7028c26c882cc8438b3af55b2282200 (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
50
51
plug_hifw_firewalld() {
# plug hifw - plug hole in firewall for Fedora 18
# $1 - port
	local FIREWALL_CMD=firewall-cmd
	local FIREWALL_OFFLINE_CMD=firewall-offline-cmd
	if ! which "$FIREWALL_CMD" ; then
		log_message "cannot find file FIREWALL_CMD"
		return 1
	fi


	if "$FIREWALL_CMD" --state ; then
		"$FIREWALL_CMD" --permanent --remove-port=${1}/udp
		"$FIREWALL_CMD" --remove-port=${1}/udp
	else
		if ! which "$FIREWALL_OFFLINE_CMD" ; then
			log_message "cannot find file FIREWALL_OFFLINE_CMD"
			return 1
		else
			"$FIREWALL_OFFLINE_CMD" --remove-port=${1}/udp
		fi
	fi
}


make_hifw_firewalld() {
# mhifw - make hole in firewall for Fedora 18
# $1 - port
	local FIREWALL_CMD=firewall-cmd
	local FIREWALL_OFFLINE_CMD=firewall-offline-cmd

	plug_hifw_firewalld $1

	if ! which "$FIREWALL_CMD" ; then
		log_message "cannot find file FIREWALL_CMD"
		return 1
	fi

	if "$FIREWALL_CMD" --state ; then
		"$FIREWALL_CMD" --permanent --add-port=${1}/udp
		"$FIREWALL_CMD" --add-port=${1}/udp
	else
		if ! which "$FIREWALL_OFFLINE_CMD" ; then
			log_message "cannot find file FIREWALL_OFFLINE_CMD"
			return 1
		else
			"$FIREWALL_OFFLINE_CMD" --add-port=${1}/udp
		fi
	fi
}