-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
jjako
committed
Jan 15, 2004
1 parent
76032b9
commit 2185ba2
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/bin/sh | ||
# | ||
# Firewall script for GGSN | ||
# | ||
# Uses $IFGN (eth0) as the Gn interface (Gn) and | ||
# $IFGI (eth1) as the Gi interface. | ||
# | ||
# SUMMARY | ||
# * All connections originating from GGSN are allowed. | ||
# * Incoming ssh, GTPv0 and GTPv1 is allowed on the Gn interface. | ||
# * Incoming ssh is allowed on the Gi interface. | ||
# * Forwarding is allowed to and from the Gi interface, but disallowed | ||
# to and from the Gn interface. | ||
# * Masquerede on Gi interface. | ||
|
||
IPTABLES="/sbin/iptables" | ||
IFGN="eth0" | ||
IFGI="eth1" | ||
|
||
$IPTABLES -P INPUT DROP | ||
$IPTABLES -P FORWARD ACCEPT | ||
$IPTABLES -P OUTPUT ACCEPT | ||
|
||
#Allow related and established on all interfaces (input) | ||
$IPTABLES -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT | ||
|
||
#Allow releated, established, GTP and ssh on $IFGN. Reject everything else. | ||
$IPTABLES -A INPUT -i $IFGN -p tcp -m tcp --dport 22 --syn -j ACCEPT | ||
$IPTABLES -A INPUT -i $IFGN -p udp -m udp --dport 2123 -j ACCEPT | ||
$IPTABLES -A INPUT -i $IFGN -p udp -m udp --dport 2152 -j ACCEPT | ||
$IPTABLES -A INPUT -i $IFGN -p udp -m udp --dport 3386 -j ACCEPT | ||
$IPTABLES -A INPUT -i $IFGN -j REJECT | ||
|
||
#Allow related, established and ssh. Drop everything else. | ||
$IPTABLES -A INPUT -i $IFGI -p tcp -m tcp --dport 22 --syn -j ACCEPT | ||
$IPTABLES -A INPUT -i $IFGI -j DROP | ||
|
||
# Masquerade everything going out on $IFGI | ||
$IPTABLES -t nat -A POSTROUTING -o $IFGI -j MASQUERADE | ||
|
||
#Allow everything on loopback interface. | ||
$IPTABLES -A INPUT -i lo -j ACCEPT | ||
|
||
# Drop everything to and from $IFGN (forward) | ||
$IPTABLES -A FORWARD -i $IFGN -j DROP | ||
$IPTABLES -A FORWARD -o $IFGN -j DROP | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters