File: //usr/lib/courier-imap/man/man8/userdbpw.8
.\" <!-- $Id: userdbpw.sgml,v 1.1 2001/11/24 20:49:56 mrsam Exp $ -->
.\" <!-- Copyright 1998 - 2001 Double Precision, Inc. See COPYING for -->
.\" <!-- distribution information. -->
.\" This manpage has been automatically generated by docbook2man
.\" from a DocBook document. This tool can be found at:
.\" <http://shell.ipoline.com/~elmert/comp/docbook2X/>
.\" Please send any bug reports, improvements, comments, patches,
.\" etc. to Steve Cheng <steve@ggi-project.org>.
.TH "USERDBPW" "8" "19 February 2004" "Double Precision, Inc." ""
.SH NAME
userdbpw \- create an encrypted password
.SH SYNOPSIS
\fBuserdbpw\fR [ \fB-md5\fR | \fB-hmac-md5\fR | \fB-hmac-sha1\fR ] \fB|\fR\fBuserdb\fR \fB\fIname\fB\fR \fBset\fR \fB\fIfield\fB\fR
.SH "DESCRIPTION"
.PP
\fBuserdbpw\fR enables secure entry of encrypted
passwords into \fI/etc/userdb\fR\&.
.PP
\fBuserdbpw\fR reads a single line of text on
standard input, encrypts it, and prints the encrypted result to standard
output.
.PP
If standard input is attached to a terminal device,
\fBuserdbpw\fR explicitly issues a "Password: " prompt on
standard error, and turns off echo while the password is entered.
.PP
The \fB-md5\fR option is available on systems that use
MD5-hashed passwords (such as systems that use the current version of the
PAM library for authenticating, with MD5 passwords enabled).
This option creates an MD5 password hash, instead of using the
traditional \fBcrypt()\fR function.
.PP
\fB-hmac-md5\fR and \fB-hmac-sha1\fR options
are available only if the userdb library is installed by an application
that uses a challenge/response authentication mechanism.
\fB-hmac-md5\fR creates an intermediate HMAC context using the
MD5 hash function. \fB-hmac-sha1\fR uses the SHA1 hash function
instead. Whether either HMAC function is actually available depends on the
actual application that installs the \fBuserdb\fR library.
.PP
Note that even though the result of HMAC hashing looks like an encrypted
password, it's really not. HMAC-based challenge/response authentication
mechanisms require the cleartext password to be available as cleartext.
Computing an intermediate HMAC context does scramble the cleartext password,
however if its compromised, it WILL be possible for an attacker to succesfully
authenticate. Therefore, applications that use challenge/response
authentication will store intermediate HMAC contexts in the "pw" fields in the
userdb database, which will be compiled into the
\fIuserdbshadow.dat\fR
database, which has group and world permissions turned off. The
userdb library also requires that the cleartext userdb source for the
\fIuserdb.dat\fR and
\fIuserdbshadow.dat\fR databases is also stored with the
group and world permissions turned off.
.PP
\fBuserdbpw\fR is usually used together in a pipe with
\fBuserdb\fR, which reads from standard input. For example:
.sp
.RS
.PP
.nf
\fBuserdbpw -md5 | userdb users/john set systempw\fR
.fi
.RE
.PP
or:
.sp
.RS
.PP
.nf
\fBuserdbpw -hmac-md5 | userdb users/john set hmac-md5pw\fR
.fi
.RE
.PP
These commands set the \fBsystempw\fR field in the record for
the user \fBjohn\fR in \fI/etc/userdb/users\fR file, and the
\fBhmac-md5pw\fR field. Don't forget to run
\fBmakeuserdb\fR for the change to take effect.
.PP
The following command does the same thing:
.sp
.RS
.PP
.nf
\fBuserdb users/john set systempw=SECRETPASSWORD\fR
.fi
.RE
.PP
However, this command passes the secret password as an argument to the
\fBuserdb\fR command, which can be viewed by anyone who happens
to run
\fBps\fR(1)
at the same time. Using \fBuserdbpw\fR allows the secret password
to be specified in a way that cannot be easily viewed by
\fBps\fR(1)\&.
.SH "SEE ALSO"
.PP
\fBuserdb\fR(8),
\fBmakeuserdb\fR(8)