Subject: bin/36623: ssh publickey authentification fails if homedir not present
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: None <ef@math.uni-bonn.de>
List: netbsd-bugs
Date: 07/10/2007 14:00:00
>Number: 36623
>Category: bin
>Synopsis: ssh publickey authentification fails if homedir not present
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Jul 10 14:00:00 +0000 2007
>Originator: Edgar Fuß
>Release: NetBSD 4.0_BETA2
>Organization:
Mathematisches Institut der Universität Bonn, Computerabteilung
>Description:
If you have publickey-authorized accounts on a machine (e.g. a SVN
server) where home directories are not mounted, but public keys
have been deposited in, e.g., /usr/local/etc/ssh/authorized_keys
(with AuthorizedKeysFile /usr/local/etc/ssh/authorized_keys/%u in
etc/ssh/sshd_config), authentication fails because the account's
home directories are inaccessible.
There seems to be an integration error of OpenBSD's auth.c 1.75.
In secure_filename(), the code first bails out if the homedir is
inaccessible:
if (realpath(pw->pw_dir, homedir) == NULL) {
snprintf(err, errlen, "realpath %s failed: %s", pw->pw_dir,
strerror(errno));
return -1;
}
and then sets a variable if it is accessible:
if (realpath(pw->pw_dir, homedir) != NULL)
comparehome = 1;
It appars to me that the first block should be deleted.
The block is not present in OpenBSD's auth.c 1.75.
>How-To-Repeat:
Deposit public keys as described above.
>Fix:
--- auth.c.orig 2006-09-28 23:22:14.000000000 +0200
+++ auth.c 2007-07-10 14:27:30.000000000 +0200
@@ -457,11 +463,6 @@
strerror(errno));
return -1;
}
- if (realpath(pw->pw_dir, homedir) == NULL) {
- snprintf(err, errlen, "realpath %s failed: %s", pw->pw_dir,
- strerror(errno));
- return -1;
- }
if (realpath(pw->pw_dir, homedir) != NULL)
comparehome = 1;