Iptables No Http

In this sample iptables_no_http_programs.cfg, we log and drop prohibited http traffic.

///////////////////////////////////////////////////////////////////////////////
//
// iptables_no_http_programs.cfg
//
///////////////////////////////////////////////////////////////////////////////

        // NO_HTTP -- log and drop blocked http traffic

        =iptables -N NO_HTTP
        =iptables -A NO_HTTP -j LOG --log-prefix "IPT NO_HTTP: " =logopt
        =iptables -A NO_HTTP -j DROP

///////////////////////////////////////////////////////////////////////////////

The =logopt macro

--log-level=3 -m limit --limit 3/minute --limit-burst 3

(defined in the file firewall_macros.cfg) limits how fast we can log such traffic.

This iptables_no_http_programs.cfg file is #included by the higher-level iptables_programs.cfg file.  In that file, we might have code invoking the NO_HTTP chain as follows:

        for ip in =userips; do
                =iptables -A IN_NETWORK -p tcp --syn -d $ip
                  --dport  80 -j NO_HTTP
                =iptables -A IN_NETWORK -p tcp --syn -d $ip
                  --dport 443 -j NO_HTTP
        done
        [...]

        for ip in =userips; do
                =iptables -A OUT_NETWORK -s $ip -m state --state NEW -p tcp
                  --dport  80 -j NO_HTTP
                =iptables -A OUT_NETWORK -s $ip -m state --state NEW -p tcp
                  --dport 443 -j NO_HTTP
        done

=userips is a PIKT macro defined in the file firewall_macros.cfg for example as

userips
                192.168.3.250   // Dell PC
                192.168.3.251   // HP PC

Open Hand For more examples, see Samples.

 
Home | FAQ | News | Intro | Samples | Tutorial | Reference | Software
Developer's Notes | Licensing | Authors | Pikt-Users | Pikt-Workers | Related Projects | Site Index | Privacy Policy | Contact Us
Page best viewed at 1024x768 or greater.   Page last updated 2008-09-06.   This site is PIKT® powered.
PIKT® is a registered trademark of the University of Chicago.   Copyright © 1998-2008 Robert Osterlund. All rights reserved.
Home FAQ News Intro Samples Tutorial Reference Software
PIKT Logo
PIKT Page Title
View sample
firewall
macros