File: fwctl.init

package info (click to toggle)
fwctl 0.25-6
  • links: PTS
  • area: main
  • in suites: potato
  • size: 988 kB
  • ctags: 327
  • sloc: perl: 5,042; sh: 98; makefile: 57
file content (72 lines) | stat: -rw-r--r-- 1,620 bytes parent folder | download
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/sh
#
# fwctl		This shell script takes care of configuring the firewall
#           	using fwctl.
#
# description: Configure the IP packet filtering firewall
#
# changes for Debian from <ecki@debian.org> Bernd Eckenfels

# Warning: if you put "fwctl stop" here your system is cut off the net
# stop_action="stop"
stop_action="flush"
# You can activate ip-forwarding if you want to set up your system as a router
activate_forwarding="no"

interfaces=/etc/fwctl/interfaces

[ -x /usr/sbin/fwctl ] || exit 0;

SYS_IPF=/proc/sys/net/ipv4/ip_forward

# See how we were called.
case "$1" in
  start)
	# Is the package configured yet?
	egrep -v '^[ 	]*$|^#' $interfaces >/dev/null || exit 0
	echo -n "Starting IP packet filters: "
	/usr/sbin/fwctl start
	echo "fwctl."
	echo -n "Starting IP forwarding: "
	if [ x"$activate_forwarding" = x"no" ]; then
		echo "no (not activated in /etc/init.d/fwctl)."
	else
		if [ -f $SYS_IPF ]; then
			echo 1 > $SYS_IPF
			echo "done."
		else
			echo "no (no $SYS_IPF found)."
		fi
	fi
	;;
  stop)
	# Stop daemons.
	echo -n "Stopping IP forwarding: "
	if [ x"$activate_forwarding" = x"no" ]; then
		echo "no (not activated in /etc/init.d/fwctl)."
	else
		if [ -f $SYS_IPF ]; then
			echo 0 > $SYS_IPF
			echo "done."
		else
			echo "no (no $SYS_IPF found)."
		fi
	fi
	echo -n "Stopping IP packet filters: " 
	/usr/sbin/fwctl $stop_action
	echo "fwctl."
	;;
  check)
	fwctl check
	;;
  restart|force-reload)
	echo -n  "Restarting IP packet filters: " 
	fwctl restart
	echo "fwctl."
	;;
  *)
        echo "Usage: fwctl {start|stop|check|restart|force-reload}"
        exit 1
esac

exit 0