linux-l: Firewall und SSH Forwarding

Duncan Rubinger duncan.rubinger at semanticedge.com
Di Nov 6 10:29:08 CET 2001


Hi Allerseits,

folgendes Problem, ich würde gerne eine Firewall so konfigurieren (mit
iptables), dass trotzdem Portforwarding unter SSH möglich ist. Der
User soll sich per SSH einloggen mit dem Forwarding

-L 8002:192.168.0.29:80

Hier mal Teile meiner bisherigen Bemühungen, die leider net so funzen
wie ich gerne hätte.

--- SNIP ---

# Modules
echo Modules
        modprobe ip_tables 
        modprobe ip_conntrack 
        modprobe ip_conntrack_ftp 
        MYIP=62.169.3.89
        IFACE=eth0
        FW=/sbin/iptables
# Flush all
echo FLUSH ALL
    $FW -F
# Close all
echo CLOSE ALL except FORWARD
    $FW -P INPUT DROP
    $FW -P OUTPUT DROP
    $FW -P FORWARD ACCEPT
# Accept local
echo LOCAL accepted
    $FW -A INPUT  -j ACCEPT -i lo
    $FW -A OUTPUT -j ACCEPT -o lo
# SSH/D allowed
echo SSH allowed
    $FW -A INPUT  -j ACCEPT -p tcp -d $MYIP --destination-port ssh 
    $FW -A OUTPUT -j ACCEPT -p tcp -s $MYIP --source-port ssh
    $FW -A OUTPUT -j ACCEPT -p tcp --destination-port ssh
# ICMP - Dedicated by other local connections or to outside
echo ICMP-rest allowed
        iptables -A INPUT  -i $IFACE -p icmp -m state --state ESTABLISHED,RELATED -j ACCEPT 
        iptables -A OUTPUT -o $IFACE -p icmp -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT 

# Hier kommt der Teil von dem ich denke es könnte gehen, tut aber net
# :-(

# Portforwarding ?
    $FW -A INPUT -j ACCEPT -p tcp -d 192.168.0.29 -s 0/0 --destination-port http
    $FW -A OUTPUT -j ACCEPT -p tcp -d 192.168.0.29 -s 0/0 --destination-port http
    $FW -A INPUT -j ACCEPT -p udp -d 192.168.0.29 -s 0/0 --destination-port http
    $FW -A OUTPUT -j ACCEPT -p udp -d 192.168.0.29 -s 0/0 --destination-port http

--- SNAP ---

Idealerweise würde ich das Ganze gerne auf Userlevel filtern können,
dazu kann man wohl die Option --uid-owner benutzen, was aber auch
nicht will ...

#########  User Spezifisch  #############

iptables -A OUTPUT -p udp --destination-port http -m owner --uid-owner duncan -d 192.168.0.29 -j ACCEPT
iptables -A OUTPUT -p tcp --destination-port http -m owner --uid-owner duncan -d 192.168.0.29 -j ACCEPT
iptables -A INPUT -p udp --destination-port http -m owner --uid-owner duncan -d 192.168.0.29 -j ACCEPT
iptables -A INPUT -p tcp --destination-port http -m owner --uid-owner duncan -d 192.168.0.29 -j ACCEPT

Wär super wenn jemand helfen könnte, danke ...

Ciao, Duncan




Mehr Informationen über die Mailingliste linux-l