[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Debian]: Firewall & Masquerading RIESENProbleme!



Christian Roth wrote:
> 
> Hallo,
> 
> ich versuche mittlerweile schon seit ein paar (!) Wochen einen NT
> Rechner ueber meine Linux Box ins Internet zu bringen.
> 
> Ich habe mir mit dotfile ipfwadm eine Datei erzeugt und sie nach
> /etc/ppp/firewall kopiert. In der /etc/ppp/ip-up habe ich auch den  .
> /etc/ppp/firewall  Eintrag gemacht. Aber nix ging.
> 
> Meine /etc/ppp/firewall sieht so aus (tut mir echt leid ist etwas
> lang...)
[..] ja habe sie auch nicht komplet gelesen ;-)
> accept
> /sbin/ipfwadm -O -p
> accept
> #
> # End of Firewall
> Configuration
> 
> Hat jemand ein LAN am laufen wo er die Moeglichkeit hat von einer
> Windows Kiste ueber eine Linux Box ins Internet zu kommen?
> Ich  bin am Verzweifeln!!!!!!!!!!!!!
> 
Mein Konzept ist etwas anderst. Hier hängen eigentlich nur linixkisten
am Netz am M$ geht auch. Schon probiert.
Ich lege alle Regeln in /etc/ini.d/netbase fest. Den sie haben nichts
spezifisch mit dem ppp zu tun. SO habe ich auch alles übersichtlich an
einem Ort. Was die Übersicht erhöht. Mit den firewallregeln beim
hochfahren des devise bin ich nicht zurechtgekommen. Hier die netbase
mit dem wichtigsten Auszügen. (hm, ist es unklug so etwas an die
Öffentlichkeit zu bringen?)
#!/bin/sh
#
# start/stop networking daemons.

test -f /sbin/portmap || exit 0

ipfwadmflush () {
        #flush all ipfwadm rules
        echo "flush all ipfwadm rules"
        ipfwadm -I -f
        ipfwadm -O -f
        ipfwadm -F -f
}

spoofprotect () {
Wir haben schlechte Erfahrung mit Packeten die von uns sind, aber nicht
wirklich sind deswegen werden alle! dev dicht gemacht.
        # deny incoming packets pretending to be from 127.0.0.1
        ipfwadm -I -d deny -o -P all -S 127.0.0.0/8 -W eth0 -D 0/0
2>/dev/null || true
        ipfwadm -I -d deny -o -P all -S 127.0.0.0/8 -W eth1 -D 0/0
2>/dev/null || true
        ipfwadm -I -d deny -o -P all -S 127.0.0.0/8 -W ippp0 -D 0/0
2>/dev/null || true
        ipfwadm -I -d deny -o -P all -S 127.0.0.0/8 -W ippp1 -D 0/0
2>/dev/null || true
        ipfwadm -I -d deny -o -P all -S 127.0.0.0/8 -W ippp2 -D 0/0
2>/dev/null || true
        ipfwadm -I -i deny -o -P all -S 127.0.0.0/8 -W eth0 -D 0/0
>/dev/null
        ipfwadm -I -i deny -o -P all -S 127.0.0.0/8 -W eth1 -D 0/0
>/dev/null
        ipfwadm -I -i deny -o -P all -S 127.0.0.0/8 -W ippp0 -D 0/0
>/dev/null
        ipfwadm -I -i deny -o -P all -S 127.0.0.0/8 -W ippp1 -D 0/0
>/dev/null
        ipfwadm -I -i deny -o -P all -S 127.0.0.0/8 -W ippp2 -D 0/0
>/dev/null

        # deny incoming packets pretending to be from our own system.
        # set your own IP address below (or use `hostname -i` to set
it).
        my_ip=192.168.1.2
        ipfwadm -I -d deny -o -P all -S $my_ip -W eth0 -D 0/0
2>/dev/null || true
        ipfwadm -I -d deny -o -P all -S $my_ip -W eth1 -D 0/0
2>/dev/null || true
        ipfwadm -I -d deny -o -P all -S $my_ip/24 -W ippp0 -D 0/0
2>/dev/null || true
        ipfwadm -I -d deny -o -P all -S $my_ip -W ippp1 -D 0/0
2>/dev/null || true
        ipfwadm -I -d deny -o -P all -S $my_ip/24 -W ippp2 -D 0/0
2>/dev/null || true
        ipfwadm -I -a deny -o -P all -S $my_ip -W eth0 -D 0/0 >/dev/null
        ipfwadm -I -a deny -o -P all -S $my_ip -W eth1 -D 0/0 >/dev/null
        ipfwadm -I -a deny -o -P all -S $my_ip/24 -W ippp0 -D 0/0
>/dev/null
        ipfwadm -I -a deny -o -P all -S $my_ip -W ippp1 -D 0/0
