From owner-freebsd-questions@FreeBSD.ORG Mon Dec 22 16:31:27 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0CD671065670 for ; Mon, 22 Dec 2008 16:31:27 +0000 (UTC) (envelope-from m.seaman@infracaninophile.co.uk) Received: from smtp.infracaninophile.co.uk (gate6.infracaninophile.co.uk [IPv6:2001:8b0:151:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id 52B298FC13 for ; Mon, 22 Dec 2008 16:31:26 +0000 (UTC) (envelope-from m.seaman@infracaninophile.co.uk) Received: from happy-idiot-talk.infracaninophile.co.uk (localhost [IPv6:::1]) (authenticated bits=0) by smtp.infracaninophile.co.uk (8.14.3/8.14.3) with ESMTP id mBMGVFZY043886; Mon, 22 Dec 2008 16:31:16 GMT (envelope-from m.seaman@infracaninophile.co.uk) X-DKIM: Sendmail DKIM Filter v2.7.2 smtp.infracaninophile.co.uk mBMGVFZY043886 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=infracaninophile.co.uk; s=200708; t=1229963476; bh=KthPMXd4Lj8Deh PHNSLqDMUtXBlokqgNbgvcmkpqKdA=; h=Message-ID:Date:From:MIME-Version: To:CC:Subject:References:In-Reply-To:Content-Type:Cc:Content-Type: Date:From:In-Reply-To:Message-ID:Mime-Version:References:To; z=Mes sage-ID:=20<494FC0CD.7010903@infracaninophile.co.uk>|Date:=20Mon,=2 022=20Dec=202008=2016:31:09=20+0000|From:=20Matthew=20Seaman=20|Organization:=20Infracaninophile|User -Agent:=20Thunderbird=202.0.0.18=20(X11/20081125)|MIME-Version:=201 .0|To:=20beni@brinckman.info|CC:=20freebsd-questions@freebsd.org|Su bject:=20Re:=20kernel=20options=20for=20ipv6=20firewall|References: =20<200812221615.36177.beni@brinckman.info>|In-Reply-To:=20<2008122 21615.36177.beni@brinckman.info>|X-Enigmail-Version:=200.95.6|Conte nt-Type:=20multipart/signed=3B=20micalg=3Dpgp-sha256=3B=0D=0A=20pro tocol=3D"application/pgp-signature"=3B=0D=0A=20boundary=3D"-------- ----enigD596B9897422CC360A432ECF"; b=D6d8bXkNP9Lz8R8NDN1opOW1xfF/3r 1Hkb3ZA4uP1Ieu6OXV+p7p/DHwWFNL099qNGGsjJpdlrKFFUdsZKWKwCDnQpe+WgNrH Jl+YXjKhXYor+nxO4JqnHBrve2X/PxGB3Mtiz+MZ9VUOpyExXjCeHIoWHXU0Rql6uw1 r6IvnAU= Message-ID: <494FC0CD.7010903@infracaninophile.co.uk> Date: Mon, 22 Dec 2008 16:31:09 +0000 From: Matthew Seaman Organization: Infracaninophile User-Agent: Thunderbird 2.0.0.18 (X11/20081125) MIME-Version: 1.0 To: beni@brinckman.info References: <200812221615.36177.beni@brinckman.info> In-Reply-To: <200812221615.36177.beni@brinckman.info> X-Enigmail-Version: 0.95.6 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigD596B9897422CC360A432ECF" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (smtp.infracaninophile.co.uk [IPv6:::1]); Mon, 22 Dec 2008 16:31:16 +0000 (GMT) X-Virus-Scanned: ClamAV 0.94.2/8792/Mon Dec 22 13:21:12 2008 on happy-idiot-talk.infracaninophile.co.uk X-Virus-Status: Clean X-Spam-Status: No, score=-3.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VERIFIED,NO_RELAYS autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on happy-idiot-talk.infracaninophile.co.uk Cc: freebsd-questions@freebsd.org Subject: Re: kernel options for ipv6 firewall X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Dec 2008 16:31:27 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigD596B9897422CC360A432ECF Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable beni wrote: > and I tried this also (from http://www.kame.net/~suz/freebsd-ipv6-confi= g- > guide.txt) : >=20 > options IPV6FIREWALL > #options IPV6FIREWALL_VERBOSE > #options IPV6FIREWALL_VERBOSE_LIMIT=3D100 > #options IPV6FIREWALL_DEFAULT_TO_ACCEPT > But all I get is an "unknown option" error when I do a make buildkernel= =2E That information is out of date. ipfw now handles both IPv4 and IPv6 wit= hout any extra kernel configuration required. All you need to do is write rul= es that reference IPv6 addresses etc. > I've added also this to my /etc/rc.conf : > #IPv6 > gateway6_enable=3D"YES" > ipv6_enable=3D"YES" > #ipv6_gateway_enable=3D"YES" > #ipv6_router_enable=3D"YES" > ipv6_network_interfaces=3D"vr0 tun0" >=20 > # Enable ip6fw. > ipv6_firewall_enable=3D"YES" > ipv6_firewall_type=3D"client" > # ipv6_firewall_quiet=3D"NO" > ipv6_firewall_quiet=3D"YES" # suppress rule display. (By default, it's= NO) > ipv6_firewall_logging=3D"YES" # enable events logging. (By default, it'= s NO) > ipv6_firewall_flags=3D"" # Flags passed to ip6fw when type is a "filen= ame" Take a look at /etc/rc.firewall6 -- that just does for IPv6 what rc.firew= all does for IPv4. Your settings above should enable it to work, but you'll = need to put the correct network numbers, prefix len and IP address into the rc.firewall6 file. (Not a particularly nice piece of design: configurati= on information like that shouldn't require you to edit the actual rc script.= ) > pf is enabled for ipv4. pf will also do IPv6 automatically. With pf's really very handy indeed feature of being able to deduce from the interface name the IP numbers / networks to put in the rulesets, you can write rules that operate on IPv4= only: pass in on $ext_if inet proto tcp \ from any to $ext_if port ssh \ flags S/SA keep state \ (max-src-conn-rate 3/30, overload flush global) IPv6 only: pass in on $ext_if inet6 proto tcp \ from any to $ext_if port ssh \ flags S/SA keep state \ (max-src-conn-rate 3/30, overload flush global) or both: pass in on $ext_if proto tcp \ from any to $ext_if port ssh \ flags S/SA keep state \ (max-src-conn-rate 3/30, overload flush global) Although this last is internally transformed into two rules, one for the IPv4 address on the i/f, and the other for the IPv6 address. See 'pfctl = -sr' for the generated rules. So on my machine, that becomes: pass in on de0 inet6 proto tcp from any to fe80::240:5ff:fea5:8db7 port =3D= ssh flags S/SA keep state (source-track rule, max-src-conn-rate 3/30, ov= erload flush global, src.track 30) pass in on de0 inet proto tcp from any to 81.187.76.162 port =3D ssh flag= s S/SA keep state (source-track rule, max-src-conn-rate 3/30, overload flush global, src.track 30) (not that I've yet seen any ssh bruteforce attempts over IPv6) If you need bandwidth limiting facilities, you can do this with pf as wel= l, but you will have to compile a custom kernel to enable the ALTQ features.= It's equivalent to IPFW's dummynet but there are subtle differences in th= e way it operates that may or may not be a show stopper for you. > So what option(s) do I need to use a ipv6 firewall in my kernel ?=20 Same as you need for either pf or ipfw with IPv4 -- in fact, you frequent= ly don't need to modify the GENERIC kernel at all. You can just load ipfw a= s a kld. Same with pf, unless you need to use altq which still requires some= compiled-in stuff in the kernel. Cheers, Matthew --=20 Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard Flat 3 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate Kent, CT11 9PW --------------enigD596B9897422CC360A432ECF Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEAREIAAYFAklPwNMACgkQ8Mjk52CukIyjzQCgjdvshqjICAbTlTgjdBZXsoxK ZrMAn2CLM4edic1gTqIsG1Vv/ZE4DB2L =2CM9 -----END PGP SIGNATURE----- --------------enigD596B9897422CC360A432ECF--