Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Binish A R <binishar@poornam.com>
To: Robert Vangel <vangelr@rfgt.net>
Cc: netfilter@lists.netfilter.org
Subject: Re: iptables LOG options
Date: Tue, 24 May 2005 09:47:03 +0530	[thread overview]
Message-ID: <4292AABF.4060009@poornam.com> (raw)
In-Reply-To: <4292A6CF.4020904@rfgt.net>

Robert Vangel wrote:

> 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'

iptables -I OUTPUT -p tcp --dport 22  -m owner ! --uid-owner root -j REJECT
is working fine, ie its blocking ssh from non-root users.
What I want is to log the username (uid) trying to do ssh.
Any comments?




  reply	other threads:[~2005-05-24  4:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-24  3:38 iptables LOG options Binish A R
2005-05-24  4:00 ` Robert Vangel
2005-05-24  4:17   ` Binish A R [this message]
2005-05-24  5:01     ` Robert Vangel
2005-05-24  5:16       ` Binish A R
2005-05-24  5:30         ` Robert Vangel
2005-05-24  5:39           ` Binish A R
2005-05-24 14:43       ` Taylor, Grant
2005-05-25  6:55         ` R. DuFresne

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4292AABF.4060009@poornam.com \
    --to=binishar@poornam.com \
    --cc=netfilter@lists.netfilter.org \
    --cc=vangelr@rfgt.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox