Re: iptables LOG options

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Binish A R wrote:
Hello,

I am trying to write my custom firewall rules.
I want to drop all outgoing ssh for non root users and log any such attempts at the same time.
I want to log the username trying to do that. What option should I give?


The following won't definitely work.

iptables -I OUTPUT -p tcp --dport 22 -m owner ! --uid-owner root -j LOG --log-prefix "$USER NO SSH ALLOWED"

because the shell expands $USER variable immediately.

Is there any other option to find the value of owner that get matched by the below rule:


iptables -I OUTPUT -p tcp --dport 22 -m owner ! --uid-owner root


Any help is much appreciated.


Thanks and Regards,

Binish




Make it `--uid-owner ! root' instead of `! --uid-owner root'

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


[Index of Archives]     [Linux Netfilter Development]     [Linux Kernel Networking Development]     [Netem]     [Berkeley Packet Filter]     [Linux Kernel Development]     [Advanced Routing & Traffice Control]     [Bugtraq]

  Powered by Linux