From owner-freebsd-questions Sat Jun 29 4:50:50 2002 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 605F537B401 for ; Sat, 29 Jun 2002 04:50:47 -0700 (PDT) Received: from mail.XtremeDev.com (xtremedev.com [216.241.38.65]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2B83A43E09 for ; Sat, 29 Jun 2002 04:50:31 -0700 (PDT) (envelope-from freebsd@XtremeDev.com) Received: from xtremedev.com (xtremedev.com [216.241.38.65]) by mail.XtremeDev.com (Postfix) with ESMTP id B390070603; Sat, 29 Jun 2002 05:50:23 -0600 (MDT) Date: Sat, 29 Jun 2002 05:50:23 -0600 (MDT) From: FreeBSD user To: Matthew Seaman Cc: questions@FreeBSD.ORG Subject: Re: OpenSSH 3.4p1_1 and reverse ip In-Reply-To: <20020629105843.GA15592@happy-idiot-talk.infracaninophi> Message-ID: <20020629053049.V67284-100000@Amber.XtremeDev.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > So the problem is that really that your DNS isn't responding quickly > enough, rather than sshd doing a few resolver calls. One thing that > does happen with the privilege separation is the chroot'ed sshd > won't be able to read /etc/resolv.conf, so any queries it makes would > go to the default address which happens to be 127.0.0.1 > > Try running these two: > > tcpdump port 53 > tcpdump -i lo0 > > to see if you can trace any DNS traffic generated while you ssh into > the box. I've run a few tests on those lines on machine both with and > without local nameservers, where OpenSSH runs fine. Running tcpdump -n -i lo0 port 53 I get: ~> sudo tcpdump -n -i lo0 port 53 tcpdump: listening on lo0 05:29:04.791666 216.241.38.65.1685 > 216.241.38.65.53: 50078+ PTR? 2.1.168.192.in-addr.arpa. (42) 05:29:09.867171 216.241.38.65.1686 > 216.241.38.65.53: 50078+ PTR? 2.1.168.192.in-addr.arpa. (42) 05:29:19.885317 216.241.38.65.1687 > 216.241.38.65.53: 50078+ PTR? 2.1.168.192.in-addr.arpa. (42) > My guess is that there's something bound to 127.0.0.1:53 on your > machine so that you don't get an immediate ICMP port unreachable, but > that what's bound there isn't returning any meaningful DNS data, and > your sshd ends up waiting for the standard 30s DNS timeout for however > many retries the resolver attempts. There is something bound to my 127.0.0.1: ~> sockstat | grep dns dnscache dnscache 147 3 udp4 192.168.1.1:53 *:* dnscache dnscache 147 4 tcp4 192.168.1.1:53 *:* tinydns tinydns 144 3 udp4 127.0.0.1:53 *:* tinydns tinydns 143 3 udp4 216.241.38.65:53 *:* This is my name server/dnscache machine/split horizon/gateway/sshd machine for my teeny pidly lan to the internet. So I have two copies of tinydns listening, one on my public ip which has no knowledge of the rfc1917 internal lan being natted, and one listening on 127.0.0.1 which does. Which I can see the above tcpdump query failing, since it's asking my public ip tinydns to resolve the 192.168.1.2 (internal workstation) address, which it can't. So how do I tell sshd to ask dnscache instead? Or atleast ask 127.0.0.1. (Strange that it doesn't?) > however, it's worth trying giving the chroot'ed sshd a copy of your > resolv.conf to see if that makes a difference: > > cd ~sshd > mkdir etc > cp /etc/resolv.conf etc/ Tried that. I copied resolv.conf to /home/sshd/, ran vipw and set: sshd:*:22:22::0:0:sshd privilege separation:/home/sshd:/nonexistent And reran sshd again. It didn't change anything. But anything at this point is worth trying. I appreciate the effort you've shown me. For now, I just hacked up canohost.c and just copied 'return xstrdup(ntop);' from line 81 to right before the getnameinfo() call on line 77. Forgoing the entire getnameinfo() lookup, since it's always going to fail anyways. But I'd rather not leave it like that. I'm almost certain it's my dns setup. Maybe I did PTR wrong in tinydns root? But even then, sshd doesn't seem to be asking 127.0.0.1 like it's suppose to. Grrrrrrr. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message