apg - generates several random passwords
Contents
Bugs
None. If you've found one, please send bug description to the author.
Default Options
apg-a0-Msncl-n6-x10-m8 (new style)
If you want to generate really secure passwords, you should use option -s. To simplify apg usage, you can
write a small shell script. For example:
[begin]---->pwgen.sh#!/bin/sh/usr/local/bin/apg-m8-x12-s[end]---->pwgen.shDescription
apg generates several random passwords. It uses several password generation algorithms (currently two)
and a built-in pseudo random number generator.
Default algorithm is pronounceable password generation algorithm designed by MorrieGasser and described
in ARandomWordGeneratorForPronounceablePasswordsNationalTechnicalInformationService(NTIS)AD-A-017676. The original paper is very old and had never been put online, so I have to use NIST
implementation described in FIPS-181.
Another algorithm is simple random character generation algorithm, but it uses four user-defined symbol
sets to produce random password. It means that user can choose type of symbols that should appear in
password. Symbol sets are: numeric symbol set (0,...,9), capital letters symbol set (A,...,Z), small
letters symbol set (a,...,z) and special symbols symbol set (#,@,!,...).
Built-in pseudo random number generator is an implementation of algorithm described in AppendixCofANSIX9.17 or RFC1750 with exception that it uses CAST or SHA-1 instead of TripleDES. It uses local time
with precision of microseconds (see gettimeofday(2)) and /dev/random (if available) to produce initial
random seed.
apg also have the ability to check generated password quality using dictionary. You can use this ability
if you specify command-line options -rdictfile or -bfiltername where dictfile is the dictionary file
name and filtername is the name of Bloom filter file. In that dictionary you may place words (one per
line) that should not appear as generated passwords. For example: user names, common words, etc. You even
can use one of the dictionaries that come with dictionarypasswordcrackers. Bloom filter file should be
created with apgbfm(1) utility included in apg distribution. In future releases I plan to implement some
other techniques to check passwords (like pattern check) just to make life easier.
Diagnostics
If /dev/random is not available, apg will display a message about it.
Exit Code
On successful completion of its task, apg will complete with exit code 0. An exit code of -1 indicates
an error occurred. Textual errors are written to the standard error stream.
Files
None.
Name
apg - generates several random passwords
Options
Passwordgenerationmodesoptions-aalgorithm
Use algorithm for password generation.
0 - pronounceable password generation (default), see SECURITYCAVEATS below
1 - random character password generation
-nnum_of_pass
Generate num_of_pass number of passwords. Default is 6.
-mmin_pass_len
Generate password with minimum length min_pass_len. If min_pass_len>max_pass_len then
max_pass_len=min_pass_len. Default minimum password length is 8.
-xmax_pass_len
Generate password with maximum length max_pass_len. If min_pass_len>max_pass_len then
max_pass_len=min_pass_len. Default maximum password length is 10.
-Mmode
Use symbolsets specified with mode for password generation. mode is a text string consisting of
characters S, s, N, n, C, c, L, l (see SECURITYCAVEATS below). Where:
S Generator must use special symbol set for every generated password.
s Generator should use special symbol set for password generation.
N Generator must use numeral symbol set for every generated password.
n Generator should use numeral symbol set for password generation.
C Generator must use capital symbol set for every generated password.
c Generator should use capital symbol set for password generation.
L Generator must use small letters symbol set for every generated password (always present if
pronounceable password generation algorithm is used).
l Generator should use small letters symbol set for password generation.
R,r Not supported any more. Use -Echar_string option instead.
mode can not be more than 4 characters in length.
Note:
Usage of L, M, S, C will slow down password generation process.
Examples:-Msncl-MSNCL-MCn-Echar_string
Exclude characters in char_string from password generation process (in pronounceable password
generation mode you can not exclude small letters). To include special symbols that can be
recognized by shell (apostrophe, quotes, dollar sign, etc.) in char_string use the backslashed
versions.
Examples:
Command apg-a1-Mn-n3-m8-E23456789 will generate a set of passwords that will look like
this:
101001100111100011011101
Command apg-a1-Mnc-n3-m26-EGHIJKLMNOPQRSTUVWXYZ will generate a set of passwords that
will look like this:
16A1653CD4DE5E7BD9584A3476C8F78E06944AFD57FB9CB882BC8C8DF37CD792D36D056BBD5002Passwordqualitycontroloptions-rdictfile
Check generated passwords for their appearance in dictfile-bfilter_file
Check generated passwords for their appearance in filter_file. filter_file should be created with
the apgbfm(1) utility.
-pmin_substr_len
This option tells apg(1) to check every substring of the generated password for appearance in
filter_file. If any of such substrings would be found in the filter_file then generated password
would be rejected and apg(1) will generate another one. min_substr_len specifies minimum
substring length to check. This option is active only if -b option is defined.
Pseudorandomnumbergeneratoroptions-s Ask user for random sequence for password generation
-ccl_seed
Use cl_seed as a random seed for password generation. I use it when i have to generate passwords
in a shell script.
Examples:-c/dev/urandom-c/tmp/seed_filePasswordoutputoptions-d Do NOT use any delimiters between generated passwords. I use it when i have to generate passwords
in a shell script.
-y Print generated passwords and crypted passwords (see crypt(3))
-q Quiet mode (do not print warnings)
-l Spell generated passwords. Useful when you want to read generated password by telephone.
WARNING: Think twice before read your password by phone.
-t Print pronunciation for generated pronounceable password. Ignored if -a1 is set.
-h Print help information and exit
-v Print version information and exit
Security Caveats
apg is no longer maintained upstream. Alternatives include pwgen, diceware and xkcdpass.
In particular, pronouncable passwords may be prone to various attacks and enforcing the use of certain
symbolsets (via the S, N, C and Lmodes of the -M option) might even simplify attacking the password.
See Debian bug #987952.
See Also
apgbfm(1)
Synopsis
apg [-aalgorithm] [-Mmode] [-Echar_string] [-nnum_of_pass] [-mmin_pass_len] [-xmax_pass_len] [-rdictfile] [-bfilter_file] [-pmin_substr_len] [-s] [-ccl_seed] [-d] [-y] [-l] [-t] [-q] [-h] [-v]
