File: runfwscript

package info (click to toggle)
firewall-easy 0.30-5
  • links: PTS
  • area: main
  • in suites: woody
  • size: 320 kB
  • ctags: 5
  • sloc: sh: 899; makefile: 42; perl: 38
file content (54 lines) | stat: -rwxr-xr-x 1,370 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
#!/bin/sh
#	runfwscript 0.02
#
#	Copyright (C) 2000:	Manel Marin <manel3@apdo.com>
#	Licence:		GNU GPL version >= 2
#
#
#	Selecciona un script segn el soporte de filtrado del kernel
#
#	Uso:	runfwscript script
#	esto lanzar script-ipfwadm o script-ipchains o script-iptables
#	o dar un mensaje de error si no hay soporte de filtrado en el kernel
#
#		runfwscript -i script	#muestra el comando que se lanzara
#
#--------
#	Selects a script depending on the kernel packet filter support
#
#	Use:	runfwscript script
#	this will run script-ipfwadm or script-ipchains or script-iptables
#	or echo an error message if there is no packetfilter support in kernel
#
#		runfwscript -i script	#shows command should be runned
#


PATH=/sbin:/usr/sbin:/usr/lib/firewall-easy:/bin:/usr/bin
if [ -e /proc/net/ip_input ]
then
    FW="ipfwadm"

elif [ -e /proc/net/ip_fwchains ]
then
    FW="ipchains"

# Si existe modulo iptables y monta/ya esta montado
# If module iptables exists and mounts/already mounted
elif insmod -p ip_tables > /dev/null 2>&1
then
    FW="iptables"

else
    echo "firewall-easy: No packet filter support detected in kernel" 1>&2
    exit
fi

if [ "$1" = "-i" ]
then
    shift			# Salto la opcin "-i"
    echo "firewall-easy: $FW support detected" 1>&2		# -> stderr
    echo "$1-$FW"		# Muestro comando que se lanzara
else
    $1-$FW			# Lanzo comando
fi