From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org)
	by finch.gentoo.org with esmtp (Exim 4.60)
	(envelope-from <gentoo-user+bounces-132563-garchives=archives.gentoo.org@lists.gentoo.org>)
	id 1RbxEr-0005hY-H0
	for garchives@archives.gentoo.org; Sat, 17 Dec 2011 16:35:58 +0000
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 5365321C0EA;
	Sat, 17 Dec 2011 16:35:47 +0000 (UTC)
Received: from mail-iy0-f181.google.com (mail-iy0-f181.google.com [209.85.210.181])
	by pigeon.gentoo.org (Postfix) with ESMTP id 5472621C0EA
	for <gentoo-user@lists.gentoo.org>; Sat, 17 Dec 2011 16:34:45 +0000 (UTC)
Received: by iakk12 with SMTP id k12so5084725iak.40
        for <gentoo-user@lists.gentoo.org>; Sat, 17 Dec 2011 08:34:44 -0800 (PST)
Received: by 10.50.208.72 with SMTP id mc8mr16246020igc.19.1324139684732;
        Sat, 17 Dec 2011 08:34:44 -0800 (PST)
Received: from [182.4.240.188] ([182.4.240.188])
        by mx.google.com with ESMTPS id b20sm46019978ibj.7.2011.12.17.08.34.39
        (version=SSLv3 cipher=OTHER);
        Sat, 17 Dec 2011 08:34:42 -0800 (PST)
Message-ID: <4EECC48C.2030807@mapits.com>
Date: Sat, 17 Dec 2011 23:34:20 +0700
From: Hari Purnama <hari@mapits.com>
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:8.0) Gecko/20111210 Thunderbird/8.0
Precedence: bulk
List-Post: <mailto:gentoo-user@lists.gentoo.org>
List-Help: <mailto:gentoo-user+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-user+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-user+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-user.gentoo.org>
X-BeenThere: gentoo-user@lists.gentoo.org
Reply-to: gentoo-user@lists.gentoo.org
MIME-Version: 1.0
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] iptables question...
References: <4EEB610D.9050309@libertytrek.org>
In-Reply-To: <4EEB610D.9050309@libertytrek.org>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Archives-Salt: c80419f6-1460-4793-8785-594732b6b09f
X-Archives-Hash: ec826354be4a8576bd34d20e758273d0

On 12/16/11 22:17, Tanstaafl wrote:
> Hi all,
>
> I was reading up on some iptables rules in the gentoo security handbook:
>
> http://www.gentoo.org/doc/en/security/security-handbook.xml?part=1&chap=12&style=printable
>
>
> It mentions DROPing packets with an INVALID state.
>
> It sounded/sounds like a good idea, so I added the following rule:
>
> -A INPUT -i eth0 -m state --state INVALID -j LOG
>
> As suggested, I addd this rule just ABOVE this one:
>
> -A INPUT -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
>
> I also changed the DROP action to LOG so I could see what it did if
> anything.
>
> Right after adding this rule, I started seeing lines like this in the
> log:
>
> Dec 16 10:15:31 myhost kernel: IN=eth0 OUT=
> MAC=00:e0:81:54:9c:8a:00:90:7f:86:a8:c0:08:00 SRC=208.87.137.233
> DST=192.168.1.252 LEN=40 TOS=0x00 PREC=0x00 TTL=52 ID=0 DF PROTO=TCP
> SPT=50113 DPT=25 WINDOW=0 RES=0x00 RST URGP=0
>
> What I don't understand is why it isn't using my LOG prefix that is
> used for everything else:
>
> -A INPUT -j LOG --log-prefix "(>fw-drop): " --log-level 7
>
> Anyone?
>
Did you put the log-prefix rule before or after the LOG rule?
Or why didn't you put it in a 1liner, say:

-A INPUT -i eth0 -m state --state INVALID -j LOG --log-level 7
--log-prefix "(>fw-drop): " --log-ip-options --log-tcp-options


-- 
Regards,