← Back to team overview

sslug-teknik team mailing list archive

IPTABLES; hvis jeg prøver at kontakte en portforwarded ip indefra - kan jeg ikke få fat.

 

Hej Alle

Jeg har nedenstående filter i min test-firewall (debian potato
2.4.0-test4 kerne)
Jeg har åbnet for meget, det ved jeg godt - det var test af PCAnywhere
gennem firewall.

Jeg kan godt få det meste til at virke dog har jeg følgende problem

1) Hvis jeg indefra forsøger at connecte til min server 10.10.10.4 - port
80 - ingen problemer
Hvis jeg udefra connecter til den IP der er forwarded til denne server -
ingen problemer
Men hvis jeg indefra connecter til den "externe" ip, så får jeg hverken
webserverens elller firewallens port 80 - det timer bare ud.
(Og nej, jeg kan ikke bare nøjes med at connecte til den interne ip :-)))

Er der nogen der har en ide om hvad der er galt ???

Er det btw nogen der har et scritp til en firewall med DMZ og det hele der
kan lånes til inspiration ???


Mvh
Lasse



---------------------------- SCRIPT HERUNDER
--------------------------------------

<indledning fjernet> - Det er Størners script fra www.sslug.dk

# Allow traffic on established connections
iptables -A block -m state --state ESTABLISHED,RELATED -j ACCEPT
# Allow new connections if not from the outside
iptables -A block -m state --state NEW -i ! eth0 -j ACCEPT

# Allow new connections to our public services
# For home users there are normally none
#SSH
iptables -A block -m state --protocol tcp --state NEW --destination-port 22
-j A
CCEPT
iptables -A block -m state --protocol udp --state NEW --destination-port 22
-j A
CCEPT
#WEB
iptables -A block -m state --protocol tcp --state NEW --destination-port 80
-j A
CCEPT
#NOTES
iptables -A block -m state --protocol tcp --state NEW --destination-port
1352 -j
 ACCEPT
#PCANYWHERE
#iptables -A block -m state --protocol udp --state NEW -j ACCEPT
iptables -A block -m state --protocol tcp --state NEW --destination-port
5631 -j
 ACCEPT
iptables -A block -m state --protocol tcp --state NEW --destination-port
5632 -j
 ACCEPT
iptables -A block -m state --protocol udp --state NEW --destination-port
5631 -j
 ACCEPT
iptables -A block -m state --protocol udp --state NEW --destination-port
5632 -j
 ACCEPT
# Block anything else
iptables -A block --protocol udp --destination-port 137 -j DROP
iptables -A block --protocol udp --destination-port 138 -j DROP
iptables -A block --protocol udp --destination-port 513 -j DROP
iptables -A block -j LOG

# Activate the new chain
iptables -A INPUT -j block
iptables -A FORWARD -j block

####################
# Setup Masquerading
####################


# Setup NAT for outgoing connections from the local network

### NB: This is disabled by default. If you want to use     ###
###     masquerading, just remove the "###" comment-markers ###
###     from the lines below.                               ###

iptables -t nat -F POSTROUTING
iptables -t nat -F PREROUTING
iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to <min ip1>
iptables -t nat -A PREROUTING -p tcp -d <min ip2> -j DNAT --to 10.10.10.4
iptables -t nat -A PREROUTING -p udp -d <min ip2> -j DNAT --to 10.10.10.4
echo "1" >/proc/sys/net/ipv4/ip_forward