Re: Unix Password Encryption Procedures

From: Mike Delaney (mdelan_at_computer.org)
Date: 09/28/04

  • Next message: Sanjeev Kumar: "Re: Free SMTP Server"
    Date: Mon, 27 Sep 2004 17:36:13 -0500
    
    

    On 27 Sep 2004 13:39:48 -0700, Kushal Agarwal said something similar to:
    :
    : I know that most Unix machines either use the DES encryption algorithm
    : or the MD5 encryption algorithm, I am wondering if there is any
    : flavour of unix which uses the kerberos (or anyother) methodology?

    Unix _hashes_ passwords, it does not _encrypt_ them. There is no
    such thing as the "MD5 encryption algorithm". MD5 is a hash algorithm.

    To answer your question, there are (to my knowledge) four password
    hashing methods in common use on Unix systems:

            * The traditional DES based algorithm.
            * An algorithm based on MD5. The use of this algorithm is
              generally denoted by prepending the string "$1$" to the
              salt+hash in /etc/passwd | /etc/shadow. The MD5 algorithm
              is found on most of the *BSD flavors, Linux, and Solaris 9
              (among others).
            * An algorithm based on Blowfish. This one is denoted by
              the prepended string "$2a$" in the hash. OpenBSD, some
              Linux distributions (but not all), and Solaris 9 are among
              the systems supporting this algorithm.
            * A second MD5 based algorithm, sometimes known as Sun-MD5.
              This is AFAIK only found in Solaris 9.

    As to Kerberos, many Linux distributions come with Kerberos implementations,
    as do some of the *BSDs. Solaris has been slowly adding more and more
    bits of SEAM (Sun's Kerberos implementation) into the OS.
    It is however, not the default on any of these platforms. Someone
    has to setup a Kerberos realm and configure the systems to authenticate
    against it.

    Some administrators have also been known to setup systems to authenticate
    via binding against an LDAP directory using PAM or BSD AUTH.

    There's also RADIUS, OTP, TACACS, SRP, etc. and so forth.

    : Additonally, I know that the function crypt() is able to encrypt using
    : either the DES or the MD5 algorithm, depending on the salt supplied
    : with the function. I am curious as to given an encrypted string, is
    : there any "clean" (via a function(s)) way to determine what method was
    : used to encrypt the original string. I need to know how the original
    : string was encrypted so that I can use the same procedure to encrypt
    : the entered string (so that I may compare the stored and entered
    : strings).

    If you're just trying to validate passwords against a database of
    crypt(3) hashes, simply pass the stored hash you're comparing to
    crypt(3) as the salt field and let it figure it out.

    If you're trying to write something to authenticate users against whatever
    backend mechanism your OS is configured to use, be it traditional passwords,
    Kerberos, LDAP, or what have you, then you're going to have to determine what
    mechanism your OS uses to verify passwords and use that.

    Most Linux and System Vish systems use PAM (Pluggable Authentication
    Modules) to alow the administrator "plug in" arbitrary authentication
    methods. On those you'd call PAM and let it worry about the
    authentication (obviously I'm grossly oversimplifying here).
    The *BSD systems tend to use BSD AUTH for the same purpose (though
    some support PAM as well).


  • Next message: Sanjeev Kumar: "Re: Free SMTP Server"

    Relevant Pages

    • How good an encryption algorithm is this?
      ... Must be capable of encrypting strings to a byte array, ... back again to the same string ... Encryption algorithm must also return the exact number of bytes of the ...
      (microsoft.public.dotnet.languages.csharp)
    • How good an encryption algorithm is this?
      ... Must be capable of encrypting strings to a byte array, ... back again to the same string ... Encryption algorithm must also return the exact number of bytes of the ...
      (microsoft.public.vc.language)
    • Re: how to send data using crypto keys?
      ... The ONLY unbreakable encryption algorithm is One Time Pads. ... EVERY algorithm that re-uses keys or computes new keys in a ...
      (comp.security.misc)
    • Re: UsernameToken Encryption with TripleDES
      ... EncryptionMethod passed in the request. ... > The default encryption algorithm for UsernameToken, ... > at server side by config or programmatically. ...
      (microsoft.public.dotnet.framework.webservices.enhancements)
    • [UNIX] Vulnerability in Encrypted Loop Device for Linux
      ... Encrypting a disk device aims to protect against an off-line attacker who ... The encryption mode used by encrypted loop device is CBC. ... We propose 2 types of fixes: one that authenticate at mount time (see ...
      (Securiteam)