17.16. Using MD5 for Authentication

LPRng has built-in support for using MD5 digests as an authentication method. The implementation is provided as an example of how to add user level authentication into the LPRng system.

The method used to do authentication is very simple. Each user has a file containing a set of keys that are used to salt an md5 hash. The information being transferred has its md5 checksum calculated using this salt, and is then transferred to the destination, along with the md5 hash result. At the destination the server will get the user id, obtain the salt value from a key file, and then calculate the md5 hash value. If the two are in agreement, authentication is successful.

The keyfile used for md5 authentication contains an id followed by a text string whose binary value is used as a hash key:

    id1=key
    id2=key
    
    Example:
    
    lpr@h2=tadf79asd%^1asdf
    lpr@h1=fdfa%$^&^%$


17.16.1. Printcap Entries

Options used:



Example printcap entry:

    pr:
        :lp=pr@wayoff
        :auth=md5
        :md5_id=lpr@wayoff.com
    pr:server
        :auth_forward=md5
        :md5_id=lpr@wayoff.com
        :md5_server_keyfile
        :md5_forward_id=lpr@faroff.com


The md5_id value is used by the client to obtain a hash key that is used to salt the md5 calculation for client to server transfers. The md5_forward_id value is used by the server to obtain a hash key that is used to salt the md5 calculation for server to server transfers.

The md5_server_keyfile contains the keys of users; the id sent as the connection information is used to obtain the key from the file.

To set up md5 authentication, all that is needed is the following.



17.16.2. User Environment Variables and Files

Options used:



The MD5KEYFILE environment variable contains the path to the user keytab file.