From owner-freebsd-questions@FreeBSD.ORG Mon Dec 21 11:10:29 2009 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 DD41910656A6 for ; Mon, 21 Dec 2009 11:10:29 +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 3E1B78FC15 for ; Mon, 21 Dec 2009 11:10:29 +0000 (UTC) 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 nBLBAKwc062607; Mon, 21 Dec 2009 11:10:21 GMT (envelope-from m.seaman@infracaninophile.co.uk) X-DKIM: Sendmail DKIM Filter v2.8.3 smtp.infracaninophile.co.uk nBLBAKwc062607 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=infracaninophile.co.uk; s=200708; t=1261393821; bh=I9Rab0ikJcp1dBEdFd9IzrDvSK3EoKLy6GEluW+tmu8=; 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=Message-ID:=20<4B2F5795.5010206@infracaninophile.co.uk>|Date:=20M on,=2021=20Dec=202009=2011:10:13=20+0000|From:=20Matthew=20Seaman= 20|Organization:=20Infracaninophi le|User-Agent:=20Thunderbird=202.0.0.23=20(X11/20091129)|MIME-Vers ion:=201.0|To:=20DAve=20|CC:=20'User=20 Questions'=20|Subject:=20Re:=20Sour ce=20of=20closed=20port=20RST=20responses|References:=20<4B2E7CEA. 1020502@pixelhammer.com>=20<4B2E8628.6060100@radel.com>=20<4B2EA34 9.3050604@pixelhammer.com>|In-Reply-To:=20<4B2EA349.3050604@pixelh ammer.com>|X-Enigmail-Version:=200.95.6|Content-Type:=20multipart/ signed=3B=20micalg=3Dpgp-sha256=3B=0D=0A=20protocol=3D"application /pgp-signature"=3B=0D=0A=20boundary=3D"------------enig5779AA1B5EE 1DF245192B370"; b=PJTTOAqJg8b+7AaKvJ9pMeA+V7UgPeViXSgqeM5MRVlrQoSHnbv45SGhh94eo6CLj 7FFtxBn7EgEI/mNwh3xi2aKUgnUnUK7q6PWWyoAAXnx9meHY/frnL4TIC9/X/peAKb 8PDZ5eKzwq7qazk5246cBtZhRoi9uNpMHOBYLnBo= X-Authentication-Warning: happy-idiot-talk.infracaninophile.co.uk: Host localhost [IPv6:::1] claimed to be happy-idiot-talk.infracaninophile.co.uk Message-ID: <4B2F5795.5010206@infracaninophile.co.uk> Date: Mon, 21 Dec 2009 11:10:13 +0000 From: Matthew Seaman Organization: Infracaninophile User-Agent: Thunderbird 2.0.0.23 (X11/20091129) MIME-Version: 1.0 To: DAve References: <4B2E7CEA.1020502@pixelhammer.com> <4B2E8628.6060100@radel.com> <4B2EA349.3050604@pixelhammer.com> In-Reply-To: <4B2EA349.3050604@pixelhammer.com> X-Enigmail-Version: 0.95.6 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig5779AA1B5EE1DF245192B370" X-Virus-Scanned: clamav-milter 0.95.3 at happy-idiot-talk.infracaninophile.co.uk X-Virus-Status: Clean X-Spam-Status: No, score=-2.9 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: 'User Questions' Subject: Re: Source of closed port RST responses 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, 21 Dec 2009 11:10:29 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig5779AA1B5EE1DF245192B370 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable DAve wrote: > I will be installing pf this week, I just need to write up my rule sets= > for these servers. I had been working on the webservers first. Is there= > a rule I can use to log connection attempts to closed ports? pf doesn't really know anything about whether there is a listener at a pa= rticular port or not. However, you can log suspicious traffic using a 'capture ev= erything' rule, which should log and then block or drop all traffic that matches it= =2E You then override that with more specific rules to allow the traffic to the servic= es you want to publish on the net. [pf is a 'last matching rule wins' type firewall, = so you write the rules in order from most generic to most specific.] Something like th= is: ext_if=3D"em0" # alter to match your hardware set skip on lo0 set loginterface $ext_if set state-policy if-bound scrub in block log all pass in on $ext_if proto tcp from any to $ext_if port http flags S/SA kee= p state [...] (You'll need more pass rules than that -- especially to allow your host t= o do things like query the DNS, allow SSH in and out, connect to remote web/ft= p sites, etc.) Remember to run pflogd to have the logged packets saved to disk. Be awar= e that the log output in /var/log/pflog is actually in pcap format, so you'll need t= o use tcpdump -r /var/log/pflog to turn it into something human readable. /var/= log/pflog can get recycled fairly rapidly depending on network conditions. Or you = can just run tcpdump -i pflog0 to get a live view of rejected packets. 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 --------------enig5779AA1B5EE1DF245192B370 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.13 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEAREIAAYFAksvV5wACgkQ8Mjk52CukIzv9QCeNPrPUfB/mSnIbPEPWwGAiW7Q Ay4AoIB6e2v58n2+1Rvj8gnHFMPlhSv0 =kjj/ -----END PGP SIGNATURE----- --------------enig5779AA1B5EE1DF245192B370--