Skip to contentSkip to conversation

Is libiptc still the preferred library for manipulating tables?

DISCUSSION Warren Kenny 3 participants 3 messages Feb 25, 2007 – Mar 2, 2007 netfilter

lore
Share & tools
lore
#0 lore raw

This subject seems a bit hazy to me at the moment. Basically I'm writing a network intrusion detection and prevention system for Linux and I'd like to be able to use Netfilter to block packets coming from nodes which have been identified as malicious. I'd prefer to avoid the use of libnetfilter_queue since I'm already using libpcap for packet analysis and it has some extras that I rely on. Basically I want to add new tables and rules from within my application in order to filter out malicious traffic.

There seem to be a lot of different guides on how to do this, most of which are obsolete, including the guide on libiptc. I need to know the latest and best way to manipulate iptables rules.

Thanks,
WK

#1 lore raw
Quoted 9 lines · Warren Kenny

This subject seems a bit hazy to me at the moment. Basically I'm writing a network intrusion detection and prevention system for Linux and I'd like to be able to use Netfilter to block packets coming from nodes which have been identified as malicious. I'd prefer to avoid the use of libnetfilter_queue since I'm already using libpcap for packet analysis and it has some extras that I rely on. Basically I want to add new tables and rules from within my application in order to filter out malicious traffic.

Quoted 3 lines

There seem to be a lot of different guides on how to do this, most of which are obsolete, including the guide on libiptc. I need to know the latest and best way to manipulate iptables rules.

Unfortunately, libiptc is not a supported as a standalone library, it is just a directory inside iptables. The only interface available, at the moment, is iptables, the command line tool. You can blame us for not providing an appropiate library interface yet.

Signature · 1 line
The dawn of the fourth age of Linux firewalling is coming; a time of great struggle and heroic deeds -- J.Kadlecsik got inspired by J.Morris
#2 lore raw

mån 2007-02-26 klockan 13:23 +0100 skrev Pablo Neira Ayuso:

Quoted 4 lines

Unfortunately, libiptc is not a supported as a standalone library, it is just a directory inside iptables. The only interface available, at the moment, is iptables, the command line tool. You can blame us for not providing an appropiate library interface yet.

This said, "iptables-restore -n" is a quite effective and potent batch interface for rule updates.

And if it (or actually the underlying iptables code it's using) had an option for dumping rules in iptables-save format then it could be as potent for read access as well.. Today iptables-restore can only read rules to the same level of detail as iptables -L -v.

Regards
Henrik