Re: [owl-users] tcb and friends with shadow-utils 4.0.12

From: Solar Designer (solar@private)
Date: Sun Jul 02 2006 - 22:07:50 PDT


I wrote:
> > As it relates to the segfault you're seeing, I think it'd be most
> > straightforward to debug it rather than proceed to theorize as to its
> > possible cause.

On Sun, Jul 02, 2006 at 09:52:14PM -0600, Vincent Danen wrote:
> I agree.  And I'm starting to suspect ...

If you've agreed that it's most straightforward to just go ahead and
debug the segfault, then why are you proceeding to "suspect" something?

> At any rate, I've been fiddling with the options of pam_tcb and tried to
> make it use regular md5 passwords by first changing "prefix=$2a$" to
> "prefix=$1$", which didn't work.  I then tried removing the prefix
> option and using "md5" in there, but now I'm seeing this in syslog:
> 
> authpriv.crit: passwd[2046]: pam_tcb(passwd:chauthtok):
> crypt_gensalt_ra: Invalid argument

Most likely, you did not also remove the explicit "count=..." setting.
The FreeBSD-style MD5-based hashing method does not accept variable
iteration counts, so it is wrong to try to specify a count with it.

The pam_tcb(8) man page documents this as follows:

       count= The  number  of iterations of an underlying crypto-
              graphic primitive to use  when  hashing  passwords.
              The  default  is 0, which lets the selected hashing
              algorithm pick its default iteration count.

              It is highly recommended  that  you  override  this
              setting.   Please refer to crypt(3) for information
              on supported hashing methods, their prefix strings,
              and their count settings.

crypt(3) says:

ERRORS
       EINVAL
[...]
              crypt_gensalt, crypt_gensalt_rn,  crypt_gensalt_ra:
              prefix  is  invalid or not supported by this imple-
              mentation; count is invalid for the requested  pre-
              fix; ...
[...]
     FreeBSD-style MD5-based
[...]
       Iteration count
              1000

> [vdanen@build SOURCES]$ ./hasher foo '$2a$salt'
> *0
> [vdanen@build SOURCES]$ ./hasher foo '$2a$'
> *0

That's the correct output for invalid salt strings like those you've
been providing.

> Well, I did find this:
> 
> http://www.openwall.com/lists/john-users/2005/07/02/1
> 
> and then tried hasher with '$2a$05' to try to simulate what I saw there
> and still no dice

Using the example bcrypt salt from that john-users posting, we get:

$ perl -e 'print crypt("foo", "\$2a\$05\$abcdefghijklmnopqrstuu"), "\n"'
$2a$05$abcdefghijklmnopqrstuuz29TNT43FrbrkSgusq0SUVtGQkhH2mm

You can repeat this "Perl test" on your system just to make sure that
crypt_blowfish in your glibc works, but I am fairly certain that it does
and that it has nothing to do with the segfault.

-- 
Alexander Peslyak <solar at openwall.com>
GPG key ID: B35D3598  fp: 6429 0D7E F130 C13E C929  6447 73C3 A290 B35D 3598
http://www.openwall.com - bringing security into open computing environments



This archive was generated by hypermail 2.1.3 : Sun Jul 02 2006 - 22:08:11 PDT