Skip to contentSkip to conversation

LKM with hook that catches iptables hits

DISCUSSION Alexandru Gheorghe 2 participants 2 messages Jun 25, 2014

lore
Share & tools
lore
#0 lore raw

Hi guys. I am trying to think of an LKM which could have a general hook in the sense that whatever iptables defines from user space this hook will catch when a rule is hit (every rule) and will log it (KERN_INFO).

I do not want to define an NFLOG for each rule (that will be tedious, especially in a machine dedicated as a firewall for example). Is this even possible?

The general purpose is to have a method of tracking all packets in order to see what chains/rules are hit.

This will make possible to observe the routes some packets travel when they travel the firewall's layout. The kernel is a 2.6.32.x one.

Thank you for any feedback or input, gratefully appreciated.

Signature · 3 lines
; Alexandru Gheorghe
; alghe.global {at} gmail {dot} com
; OpenPGP key ID 0xCAF985D2
#1 lore raw
Quoted 3 lines · Alexandru Gheorghe

Hi guys. I am trying to think of an LKM which could have a general hook in the sense that whatever iptables defines from user space this hook will catch when a rule is hit (every rule) and will log it (KERN_INFO).

That sounds like the rule tracing feature (see the TRACE target).