I'm trying to find pid
of a socket using iptables OUTPUT chain log, or even better adding it into the log.
My current iptable rule:
sudo iptables -A OUTPUT -j LOG --log-prefix='[PID]' --log-level 7 --log-uid
I'm a bit frustrated since I know that iptables' owner
module can filter items by pid
(using -m owner --owner-pid
flag) which means that the info is there, but I can't log it.
I know that it impossible to do with INPUT chain since iptables is a kernel process, but for OUTPUT chain it should be possible.
any idea? or even of how to cross some log data in order to get PID of OUTPUT chain connections?