>/dev/null
        ipfwadm -I -a deny -o -P all -S $my_ip/24 -W ippp2 -D 0/0
>/dev/null
        echo "done."
# --- alles was mit isdn zutun hat kommt jetzt hier ---
# Wir erlauben nicht mehr so viele Paeckchen die ueber das ISP Netz in
die
# DMZ wollen (scan, hack & Co.).
        echo "masquerading, "
        # deny forwarding packets we use the proxy, but allow 
        # masquerading. 
        ipfwadm -F -p deny
        ipfwadm -F -a m -W ippp0 -S 192.168.1.0/24
        ipfwadm -F -a m -W ippp2 -S 192.168.1.0/24
        # allow some things
        echo -n "allow some things, "
        #ipppp0
        ipfwadm -I -a accept -P tcp -k -W ippp0 #>/dev/null
[...] Was hier steht habe ich mal entfehrnt. Tips und Anregungen auf
besonderen Wunsch.
        # and deny the rest 
        echo "and deny the rest "
Deswegen sollte man das hier dann auch auskommentieren sonst ist es
ultimativ     
   ipfwadm -I -a deny -o -W ippp0 >/dev/null
        #ipfwadm -I -a deny -o -W ippp1 >/dev/null
        #ipfwadm -I -a deny -o -W ippp2 >/dev/null
        # Der Timeserver soll nicht die ganze Nacht die mobilcomroute
offen
        # halten
        #ipfwadm -O -a deny -P udp -S 0/0 ntp -W ippp2 >/dev/null
        #ipfwadm -O -a deny -P tcp -S 0/0 ntp -W ippp2 >/dev/null
# und wenn hier nicht stand, stands oben.
# ntp wird im ip-up/down geregelt
# --- und alles was mit isdn zutun hatte endet hier ---
    # rules for linux 2.1.x (x > 101) kernels
    elif [ -e /proc/net/ip_fwchains ]; then
        echo -n "Setting up IP spoofing protection..."
        ipchains -D input -j DENY -l -s 127.0.0.0/8 -i ! lo 2>/dev/null
|| true
        ipchains -A input -j DENY -l -s 127.0.0.0/8 -i ! lo

        # deny incoming packets pretending to be from our own system.
        # set your own IP address below (or use `hostname -i` to set
it).
#       my_ip=192.168.14.1
#       ipchains -D input -j DENY -l -s $my_ip -i ! lo 2>/dev/null ||
true
#       ipchains -A input -j DENY -l -s $my_ip -i ! lo
        echo "done."
    fi
}


case "$1" in
    start)
        spoofprotect
        echo -n "Starting base networking daemons:"
        echo -n " portmap" ; start-stop-daemon --start --quiet --exec
/sbin/portmap
        echo -n " inetd" ; start-stop-daemon --start --quiet --exec
/usr/sbin/inetd
        echo "."
        ;;
    stop)
        start-stop-daemon --stop --quiet --oknodo --pidfile
/var/run/inetd.pid --exec /usr/sbin/inetd
        start-stop-daemon --stop --quiet --oknodo --exec /sbin/portmap
        ipfwadmflush
        ;;
    reload)
        start-stop-daemon --stop --quiet --oknodo --pidfile
/var/run/inetd.pid --signal 1 --exec /usr/sbin/inetd
        ;;
    restart)
        start-stop-daemon --stop --quiet --oknodo --pidfile
/var/run/inetd.pid --exec /usr/sbin/inetd
        pmap_dump >/var/run/portmap.state
        start-stop-daemon --stop --quiet --oknodo --exec /sbin/portmap
        start-stop-daemon --start --quiet --exec /sbin/portmap
        if [ -f /var/run/portmap.upgrade-state ]; then
          pmap_set </var/run/portmap.upgrade-state
        elif [ -f /var/run/portmap.state ]; then
          pmap_set </var/run/portmap.state
        fi
        rm -f /var/run/portmap.upgrade-state /var/run/portmap.state
        start-stop-daemon --start --quiet --exec /usr/sbin/inetd
        ;;
    *)
        echo "Usage: /etc/init.d/netbase {start|stop|reload|restart}"
        exit 1
        ;;
esac

exit 0

Viel Spaß
-- 
Grüße Christoph Marcel Hilberg Marburg
 
pgp 16 20 43 2A 20 29 61 7A  6A 49 87 5E 34 77 2E B0
------------------------------------------------
Um sich aus der Liste auszutragen schicken Sie
bitte eine E-Mail an majordomo@jfl.de die im Body
"unsubscribe debian-user-de <deine emailadresse>"
enthaelt.
Bei Problemen bitte eine Mail an: Jan.Otto@jfl.de
------------------------------------------------
Anzahl der eingetragenen Mitglieder:     660


Reply to: