From owner-freebsd-questions@FreeBSD.ORG Thu Sep 28 18:56:24 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EC7FA16A40F for ; Thu, 28 Sep 2006 18:56:23 +0000 (UTC) (envelope-from danielby@slightlystrange.org) Received: from catflap.slightlystrange.org (cpc3-cmbg1-0-0-cust506.cmbg.cable.ntl.com [82.21.101.251]) by mx1.FreeBSD.org (Postfix) with ESMTP id D8B5743D64 for ; Thu, 28 Sep 2006 18:56:22 +0000 (GMT) (envelope-from danielby@slightlystrange.org) Received: from danielby by catflap.slightlystrange.org with local (Exim 4.63 #0) id 1GT13V-000AF3-Ps by authid for ; Thu, 28 Sep 2006 19:56:21 +0100 Date: Thu, 28 Sep 2006 19:56:21 +0100 From: Daniel Bye To: freebsd-questions@freebsd.org Message-ID: <20060928185621.GA43858@catflap.slightlystrange.org> Mail-Followup-To: freebsd-questions@freebsd.org References: <451BF6D3.7000901@chamonix.reportlab.co.uk> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="r5Pyd7+fXNt84Ff3" Content-Disposition: inline In-Reply-To: <451BF6D3.7000901@chamonix.reportlab.co.uk> User-Agent: Mutt/1.4.2.2i X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: danielby@slightlystrange.org X-SA-Exim-Scanned: No (on catflap.slightlystrange.org); SAEximRunCond expanded to false Subject: Re: denyhosts problems X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Daniel Bye List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Sep 2006 18:56:24 -0000 --r5Pyd7+fXNt84Ff3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Sep 28, 2006 at 05:22:43PM +0100, Robin Becker wrote: > I'm trying to get denyhosts-2.5 to work in 6.0 and have inserted a line i= n=20 > hosts.allow >=20 >=20 > ALL: xxx.myoffice.com : allow > sshd: /etc/hosts.deniedssh : deny > ALL: ALL : allow >=20 > but am finding that this causes my home ip to be denied even though I log= =20 > in with a pre-shared key. sshd will still avail itself of libwrap's functionality /before/ the client even has a chance to offer its key. Anyone who manages to get a copy of your key will need also to satisfy your /etc/hosts.allow rules before they can use it. > The /etc/hosts.deniedssh file is being created, but my home ip is not=20 > present (it would be hard as I have a dynamically allocated one anyhow). >=20 > The hosts.deniedssh file contains entries like >=20 > ....... > ALL: 61.219.xx.250 : deny > ALL: 209.8.xx.242 : deny > ....... This is wrong - when using an auxiliary file like this, that file should contain only the IP address of offending hosts. If you think about how hosts.allow rules are structured, this will make sense. > I am getting an error in the auth log related to the denial that looks li= ke=20 > this > /etc/hosts.allow, line 24: can't verify hostname:=20 > getaddrinfo(xxx-yyy-......, AF_INET) >=20 > where /etc/hosts.allow line24 corresponds to the >=20 > sshd: /etc/hosts.deniedssh : deny >=20 > line in hosts.allow. Indeed. It is precisely that rule that is uncovering the problems with your current configuration. Look at the structure of the rules. First, you have the service name, a colon, an address specification, another colon, and an action. (this is actually a bit of an over simplification, but you can get the full story if you look at hosts_access(5)) If the address specification actually contains the path to a file, the contents of that file are interpolated into the body of the rule. So, in your case, what libwrap constructs will look something like ALL : ALL : 61.219.xx.250 : deny : deny which, clearly, is nonsense! Make sure that denyhosts.cfg has a blank value for BLOCK_SERVICE and that it points HOSTS_DENY to the right file. I guess that at least is correct, though. DenyHosts will then correctly record only the IP address of blocked hosts, which will result in much saner rule expansions! > I have the same setup in 6.1 and it seems to work. But I still see messag= es=20 > related to line 24 from that setup. Does denyhosts work properly? I suspect it is not quite the same - check the BLOCK_SERVICE setting on that machine. Check out the DenyHosts FAQ - it's very useful. http://denyhosts.sourceforge.net/faq.html And the FreeBSD hosts_options(5) man page as well, which, as I said earlier, contains the full story on setting up your /etc/hosts.allow. HTH Dan --=20 Daniel Bye PGP Key: http://www.slightlystrange.org/pgpkey-dan.asc PGP Key fingerprint: D349 B109 0EB8 2554 4D75 B79A 8B17 F97C 1622 166A _ ASCII ribbon campaign ( ) - against HTML, vCards and X - proprietary attachments in e-mail / \ --r5Pyd7+fXNt84Ff3 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (FreeBSD) iD8DBQFFHBrVixf5fBYiFmoRAptEAJ4qRZ9CsQkLKnHA/PooudNL411B8gCfSWSb 7IjH46p/C/1vnUbeNLn8QYY= =5em0 -----END PGP SIGNATURE----- --r5Pyd7+fXNt84Ff3--