Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* OSF/1 3.0 Prot. Password Encryption
@ 1994-09-28 13:56 Richard L Jackson Jr
  1994-09-29 12:58 ` David Brady
  1994-10-05 18:42 ` Jeff Scarborough
  0 siblings, 2 replies; 4+ messages in thread
From: Richard L Jackson Jr @ 1994-09-28 13:56 UTC (permalink / raw)


I have a DEC 2100/A500MP running OSF/1 3.0 with Enhanced Security
enabled.  We generate from 5 to 600 accounts a day on the system.  Therefore,
the GUI XIsso and XSysAdmin tools must be replaced with an automated
Account Management System.  We did the same thing on our ULTRIX box.  My
problem is the encrypted pw, generated via crypt(), for the protected password
database appears to fail for passwords that are over 8 characters.  The
limited documentation in the man pages and /usr/include/*.h files
indicate the encrypted password is generated in segments.  WHAT IS THE
ACTUAL SCHEME DEC USES?

ps.  XIsso and XSysAdmin are slow.  I have not determined if it is a problem
with the clients and/or server.

ps2.  It sure would be nice if the hashed index /etc/passwd file could 
have entries added without being totally rebuilt.  For a small user base,
rebuilding the passwd database presents only a small problem.  However,
a database with 14,000 users takes a minute or so to rebuild.  This causes
problems with email and other normal system functions.  1) The getpw* routines
should be enhanced to suspend requests if the database is being modified.
2) permit updates to the database without having to totally rebuild.
Unfortunately, I am forced to disable login and sendmail while rebuilding 
the passwd database via mkpasswd.

Regards,
Richard Jackson
George Mason University


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: OSF/1 3.0 Prot. Password Encryption
  1994-09-28 13:56 OSF/1 3.0 Prot. Password Encryption Richard L Jackson Jr
@ 1994-09-29 12:58 ` David Brady
  1994-10-05 15:55   ` Malcolm Beattie
  1994-10-05 18:42 ` Jeff Scarborough
  1 sibling, 1 reply; 4+ messages in thread
From: David Brady @ 1994-09-29 12:58 UTC (permalink / raw)


Richard L Jackson Jr (rjackson@mason1.gmu.edu) wrote:

: database appears to fail for passwords that are over 8 characters.  The
: limited documentation in the man pages and /usr/include/*.h files
: indicate the encrypted password is generated in segments.  WHAT IS THE
: ACTUAL SCHEME DEC USES?

  If you want to use the 24-character encryptions, use the crypt16() call.

  Then, in the user's tcb entry, put in the field u_oldcrypt#1, so that
  the password-checking routine will know what you're using a
  24-character length encryption.

  I know it's possible to get even longer encryptions, but I can't
  remember how to do it.

  (For example):
  dave:u_name=dave:u_id#463:u_oldcrypt#1:\ 
      :u_pwd=E1hdyedk/shs83DEdavdlehd:\            
      .
      .
      .
      :chkent:

--
====================================================================
Dave Brady                          Phone: 617-373-4579
Sr Systems Programmer               FAX: 617-373-8600
Division of Academic Computing      Internet: dave@lynx.neu.edu
Northeastern University             BITNET: dave%lynx.neu.edu@cunyvm
Boston, MA 02115
====================================================================


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: OSF/1 3.0 Prot. Password Encryption
  1994-09-29 12:58 ` David Brady
@ 1994-10-05 15:55   ` Malcolm Beattie
  0 siblings, 0 replies; 4+ messages in thread
From: Malcolm Beattie @ 1994-10-05 15:55 UTC (permalink / raw)


In article <36edl3$q02@chaos.dac.neu.edu>,
David Brady <dave@lynx.dac.neu.edu> wrote:
>Richard L Jackson Jr (rjackson@mason1.gmu.edu) wrote:
>
>: database appears to fail for passwords that are over 8 characters.  The
>: limited documentation in the man pages and /usr/include/*.h files
>: indicate the encrypted password is generated in segments.  WHAT IS THE
>: ACTUAL SCHEME DEC USES?
>
>  If you want to use the 24-character encryptions, use the crypt16() call.
>
>  Then, in the user's tcb entry, put in the field u_oldcrypt#1, so that
>  the password-checking routine will know what you're using a
>  24-character length encryption.
>
>  I know it's possible to get even longer encryptions, but I can't
>  remember how to do it.

There's a dreadful lack of documentation on all of this stuff. I've
managed to figure out most of it, though, from staring at include
files and trial and error. If what you're really after is how to
validate logins for daemons such as imap, pop, wu-ftpd and so on then
the "proper" interface is via set_auth_parameters, sia_ses_init,
sia_ses_authent (to check the password) and sia_ses_estab (to check
whether the user is allowed to log in--account locks, expiry and so on).
There's also sia_ses_launch which does the appropriate setting of
uid, gid and so on but that's usually less useful for daemons which
already have code to do that. I posted my patches to pop and imap
here yesterday and inspection of that may help. If DEC don't document
this stuff soon, I suppose I could put together something and post it
here when I have time.

Back to the actual question: DEC's algorithm for encrypting passwords.
The (undocumented) function which actually lets you do this directly
is called bigcrypt in libsecurity.so. Here's an example program:

#include <stdio.h>
#include <prot.h>

int main(int argc, char **argv)
{
    char *key;
    
    if (argc != 3)
    {
	fprintf(stderr, "Usage: bigcrypt salt key\n");
	exit(2);
    }
    key = argv[2];
    
    /* Don't want the audit log to include what we're crypting */
    argv[2] = 0;
    
    set_auth_parameters(2, argv);
    puts(bigcrypt(key, argv[1]));
    exit(0);
}

