All of lore.kernel.org
 help / color / mirror / Atom feed
* Extending LOG target to display pid
@ 2005-07-05 16:05 Nick Hay
  2005-07-05 17:28 ` Tobias DiPasquale
  2005-07-05 18:05 ` Juha Heljoranta
  0 siblings, 2 replies; 5+ messages in thread
From: Nick Hay @ 2005-07-05 16:05 UTC (permalink / raw)
  To: netfilter-devel

What I hoped to be an easy hack quickly ran into problems.  I planned to 
add an extra printk() in dump_packet() to output the pid, and perhaps 
the program executable number.  Since the owner module had access to the 
pid, I assumed there would be some way to get this information to the 
LOG module.  After a frustrating search through source code and 
documentation, I have the following questions:

1. For the owner module, where/how is the struct ipt_owner_info filled 
in for each packet?  In general, how is the ipt_entry_match/target data 
field filled in?

2. Any ideas on how I can get the pid of a local packet's creator in the 
log module?  I couldn't find any structures connected to the sk_buff 
that might contain it, and couldn't think of where the data would 
originally come from.

Actually... would current->pid work?

I'm still curious about question 1, though!

-- Nick Hay

^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: Extending LOG target to display pid
@ 2005-07-05 23:56 Nick Hay
  2005-07-07  6:32 ` Jonas Berlin
  0 siblings, 1 reply; 5+ messages in thread
From: Nick Hay @ 2005-07-05 23:56 UTC (permalink / raw)
  To: netfilter-devel

Tobias DiPasquale wrote:
> On 7/5/05, Nick Hay <nickjhay@hotmail.com> wrote:
> 
>>2. Any ideas on how I can get the pid of a local packet's creator in the
>>log module?  I couldn't find any structures connected to the sk_buff
>>that might contain it, and couldn't think of where the data would
>>originally come from.
> 
> 
> A security framework, with the proper auditing and accounting
> mechanisms in place in the network stack could make this possible (any
> it may already be). But in general, it would be quite a lot of work to
> add the necessary code to the stack to account for the
> sending/receiving PID at the correct stage. Unless you're doing MAC,
> its probably not worth it.

My original intention was to replicate some part of Windows' ZoneAlarm
package: the ability to recognise which program was asking for access,
and to filter based on that.  Noticing a strange packet that was blocked
by my filter on outgoing ports, and not being able to find out where it
came from was the immediate motivation :)

Is it better to try this at the SELinux level,
blocking/monitoring/adjusting access to socket creation/use?

>>Actually... would current->pid work?
> 
> No, because there's no guarantee that the same process is on the CPU
> by the time the packet hits your rule.
>
> Can't check on #1 right now, but I believe that its filled in by the
> module itself in whatever way it chooses.

-- Nick

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-07-07  6:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-05 16:05 Extending LOG target to display pid Nick Hay
2005-07-05 17:28 ` Tobias DiPasquale
2005-07-05 18:05 ` Juha Heljoranta
  -- strict thread matches above, loose matches on Subject: below --
2005-07-05 23:56 Nick Hay
2005-07-07  6:32 ` Jonas Berlin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.