root/floppyfw/files/dmz-fw.ini

Revision 249, 2.0 KB (checked in by root, 4 years ago)

Big sync, adding stuff from 3.0 and some other smallies.

  • Property svn:executable set to *
Line 
1#!/bin/sh
2
3# $Id:$
4
5#
6# dmz-fw.ini
7# A typical firewall subscript.
8#
9# Thomas Lundquist <thomasez@zelow.no>
10#
11
12# If no dmz info file, there is no use for this script.
13
14[ -f /etc/dmz.info ] || exit;
15
16. /etc/functions.inc
17
18. /etc/config
19
20. /etc/dmz.info
21. /etc/inside.info
22. /etc/outside.info
23
24echo "Setting up DMZ."
25
26# We will automatically accept DNS requests.
27iptables -A INPUT -i ${DMZ_DEVICE} -p TCP --dport 53 -j ACCEPT
28iptables -A INPUT -i ${DMZ_DEVICE} -p UDP --dport 53 -j ACCEPT
29
30if [ "$DMZ_USE_NAT" = "y" ]
31 then
32  iptables -t nat -A POSTROUTING -s $DMZ_NETWORK/$DMZ_NETMASK -o $OUTSIDE_DEVICE -j MASQUERADE
33fi 
34
35# Open ports:
36# The big caveat here is thet multiport only supports 15 ports..
37# We will try to pad that by giving the admin more options..
38if [ -n "$DMZ_ALLOW_TO_OUTSIDE" ]
39then
40  case "$DMZ_ALLOW_TO_OUTSIDE" in
41    all) iptables -A FORWARD -i $DMZ_DEVICE -o $OUTSIDE_DEVICE -j ACCEPT
42        ;;
43    none) echo "No ports opened to OUTSIDE from DMZ"
44        ;;
45    *) iptables -A FORWARD -p tcp -i $DMZ_DEVICE -m multiport --dports $DMZ_ALLOW_TO_OUTSIDE -o $OUTSIDE_DEVICE -j ACCEPT
46        ;;
47  esac
48fi
49
50if [ -n "$DMZ_ALLOW_TO_INSIDE" ]
51then
52  case "$DMZ_ALLOW_TO_INSIDE" in
53    all) iptables -A FORWARD -i $DMZ_DEVICE -o $INSIDE_DEVICE -j ACCEPT
54        ;;
55    none) echo "No ports opened to INSIDE from DMZ"
56        ;;
57    *) iptables -A FORWARD -p tcp -i $DMZ_DEVICE -m multiport --dports $DMZ_ALLOW_TO_INSIDE -o $INSIDE_DEVICE -j ACCEPT
58        ;;
59  esac
60fi
61
62if [ -n "$DMZ_ALLOW_FROM_INSIDE" ]
63then
64  case "$DMZ_ALLOW_FROM_INSIDE" in
65    all) iptables -A FORWARD -i $INSIDE_DEVICE -o $DMZ_DEVICE -j ACCEPT
66        ;;
67    none) echo "No ports opened to DMZ from INSIDE"
68        ;;
69    *) iptables -A FORWARD -p tcp -i $INSIDE_DEVICE -m multiport --dports $DMZ_ALLOW_FROM_INSIDE -o $DMZ_DEVICE -j ACCEPT
70        ;;
71  esac
72fi
73
74# I'd better read the tc man pages and make a more tailored line instead of
75# just copying the one from firewall.ini
76if [ -n "$DMZ_RESTRICT_KBITS" ]
77then
78  tc qdisc add dev $OUTSIDE_DEVICE root tbf rate ${DMZ_RESTRICT_KBITS}kbit latency 50ms burst 1540
79fi
80
Note: See TracBrowser for help on using the browser.