/etc/apf-firewall/vnet/vnetgen is in apf-firewall 9.7+rev1-3.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | #! /bin/bash
#
# APF 9.7 [apf@r-fx.org]
###
# Copyright (C) 1999-2007, R-fx Networks <proj@r-fx.org>
# Copyright (C) 2007, Ryan MacDonald <ryan@r-fx.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
###
#
CNF="/etc/apf-firewall/conf.apf"
if [ -f $CNF ]; then
source $CNF
else
echo "$CNF not found, aborting."
exit 1
fi
if [ "$SET_VNET" == "0" ]; then
exit 1
fi
if [ ! -f "$INSTALL_PATH/vnet/vnetgen.def" ]; then
echo "vnetgen.def not found, aborting."
exit 1
fi
if [ ! -f "$ip" ] && [ ! -f "$ifconfig" ]; then
eout "{glob} $ip and $ifconfig not found; aborting"
echo "$ip and $ifconfig not found; aborting"
exit 1
elif [ -f "$ip" ]; then
for addr in `/sbin/ip addr list | tr '/' ' ' | grep -w inet | grep -w $IF | grep -v 127.0.0.1 | grep -vw $NET | awk '{print$2}'`; do
if [ ! -f "$INSTALL_PATH/vnet/$addr.rules" ]; then
touch $INSTALL_PATH/vnet/$addr.rules
chmod 600 $INSTALL_PATH/vnet/$addr.rules
. $INSTALL_PATH/vnet/vnetgen.def
fi
done
elif [ -f "$ifconfig" ]; then
for iface in `ifconfig | grep -w $IF | awk '{print$1}'`; do
for addr in `ifconfig $iface | grep -w inet | tr ':' ' ' | grep -vw $NET | awk '{print$3}'`; do
if [ ! -f "$INSTALL_PATH/vnet/$addr.rules" ]; then
touch $INSTALL_PATH/vnet/$addr.rules
chmod 600 $INSTALL_PATH/vnet/$addr.rules
. $INSTALL_PATH/vnet/vnetgen.def
fi
done
done
fi
if [ "$SET_ADDIFACE" == "1" ]; then
## associate a vnet rule for ip's on additional interfaces other than the main
for anet in `ifconfig | grep Link | grep -vwE "inet|inet6|lo|$IFACE_IN|$IFACE_OUT" | awk '{print$1}'`; do
if [ -f "$ip" ]; then
valtif=`echo $TIF | grep $anet`
if [ "$valtif" == "" ]; then
for addr in `/sbin/ip addr list | tr '/' ' ' | grep -w inet | grep -w $anet | grep -v 127.0.0.1 | grep -vw $NET | awk '{print$2}'`; do
if [ ! -f "$INSTALL_PATH/vnet/$addr.rules" ]; then
touch $INSTALL_PATH/vnet/$addr.rules
chmod 600 $INSTALL_PATH/vnet/$addr.rules
. $INSTALL_PATH/vnet/vnetgen.def
fi
done
fi
elif [ -f "$ifconfig" ]; then
for iface in `ifconfig | grep -w $anet | awk '{print$1}'`; do
valtif=`echo $TIF | grep $anet`
if [ "$valtif" == "" ]; then
for addr in `ifconfig $iface | grep -w inet | tr ':' ' ' | grep -vw $NET | awk '{print$3}'`; do
if [ ! -f "$INSTALL_PATH/vnet/$addr.rules" ]; then
touch $INSTALL_PATH/vnet/$addr.rules
chmod 600 $INSTALL_PATH/vnet/$addr.rules
. $INSTALL_PATH/vnet/vnetgen.def
fi
done
fi
done
fi
done
fi
|