From owner-freebsd-pf@FreeBSD.ORG Wed Oct 24 08:49:30 2007 Return-Path: Delivered-To: freebsd-pf@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1CB1816A418 for ; Wed, 24 Oct 2007 08:49:30 +0000 (UTC) (envelope-from max@love2party.net) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.171]) by mx1.freebsd.org (Postfix) with ESMTP id CB50B13C4B2 for ; Wed, 24 Oct 2007 08:49:29 +0000 (UTC) (envelope-from max@love2party.net) Received: from amd64.laiers.local (dslb-088-066-000-181.pools.arcor-ip.net [88.66.0.181]) by mrelayeu.kundenserver.de (node=mrelayeu1) with ESMTP (Nemesis) id 0MKwpI-1IkbvM0gDF-0007Wf; Wed, 24 Oct 2007 10:49:13 +0200 From: Max Laier Organization: FreeBSD To: freebsd-pf@freebsd.org Date: Wed, 24 Oct 2007 10:49:01 +0200 User-Agent: KMail/1.9.7 References: <1fc8a2a60710232250i5954c8c3tc501ed4ec71dac80@mail.gmail.com> <20071024065938.GA20387@insomnia.benzedrine.cx> <1fc8a2a60710240051l4a5744bawacf48c47276ccba4@mail.gmail.com> In-Reply-To: <1fc8a2a60710240051l4a5744bawacf48c47276ccba4@mail.gmail.com> X-Face: ,,8R(x[kmU]tKN@>gtH1yQE4aslGdu+2]; R]*pL,U>^H?)gW@49@wdJ`H<=?utf-8?q?=25=7D*=5FBD=0A=09U=5For=3D=5CmOZf764=26nYj=3DJYbR1PW0ud?=>|!~,,CPC.1-D$FG@0h3#'5"k{V]a~.<=?utf-8?q?mZ=7D44=23Se=7Em=0A=09Fe=7E=5C=5DX5B=5D=5Fxj?=(ykz9QKMw_l0C2AQ]}Ym8)fU MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1643430.QFMSolvSL8"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <200710241049.10530.max@love2party.net> X-Provags-ID: V01U2FsdGVkX1/hFVP0h1piCgkTCvuy5sxokuRpQWqwHANuBpx 9pg81sdp2pGvKnUO5+zvnHLcvMzioeprlG1wO0V8uKKISd4qvd VKuyc9DdHQ56tsJYN2MCpoLscOYy66PYsUxyZC7umc= Cc: Subject: Re: disabling implicit creation of state for NAT, BINAT and RDR X-BeenThere: freebsd-pf@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Technical discussion and general questions about packet filter \(pf\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Oct 2007 08:49:30 -0000 --nextPart1643430.QFMSolvSL8 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Wednesday 24 October 2007, Nex Mon wrote: > On 10/24/07, Daniel Hartmeier wrote: > > On Wed, Oct 24, 2007 at 01:50:55PM +0800, Nex Mon wrote: > > > hello, is there a way to disable implicit creation of states for > > > NAT, > > > > BINAT > > > > > and RDR rules? the man page of pf.conf says this: > > > > > > Note: nat, binat and rdr rules implicitly create state for > > > connections. > > > > Yes, translations require states. > > > > Imagine you have a connection from > > > > Client Gateway External > > 10.1.2.3 -> 62.65.145.30 -> 69.147.83.33 > > > > i.e. the client 10.1.2.3 sends a TCP SYN to external server > > 69.147.83.33. The NAT gateway replaces the source address with > > 62.65.145.30. > > > > Now the external server sends a TCP SYN+ACK back to 62.65.145.30. > > How would the gateway know that this packet is for 10.1.2.3, and > > needs the destination address translated back to 10.1.2.3, without a > > state entry? > > > > The state entry is the only part that holds this mapping information. > > Are you saying there is only one type of state for all the filter, RDR, > etc rules? I have this understanding that NAT has its own translation > table where it keeps states of NAT sessions. So in the example above, > the only way to apply filter rules for translated (reply)packets would > be at the internal interface? The translations states are different from the filter states. The former=20 just record the addresses on each side to be able to do the translation,=20 the later record the addresses to be able to match traffic to the state=20 and consequently allow or deny it. Unless you use the "pass" modifier on=20 the translation statement, a translation state does not automatically=20 allow the matched traffic to flow. The pf.conf(5) manpage states: If the pass modifier is given, packets matching the translation rule are passed without inspecting the filter rules: rdr pass on $ext_if proto tcp from any to any port 80 -> 127.0.0.1 \ port 8080 Otherwise you will have to have a pass rule for that traffic as well. > I'm curious about OpenBSD's implementation of "no state" which can be > applied to NAT, RDR, etc. Is there any chance this feature will be > supported in FreeBSD? The "no state" modifier is supported in FreeBSD (7.0 and later) for pass=20 rules only. This is the same in OpenBSD. Translation rules allways have=20 to keep state as they can otherwise not do the translation! =2D-=20 /"\ Best regards, | mlaier@freebsd.org \ / Max Laier | ICQ #67774661 X http://pf4freebsd.love2party.net/ | mlaier@EFnet / \ ASCII Ribbon Campaign | Against HTML Mail and News --nextPart1643430.QFMSolvSL8 Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4 (FreeBSD) iD8DBQBHHwcGXyyEoT62BG0RAjkrAJ4ga5vWLy3Ewy+dfxRZ0f7AFokKuACffCc3 AQMtfp482+PbQTzwL384nNs= =ffv9 -----END PGP SIGNATURE----- --nextPart1643430.QFMSolvSL8--