| 1 |
#!/bin/sh |
| 2 |
# |
| 3 |
# |
| 4 |
# Firewall Builder |
| 5 |
# |
| 6 |
# Copyright (C) 2003 NetCitadel, LLC |
| 7 |
# |
| 8 |
# Author: Vadim Kurland [email protected] |
| 9 |
# |
| 10 |
# $Id$ |
| 11 |
# |
| 12 |
# This program is free software which we release under the GNU General Public |
| 13 |
# License. You may redistribute and/or modify this program under the terms |
| 14 |
# of that license as published by the Free Software Foundation; either |
| 15 |
# version 2 of the License, or (at your option) any later version. |
| 16 |
# |
| 17 |
# This program is distributed in the hope that it will be useful, |
| 18 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 |
# GNU General Public License for more details. |
| 21 |
# |
| 22 |
# To get a copy of the GNU General Public License, write to the Free Software |
| 23 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 |
# |
| 25 |
# |
| 26 |
|
| 27 |
XMLFILE="objects.xml" # default fallback if -f option is missing |
| 28 |
DIR="." |
| 29 |
V="" |
| 30 |
LIB="User" # default library |
| 31 |
|
| 32 |
while getopts f:d:l:va opt |
| 33 |
do |
| 34 |
case "$opt" in |
| 35 |
a) all="yes" ;; |
| 36 |
v) V="-v " ;; |
| 37 |
f) XMLFILE=$OPTARG ;; |
| 38 |
d) DIR=$OPTARG ;; |
| 39 |
l) LIB=$OPTARG ;; |
| 40 |
\?) ;; |
| 41 |
esac |
| 42 |
done |
| 43 |
|
| 44 |
shift `expr $OPTIND - 1` |
| 45 |
|
| 46 |
test -n "$all" && LIST=`fwblookup -f $XMLFILE -lN /${LIB}/Firewalls | grep -v Firewalls` || { |
| 47 |
while test -n "$1"; do |
| 48 |
LIST="$LIST $1" |
| 49 |
shift |
| 50 |
done |
| 51 |
} |
| 52 |
|
| 53 |
for f in `echo $LIST`; do |
| 54 |
platform=`fwblookup -f $XMLFILE -a platform /${LIB}/Firewalls/$f` |
| 55 |
case "$platform" in |
| 56 |
iptables) comp="fwb_ipt" ;; |
| 57 |
ipf) comp="fwb_ipf" ;; |
| 58 |
ipfw) comp="fwb_ipfw";; |
| 59 |
pf) comp="fwb_pf" ;; |
| 60 |
pix) comp="fwb_pix" ;; |
| 61 |
\?) echo "Unknown platform \"$platform\""; exit 1 ;; |
| 62 |
esac |
| 63 |
echo |
| 64 |
echo "################ $f" |
| 65 |
$comp $V -f $XMLFILE -d $DIR $f; |
| 66 |
done |
| 67 |
|