root/trunk/wifidog/src/fw.init @ 9

Revision 9, 2.9 KB (checked in by benoitg, 9 years ago)

2004-03-08 Benoit Gr�goire <bock@…>

  • Initial CVS import. Integrate a standrad GNU build system and Doxygen to the build process. Add Doxygen and CVS headers, .cvsignores, etc. Note that the imported code is Philippe April (papril777 at yahoo.com)'s work. Tell me if I forgot anything. Please note that the paths in the src/fw* scripts are still hardcoded. Don't forget to update the ChangeLog file every commit and add doxygen comments to your code. Happy hacking.
  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1#!/bin/sh
2
3#*******************************************************************\
4# This program is free software; you can redistribute it and/or    *
5# modify it under the terms of the GNU General Public License as   *
6# published by the Free Software Foundation; either version 2 of   *
7# the License, or (at your option) any later version.              *
8#                                                                  *
9# This program is distributed in the hope that it will be useful,  *
10# but WITHOUT ANY WARRANTY; without even the implied warranty of   *
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    *
12# GNU General Public License for more details.                     *
13#                                                                  *
14# You should have received a copy of the GNU General Public License*
15# along with this program; if not, contact:                        *
16#                                                                  *
17# Free Software Foundation           Voice:  +1-617-542-5942       *
18# 59 Temple Place - Suite 330        Fax:    +1-617-542-2652       *
19# Boston, MA  02111-1307,  USA       gnu@gnu.org                   *
20#                                                                  *
21#*******************************************************************/
22
23# $Header$
24
25#    @author Copyright (C) 2004 Philippe April <papril777@yahoo.com>
26
27IPTABLES=/sbin/iptables
28
29function usage {
30    echo "Usage: $0 <gw_interface> <gw_ip> <gw_port> <authserv_ip>"
31    echo
32}
33
34if [ ! $4 ]; then
35    usage
36    exit 1
37fi
38
39GW_INTERFACE=$1
40GW_IP=$2
41GW_PORT=$3
42AUTHSERV_IP=$4
43
44${IPTABLES} -t nat -N wifidog_p1
45${IPTABLES} -t nat -A wifidog_p1 -d ${GW_IP} -j ACCEPT
46${IPTABLES} -t nat -A wifidog_p1 -d ${AUTHSERV_IP} -j ACCEPT
47${IPTABLES} -t nat -A wifidog_p1 -p udp --dport 53 -j ACCEPT
48${IPTABLES} -t nat -A wifidog_p1 -p tcp --dport 80 -j REDIRECT --to-ports ${GW_PORT}
49${IPTABLES} -t nat -A wifidog_p1 -j DROP
50
51${IPTABLES} -t nat -N wifidog_p2
52${IPTABLES} -t nat -A wifidog_p2 -j ACCEPT
53
54${IPTABLES} -t nat -N wifidog_p3
55${IPTABLES} -t nat -A wifidog_p3 -j ACCEPT
56
57${IPTABLES} -t nat -N wifidog_p4
58${IPTABLES} -t nat -A wifidog_p4 -j ACCEPT
59
60${IPTABLES} -t nat -N wifidog_p5
61${IPTABLES} -t nat -A wifidog_p5 -j ACCEPT
62
63${IPTABLES} -t nat -N wifidog_class
64${IPTABLES} -t nat -A wifidog_class -i ${GW_INTERFACE} -m mark --mark 0x1 -j wifidog_p1
65${IPTABLES} -t nat -A wifidog_class -i ${GW_INTERFACE} -m mark --mark 0x2 -j wifidog_p2
66${IPTABLES} -t nat -A wifidog_class -i ${GW_INTERFACE} -m mark --mark 0x3 -j wifidog_p3
67${IPTABLES} -t nat -A wifidog_class -i ${GW_INTERFACE} -m mark --mark 0x4 -j wifidog_p4
68${IPTABLES} -t nat -A wifidog_class -i ${GW_INTERFACE} -m mark --mark 0x5 -j wifidog_p5
69
70${IPTABLES} -t mangle -N wifidog_mark
71${IPTABLES} -t mangle -A wifidog_mark -j MARK --set-mark 0x1
72
73${IPTABLES} -t mangle -I PREROUTING 1 -i eth1 -j wifidog_mark
74${IPTABLES} -t nat -I PREROUTING 1 -i eth1 -j wifidog_class
75
Note: See TracBrowser for help on using the browser.