root/floppyfw-3.0/scripts/dmz-fw.ini

Revision 270, 2.3 KB (checked in by root, 19 months ago)

Stupid mistake, forgot to change it all.

  • 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_DHCP_SERVER" = "y" ]
31then
32  iptables -A INPUT -i ${DMZ_DEVICE} -p TCP --dport 67 -j ACCEPT
33  iptables -A INPUT -i ${DMZ_DEVICE} -p UDP --dport 67 -j ACCEPT
34  iptables -A INPUT -i ${DMZ_DEVICE} -p TCP --dport 68 -j ACCEPT
35  iptables -A INPUT -i ${DMZ_DEVICE} -p UDP --dport 68 -j ACCEPT
36fi
37
38if [ "$DMZ_USE_NAT" = "y" ]
39 then
40  iptables -t nat -A POSTROUTING -s $DMZ_NETWORK/$DMZ_NETMASK -o $OUTSIDE_DEVICE -j MASQUERADE
41fi 
42
43# Open ports:
44# The big caveat here is that multiport only supports 15 ports..
45# We will try to pad that by giving the admin more options..
46if [ -n "$DMZ_ALLOW_TO_OUTSIDE" ]
47then
48  case "$DMZ_ALLOW_TO_OUTSIDE" in
49    all) iptables -A FORWARD -i $DMZ_DEVICE -o $OUTSIDE_DEVICE -j ACCEPT
50        ;;
51    none) echo "No ports opened to OUTSIDE from DMZ"
52        ;;
53    *) iptables -A FORWARD -p tcp -i $DMZ_DEVICE -m multiport --dports $DMZ_ALLOW_TO_OUTSIDE -o $OUTSIDE_DEVICE -j ACCEPT
54        ;;
55  esac
56fi
57
58if [ -n "$DMZ_ALLOW_TO_INSIDE" ]
59then
60  case "$DMZ_ALLOW_TO_INSIDE" in
61    all) iptables -A FORWARD -i $DMZ_DEVICE -o $INSIDE_DEVICE -j ACCEPT
62        ;;
63    none) echo "No ports opened to INSIDE from DMZ"
64        ;;
65    *) iptables -A FORWARD -p tcp -i $DMZ_DEVICE -m multiport --dports $DMZ_ALLOW_TO_INSIDE -o $INSIDE_DEVICE -j ACCEPT
66        ;;
67  esac
68fi
69
70if [ -n "$DMZ_ALLOW_FROM_INSIDE" ]
71then
72  case "$DMZ_ALLOW_FROM_INSIDE" in
73    all) iptables -A FORWARD -i $INSIDE_DEVICE -o $DMZ_DEVICE -j ACCEPT
74        ;;
75    none) echo "No ports opened to DMZ from INSIDE"
76        ;;
77    *) iptables -A FORWARD -p tcp -i $INSIDE_DEVICE -m multiport --dports $DMZ_ALLOW_FROM_INSIDE -o $DMZ_DEVICE -j ACCEPT
78        ;;
79  esac
80fi
81
82# I'd better read the tc man pages and make a more tailored line instead of
83# just copying the one from firewall.ini
84if [ -n "$DMZ_RESTRICT_KBITS" ]
85then
86  tc qdisc add dev $DMZ_DEVICE root tbf rate ${DMZ_RESTRICT_KBITS}kbit latency 50ms burst 1540
87fi
88
Note: See TracBrowser for help on using the browser.