Skip to contentSkip to conversation

iptables analyzer

DISCUSSION Earl A.Killian 4 participants 6 messages Oct 22, 2003 – Nov 27, 2003

lore
Share & tools
lore
#0 lore raw

Has anyone built a iptables analyzer? I am thinking writing one, but I don't want to reinvent what might already exist.

I have in mind something that tries all "interesting" (as gleaned from the rules themselves) combinations of IP addresses, protocols, ports, etc., simulates the ruleset and says what happens. The result would be displayed in table form.

One could test the equivalence of two iptables specifications by analyzing them and comparing the output (useful for seeing if an "optmization" is correct).

#1 lore raw
Quoted 12 lines · --- "Earl A.Killian

Has anyone built a iptables analyzer? I am thinking writing one, but I don't want to reinvent what might already exist.

I have in mind something that tries all "interesting" (as gleaned from the rules themselves) combinations of IP addresses, protocols, ports, etc., simulates the ruleset and says what happens. The result would be displayed in table form.

One could test the equivalence of two iptables specifications by analyzing them and comparing the output (useful for seeing if an "optmization" is correct).

I too am interested in this... and thus set out to find some projects to do this as I am a novice shell scripter and know zilch on programming...

This is what I have found although nothing really gets to the grit like I would like...

Iam
http://intevation.de/iam/

IPAC-NG - IP accounting next generation
http://ipac-ng.sourceforge.net/

IAG - IP-Accounting Grapher
http://dev.lashout.net/iag/

BW ACCT v0.9.4
http://www.bwacct.org/

ADMLogger
http://aaron.marasco.com/linux.html

Firewall Log Daemon - firelogd
http://rouxdoo.freeshell.org/dmn/

Firewall Monitor (fwmon)
http://www.scaramanga.co.uk/fwmon/

fwlogwatch 0.9.3
http://www.kyb.uni-stuttgart.de/boris/software.shtml

PStat
http://members.fortunecity.com/mrsi/

iptacct - Accounting for Linux 2.4
http://tretmine.org/iptacct/

SASacct
http://rousse.pm.org/sasacct/

Simple Little Firewall Monitor
http://slfm.sourceforge.net/

tvc4
http://fsi-server.physik.uni-erlangen.de/~sndapara/shaping/index_en.shtml

While i have not tried any of these projects... I don't think they are what I am looking for. I don't really need graphics or things displayed in MySQL databases.. I would simple like to be able to saya... hey how many packets have I gottin in the last 5 or so mins...and see the difference from the 5 mins before. Graphing this daily weekly monthy..etc would be nice...but hey I'm willing to settle.

Good luck in your hunt. Hope this helps.

=====
In the absence of order there will be chaos.

__________________________________
Do you Yahoo!?
Exclusive Video Premiere - Britney Spears
http://launch.yahoo.com/promos/britneyspears/

#2 lore raw

Actually I'm planning something static, independent of the traffic received by the host.

Basically, it would take iptables-save output and make a list of all the
* protocols used (the -p's)
* the src addresses used (the -s's)
* the dst addresses used (the -d's)
* the src ports used (the --sport's)
* the dst ports used (the --dport's)
* the input interfaces used (the -i's)
* the output interfaces used (the -o's)
* the --icmp-types used
then augment each of the above lists with an "other" entry, and then and then simulate every combination of the above and
* the 4 conntrack states
* the possible ip flags (-f)
* the possible tcp flags
against the rules, and print a table of the final target (ACCEPT or DROP).

The output would be big, but some intelligent pruning (use of '*' to merge multiple rows when possible) should make it more manageable.

One use is to simply have paranoid humans review the output. Another use is to run it on two different iptable rule sets and compare what's different (e.g. if you reorder rules for efficiency, this would check that you haven't inadvertently changed the firewall semantics).

#3 lore raw

Heh what about people who run iptables from a script... like me?

Quoted 20 lines · --- "Earl A.Killian

Actually I'm planning something static, independent of the traffic received by the host.

Basically, it would take iptables-save output and make a list of all the
* protocols used (the -p's)
* the src addresses used (the -s's)
* the dst addresses used (the -d's)
* the src ports used (the --sport's)
* the dst ports used (the --dport's)
* the input interfaces used (the -i's)
* the output interfaces used (the -o's)
* the --icmp-types used
then augment each of the above lists with an "other" entry, and then and then simulate every combination of the above and
* the 4 conntrack states
* the possible ip flags (-f)
* the possible tcp flags
against the rules, and print a table of the final target (ACCEPT or DROP).

Quoted 8 lines

The output would be big, but some intelligent pruning (use of '*' to merge multiple rows when possible) should make it more manageable.

One use is to simply have paranoid humans review the output. Another use is to run it on two different iptable rule sets and compare what's different (e.g. if you reorder rules for efficiency, this would check that you haven't inadvertently changed the firewall semantics).

=====
In the absence of order there will be chaos.

__________________________________
Do you Yahoo!?
Exclusive Video Premiere - Britney Spears
http://launch.yahoo.com/promos/britneyspears/

#4 lore raw
Signature · 5 lines
-- 
   .~.     Vincent Haverlant  -- Galadril -- #ICQ: 35695155   
   /V\      http://www.haverlant.org/
  /( )\      Parinux (http://www.parinux.org/)
  ^^-^^       MUD -- FranDUMII (http://perso.enst.fr/~frandum/)
#5 lore raw
In reply to SBlaze
Quoted 39 lines · SBlaze

Iam
http://intevation.de/iam/

IPAC-NG - IP accounting next generation
http://ipac-ng.sourceforge.net/

IAG - IP-Accounting Grapher
http://dev.lashout.net/iag/

BW ACCT v0.9.4
http://www.bwacct.org/

ADMLogger
http://aaron.marasco.com/linux.html

Firewall Log Daemon - firelogd
http://rouxdoo.freeshell.org/dmn/

Firewall Monitor (fwmon)
http://www.scaramanga.co.uk/fwmon/

fwlogwatch 0.9.3
http://www.kyb.uni-stuttgart.de/boris/software.shtml

PStat
http://members.fortunecity.com/mrsi/

iptacct - Accounting for Linux 2.4
http://tretmine.org/iptacct/

SASacct
http://rousse.pm.org/sasacct/

Simple Little Firewall Monitor
http://slfm.sourceforge.net/

tvc4
http://fsi-server.physik.uni-erlangen.de/~sndapara/shaping/index_en.shtml

Quoted 6 lines

While i have not tried any of these projects... I don't think they are what I am looking for. I don't really need graphics or things displayed in MySQL databases.. I would simple like to be able to saya... hey how many packets have I gottin in the last 5 or so mins...and see the difference from the 5 mins before. Graphing this daily weekly monthy..etc would be nice...but hey I'm willing to settle.

Maybe it's because you didn't try wflogs yet. ;-)

I think the command you're looking for may be something like this:

# wflogs --strict-parsing=nowarning --sort=none --filter '$start_time >= [5
  minutes ago]' -o text --summary=no --header=no --resolve=0
  --sresolve=no --whois=0

Please don't get fooled by the command line length... wflogs is just a quite powerful tool...

http://www.wallfire.org/wflogs/

Herve

Signature · 4 lines
 _
(°=  Hervé Eychenne
//)
v_/_ WallFire project:  http://www.wallfire.org/