=head1	NAME

createp - Create password

=head1	SYNOPSIS

createp I<option> I<username(s)>

=head1	DESCRIPTION

The program suggests passwords using a random number generator.

=head1	OPTIONS

=over	4

=item	B<-t> I<type>

selects a password type. Password types can be used to create more
difficult passwords i.e. for administration purposes.

Long option: --type=I<type>

=item	B<-l> I<length>

specifies the password length, either as number or as a range
(two numbers separated by minus).

Long option: --length=I<length>

=item	B<-o> I<mode>

specifies the output mode, one of the following:

=over	8

=item	default

The number of digits, special and uppercase characters in the password
is specified explicitly (see below).

=item	hex

The output contains digits and characters 'a'...'f'.

=item	ascii85

The output contains characters 33...127 (decimal).

=item	charset I<set>

The output character set is specified explicitly. Each lowercase
character represents all lowercase characters,
each uppercase character represents all uppercase characters, each
digit represents all digits.

=back

Long option --output-mode=...

=item	B<-d> I<digits>

specifies the number of digits in the password either as number
or as a range.

Long option: --digits=I<digits>

=item	B<-s> I<specials>

specifies the number of special characters, either as a number
or as a range.

Long option: --specials=I<specials>

=item	B<-k> I<upper>

specifies the number of upper case characters, either as number
or as a range.

Long option: --upper-case=I<upper>

=item	B<-p>

print password only, skip the name.

Long options: --password-only or --password-only=off

=item	B<-a> I<prngs>

lists the allowed PRNGs (pseudo random number generators).
Use either ``all'' or one or multiple (comma-separated) from
``openssl'', ``random'', ``rand48'' or ``rand''.

=item	B<-c> I<option>

saves the specified options as permanent options.

Long option: --configure

=item	B<-C>

shows the current configuration.

Long option: --show-configuration

=item	B<-r>

skips the permanent options for this one program invokation.

Long option: --reset

=item	B<-u>

removes the permanent options.

Long option: --unconfigure

=item	B<-h>

prints a short help text.

Long option: --help

=item	B<-v>

prints version information.

Long option: --version

=back

=head1	RETURN VALUE

On success the program writes a password suggestion for each
specified user name to standard output and returns exit code 0.
Positive numbers are returned on errors.

=head1	EXAMPLES

  createp -c -t admin -l 8-10 -d 2-4 -s 1-2 -k 1-2

creates a new password type ``admin'' using a password length
in the range 8...10, 2...4 digits in the password, 1...2 special
characters and 1...2 upper case characters. This password type
is now the default password type.

  createp -c -t user -l6 -d2 -s0 -k0

creates a new password type ``user'' using a fixed password length
of 6, passwords contain 2 digits, no special characters and no
upper case characters. The ``user'' password type is now the default
password type.

  createp peter paul mary

prints password suggestsion for the users peter, paul and mary.

  createp -t admin root

suggests a more complicated password for a user named root.

  createp -c -t wpa-key-1 -l 32 -p -o hex

creates a new password type for WPA keys.

  createp -c -t wpa-key-2 -p -l 64 -o ascii85

creates a new password type for WPA keys consisting of 64 characters
in the range 0x21...0x7F.

  createp -t wpa-key-1 my-computer

prints a possible WPA key.

=head1	SECURITY

In dktools-1.2.24 and above createp can use the OpenSSL PRNG. This PRNG
must be seeded before it can be used. Seed data can be obtained from
the following sources:

=over	4

=item	a seed file.

This file can be specified in the /openssl/random-seed-file preference.
If this preference is not defined, the default file name $HOME/.rnd is used.
The seed file must be secured, only the owner must have read/write
access to this file. If access to this file is enabled for group/others
the seed file is not used.

A system  preference /openssl/allow-random-seed-file=no can be used to
deny the use of seed files (i.e. for users having home directories on
NFS file systems).

=item	an EGD socket

The socket name is obtained from the /openssl/egd-socket preference or
the EGDSOCKET environment variable. If none of these is set, the default
file name /var/run/egd-pool is used.

=item	the /dev/urandom and/or /dev/random device

=item	the screen contents (on Windows systems).

=back

=head1	RESTRICTIONS

The program uses PRNGs which must be seeded. If none of the allowed
PRNGs can be seeded, the program fails to run.

=head1	SEE ALSO

http://dktools.sourceforge.net/createp.html

=head1	AUTHOR

Dirk Krause

=head1	COPYRIGHT AND LICENSE

Copyright (c) 2001-2008, Dirk Krause
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

 * Redistributions of source code must retain the above
   copyright notice, this list of conditions and the
   following disclaimer.

 * Redistributions in binary form must reproduce the above
   copyright notice, this list of conditions and the following
   disclaimer in the documentation and/or other materials
   provided with the distribution.

 * Neither the name of the Dirk Krause nor the names of
   contributors may be used to endorse or promote products
   derived from this software without specific prior written
   permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

=head1	LAST MODIFICATION

2008/04/04
