From owner-freebsd-current@FreeBSD.ORG Tue Jul 4 12:12:41 2006 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2EDBE16A4DA for ; Tue, 4 Jul 2006 12:12:41 +0000 (UTC) (envelope-from b.candler@pobox.com) Received: from rune.pobox.com (rune.pobox.com [208.210.124.79]) by mx1.FreeBSD.org (Postfix) with ESMTP id CA04743D6D for ; Tue, 4 Jul 2006 12:12:36 +0000 (GMT) (envelope-from b.candler@pobox.com) Received: from rune (localhost [127.0.0.1]) by rune.pobox.com (Postfix) with ESMTP id ECF5F79795; Tue, 4 Jul 2006 08:12:57 -0400 (EDT) Received: from mappit.local.linnet.org (212-74-113-67.static.dsl.as9105.com [212.74.113.67]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by rune.sasl.smtp.pobox.com (Postfix) with ESMTP id 388C31B52A; Tue, 4 Jul 2006 08:12:52 -0400 (EDT) Received: from lists by mappit.local.linnet.org with local (Exim 4.61 (FreeBSD)) (envelope-from ) id 1FxjlU-0006IJ-So; Tue, 04 Jul 2006 13:12:28 +0100 Date: Tue, 4 Jul 2006 13:12:28 +0100 From: Brian Candler To: Brooks Davis Message-ID: <20060704121228.GA24152@uk.tiscali.com> References: <4498D108.90907@rogers.com> <20060621053007.GA3320@odin.ac.hmc.edu> <20060630213259.GA20670@odin.ac.hmc.edu> <953595BB-0939-4CCB-85B7-65F99F02275E@lassitu.de> <20060703215504.GC22556@odin.ac.hmc.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060703215504.GC22556@odin.ac.hmc.edu> User-Agent: Mutt/1.4.2.1i Cc: Mike Jakubik , freebsd-current@freebsd.org, Garance A Drosihn , Stefan Bethke , Justin Hibbits Subject: Re: ~/.hosts patch X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jul 2006 12:12:41 -0000 On Mon, Jul 03, 2006 at 02:55:04PM -0700, Brooks Davis wrote: > The problem is that the client application using a port forwarded to > localhost:port via ssh must connect to that port via the host name of > the remote server or it will crash the remote server because it also > passes localhost or 127.0.0.1 to the remote server over the TCP session > and the server misbehaves in that case. Yes it's a bug in both the > remote server and the client/server protocol, but that's really beside > the point. Crappy software exists and sometimes we have to deal with > it. > > The simple fact is that I needed a hack like this and there wasn't > another solution (with possible exception of a SOCKS proxy, which wasn't > an option at the time) a ~/.hosts file would have been a nice way to > implement part of it rather than actually adding the entry to /etc/hosts. Well, assuming your client calls gethostbyname() then you could write a tiny library which always returns 127.0.0.1, and use LD_PRELOAD to load it beforehand. Another solution (which doesn't require coding) would be to run the application inside a jail, and either frig /etc/hosts there, or point resolv.conf to a nameserver inside the jail, which has a '*' A record mapping everything to 127.0.0.1 Regards, Brian.