linux firewall - not flawless

Discussion in 'Archives' started by mu-b, Jun 26, 2009.

linux firewall - not flawless
  1. Unread #1 - Jun 26, 2009 at 2:02 PM
  2. mu-b
    Joined:
    Jun 24, 2009
    Posts:
    1,353
    Referrals:
    2
    Sythe Gold:
    0

    mu-b War is a Drug
    Banned

    linux firewall - not flawless

    Code:
    #Set variable
    IPT=/sbin/iptables
    MAILSER=192.168.1.1
    #Load module
    modprobe ip_conntrack
    modprobe ip_conntrack_ftp
    #clear and flush rule
    $IPT -F
    $IPT -X
    #Set default policy
    $IPT -P INPUT DROP
    $IPT -P FORWARD DROP
    $IPT -P OUTPUT DROP
    #Set input chain
    $IPT -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
    $IPT -A INPUT -p tcp --dport 22 -j LOG --log-level 5 --log-prefix "IPTABLES:"
    $IPT -A INPUT -p tcp -d $MAILSER --dport 22 -j ACCEPT
    $IPT -A INPUT -p tcp -d $MAILSER --dport 80 -j ACCEPT
    $IPT -A INPUT -p udp --dport 53 -j ACCEPT
    $IPT -A INPUT -i lo -j ACCEPT
    $IPT -A INPUT -p tcp -d $MAILSER --dport 25 -j ACCEPT
    $IPT -A INPUT -p tcp -d $MAILSER --dport 110 -j ACCEPT
    $IPT -A INPUT -p tcp -d $MAILSER --dport 143 -j ACCEPT
    #Set output chain
    $IPT -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
    $IPT -A OUTPUT -p udp --sport 53 -j ACCEPT
    $IPT -A OUTPUT -o lo -j ACCEPT
    $IPT -A OUTPUT -p tcp --sport 25 -j ACCEPT
    $IPT -A OUTPUT -p tcp --sport 110 -j ACCEPT
    $IPT -A OUTPUT -p tcp --sport 143 -j ACCEPT
    #Set forward chain
    $IPT -A POSTROUTING -t nat -s 192.168.0.0/24 -o eth0 -j MASQUERADE
    $IPT -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
    $IPT -A FORWARD -s 192.168.0.0/24 -j ACCEPT
    #4444/445/69/135/139
    iptables -A FORWARD -p tcp --dport 4444 -j DROP
    iptables -A FORWARD -p udp --dport 4444 -j DROP
    #
    iptables -A FORWARD -p tcp --dport 445 -j DROP
    iptables -A FORWARD -p udp --dport 445 -j DROP
    #
    iptables -A FORWARD -p tcp --dport 69 -j DROP
    iptables -A FORWARD -p udp --dport 69 -j DROP
    #
    iptables -A FORWARD -p tcp --dport 135 -j DROP
    iptables -A FORWARD -p udp --dport 135 -j DROP
    #
    iptables -A FORWARD -p tcp --dport 139 -j DROP
    iptables -A FORWARD -p udp --dport 139 -j DROP
    #
    echo 1 > /proc/sys/net/ipv4/ip_forward
    
    me and a friend made this a while back, i kind of abandoned him while he finished it but he messed up so bad on it i pretty much had to re-do the whole thing, it hasn't been tested so anyone with linux who want's to try go ahead and you can pm me with the flaws so i can fix them.
     
  3. Unread #2 - Jun 27, 2009 at 7:10 PM
  4. deathbal sam
    Joined:
    Sep 25, 2008
    Posts:
    754
    Referrals:
    0
    Sythe Gold:
    0

    deathbal sam Apprentice
    Banned

    linux firewall - not flawless

    Maybe post some more info about it
     
  5. Unread #3 - Jun 27, 2009 at 7:18 PM
  6. mu-b
    Joined:
    Jun 24, 2009
    Posts:
    1,353
    Referrals:
    2
    Sythe Gold:
    0

    mu-b War is a Drug
    Banned

    linux firewall - not flawless

    If you have Linux, you know how to use this. If you don't have Linux, your not going to use this anyways. Linux user's will know where it goes. If it's imperative i post more information about it, I will, but I don't see any reason to for Xp and Vista user's.
     
  7. Unread #4 - Jun 28, 2009 at 12:22 AM
  8. Repentless
    Joined:
    May 11, 2006
    Posts:
    669
    Referrals:
    3
    Sythe Gold:
    0

    Repentless Apprentice
    Banned

    linux firewall - not flawless

    Some of us Linux users aren't that advanced. He means "what exactly does this do before I go and stick it in my config file?"
     
< Selling Onyx Ring [Please] | power-plan >

Users viewing this thread
1 guest


 
 
Adblock breaks this site