Compile this with
    cc -o bigcrypt bigcrypt.c -lsecurity

We discovered this sometime after a colleague, Paul Leyland (pcl@ox.ac.uk),
discovered what the actual algorithm was and rolled-his-own.
/usr/include/prot.h says:
    /*
     * The size of the ciphertext is the salt at the
     * beginning, a series of 11-character segments produced by
     * each call to crypt(), and the trailing end-of-string character.
     * Each 11-character segment uses the a newly computed salt based
     * on the previous encrypted value.
     */
The only thing missing is how it computes the salt for each successive
block of 8 characters. In fact, it's simple. It splits the text to
be bigcrypted into 8 character chunks. It takes the salt and the
first chunk of 8 bits and does crypt(salt, chunk1) using standard crypt.
(Notice that this means that passwords with 8 characters or fewer will
"work" with ordinary crypt, although not crypt16 which is different again).
The first 2 characters of crypt1 are just the salt that you fed in,
of course. The following two characters are taken to be the salt for the
next block of 8 plaintext characters and crypt is done again.
Let crypt'(salt, text) be what the usual crypt returns but omitting the
first two characters (which are just the original salt). Then the
plaintext is split up into 8 byte blocks, text1, text2, ... Taking the
salt required for the whole thing, we do
    crypt1 = crypt'(salt, text1);
    salt1 = first_two_chars(crypt1);
    crypt2 = crypt'(salt1, crypt1);
    salt2 = first_two_chars(crypt2);
    crypt3 = crypt'(salt2, crypt2);
and so on. The result of the whole process is the concatenaation of
salt, crypt1, crypt2, crypt3, ... A concrete example:
    sable% ./bigcrypt ab 12345678abcdefgh
(*) ab1iBa.N.U2C6JI06ws2gRbQ

An ordinary crypt of the first 8 bytes (which bigcrypt does identically):
    sable% ./bigcrypt ab 12345678
    ab1iBa.N.U2C6
    ^^ original salt
      ^^ used as salt to next round
(1)   ^^^^^^^^^^^ used as first 11 bytes of cipher text (ignoring salt)

    sable% ./bigcrypt 1i abcdefgh
    1iJI06ws2gRbQ
(2)   ^^^^^^^^^^^ used as next 11 bytes of cipher text

If you look at the result of bigcrypt above in (*) you'll see it's
the concatenation of the original salt (ab) then (1) and (2).

--Malcolm

-- 
Malcolm Beattie <mbeattie@sable.ox.ac.uk> (note new address)
Oxford University Computing Services
"Widget. It's got a widget. A lovely widget. A widget it has got." --Jack Dee


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: OSF/1 3.0 Prot. Password Encryption
  1994-09-28 13:56 OSF/1 3.0 Prot. Password Encryption Richard L Jackson Jr
  1994-09-29 12:58 ` David Brady
@ 1994-10-05 18:42 ` Jeff Scarborough
  1 sibling, 0 replies; 4+ messages in thread
From: Jeff Scarborough @ 1994-10-05 18:42 UTC (permalink / raw)


Richard L Jackson Jr (rjackson@mason1.gmu.edu) wrote:
: I have a DEC 2100/A500MP running OSF/1 3.0 with Enhanced Security
: enabled.  We generate from 5 to 600 accounts a day on the system.  Therefore,
: the GUI XIsso and XSysAdmin tools must be replaced with an automated
: Account Management System.  We did the same thing on our ULTRIX box.  My
: problem is the encrypted pw, generated via crypt(), for the protected password
: database appears to fail for passwords that are over 8 characters.  The
: limited documentation in the man pages and /usr/include/*.h files
: indicate the encrypted password is generated in segments.  WHAT IS THE
: ACTUAL SCHEME DEC USES?

: ps.  XIsso and XSysAdmin are slow.  I have not determined if it is a problem
: with the clients and/or server.

: ps2.  It sure would be nice if the hashed index /etc/passwd file could 
: have entries added without being totally rebuilt.  For a small user base,
: rebuilding the passwd database presents only a small problem.  However,
: a database with 14,000 users takes a minute or so to rebuild.  This causes
: problems with email and other normal system functions.  1) The getpw* routines
: should be enhanced to suspend requests if the database is being modified.
: 2) permit updates to the database without having to totally rebuild.
: Unfortunately, I am forced to disable login and sendmail while rebuilding 
: the passwd database via mkpasswd.

: Regards,
: Richard Jackson
: George Mason University

The first question has already been answered.

The second is yes you can update the dbm files without rebuilding the whole
thing.  In fact the passwd command does do this (not for passwords if you
are running c2 but for gecos and shell).

I looked at the npasswd code to figure out how and modified it slightly.
I added some stuff to take care of AIX's lack of a comment field and added
a delete routine.  If you want the code I have let me know and I will mail
it to you.

You can also get around having to disable login's and sendmail by building
the hashed file on ptmp and moving it into place.

--
Jeff Scarborough              Jeff.Scarborough@Colorado.EDU
University of Colorado        Computing & Network Services
Campus Box 455                Boulder, Colorado 80309-0455


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1994-10-05 18:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1994-09-28 13:56 OSF/1 3.0 Prot. Password Encryption Richard L Jackson Jr
1994-09-29 12:58 ` David Brady
1994-10-05 15:55   ` Malcolm Beattie
1994-10-05 18:42 ` Jeff Scarborough

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox