APG - Automated Password Generator
提供:MDWiki
インストール
例によって Free... ということで、make config でパスワード強度をチェックする "CRACKLIB" (CrackLib support for password quality) のサポートを有効としてインストールする。
reebsd# cat pkg-descr An automated password generator, using several strong algorithms for random and/or pronounceable password generation, and a built-in pseudo-random number generator. WWW: http://www.adel.nursat.kz/apg/ Author: Adel I. Mirzazhanov <a-del@iname.com> freebsd# make ===> Vulnerability check disabled, database not found ===> License BSD accepted by the user ===> Found saved configuration for apg-2.3.0b_2 ===> Extracting for apg-2.3.0b_2 => SHA256 Checksum OK for apg-2.3.0b.tar.gz. /usr/bin/find /usr/ports/security/apg/work/apg-2.3.0b -type d | /usr/bin/xargs /bin/chmod u+wx /usr/bin/find /usr/ports/security/apg/work/apg-2.3.0b -type f | /usr/bin/xargs /bin/chmod u+w ===> Patching for apg-2.3.0b_2 ===> Applying FreeBSD patches for apg-2.3.0b_2 ===> apg-2.3.0b_2 depends on shared library: crack.1 - not found ===> Verifying install for crack.1 in /usr/ports/security/cracklib ===> Vulnerability check disabled, database not found ===> License check disabled, port has not defined LICENSE => cracklib,2.7.tar.gz doesn't seem to exist in /usr/ports/distfiles/. => Attempting to fetch http://www.crypticide.com/users/alecm/security/cracklib,2.7.tar.gz fetch: http://www.crypticide.com/users/alecm/security/cracklib,2.7.tar.gz: Moved Permanently => Attempting to fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/distfiles/cracklib,2.7.tar.gz cracklib,2.7.tar.gz 100% of 20 kB 72 kBps ===> Extracting for cracklib-2.7_2 => SHA256 Checksum OK for cracklib,2.7.tar.gz. ===> Patching for cracklib-2.7_2 ===> Applying FreeBSD patches for cracklib-2.7_2 ===> Configuring for cracklib-2.7_2 ===> Building for cracklib-2.7_2 ( cd cracklib && make all && exit $? ) cc -O2 -pipe -fno-strict-aliasing -I../cracklib -DIN_CRACKLIB -c fascist.c fascist.c: In function 'GTry': fascist.c:431: warning: incompatible implicit declaration of built-in function 'strlen' fascist.c: In function 'FascistGecos': fascist.c:502: warning: incompatible implicit declaration of built-in function 'strncpy' fascist.c:513: warning: incompatible implicit declaration of built-in function 'strcpy' fascist.c:577: warning: incompatible implicit declaration of built-in function 'strcat' fascist.c: In function 'FascistLook': fascist.c:631: warning: incompatible implicit declaration of built-in function 'strncpy' fascist.c:635: warning: incompatible implicit declaration of built-in function 'strlen' fascist.c:650: warning: incompatible implicit declaration of built-in function 'strchr' fascist.c:662: warning: incompatible implicit declaration of built-in function 'strcpy' fascist.c: In function 'FascistCheck': fascist.c:761: warning: incompatible implicit declaration of built-in function 'strncpy' fascist.c:778: warning: incompatible implicit declaration of built-in function 'exit' cc -O2 -pipe -fno-strict-aliasing -I../cracklib -DIN_CRACKLIB -c packlib.c packlib.c: In function 'PWOpen': packlib.c:34: warning: incompatible implicit declaration of built-in function 'memset' packlib.c: In function 'PutPW': packlib.c:180: warning: incompatible implicit declaration of built-in function 'strncpy' packlib.c:225: warning: incompatible implicit declaration of built-in function 'memset' packlib.c: In function 'GetPW': packlib.c:288: warning: incompatible implicit declaration of built-in function 'strcpy' cc -O2 -pipe -fno-strict-aliasing -I../cracklib -DIN_CRACKLIB -c rules.c rules.c: In function 'Suffix': rules.c:63: warning: incompatible implicit declaration of built-in function 'strlen' rules.c: In function 'Reverse': rules.c:82: warning: incompatible implicit declaration of built-in function 'strlen' rules.c: In function 'Pluralise': rules.c:150: warning: incompatible implicit declaration of built-in function 'strlen' rules.c:151: warning: incompatible implicit declaration of built-in function 'strcpy' rules.c:160: warning: incompatible implicit declaration of built-in function 'strcat' rules.c:163: warning: incompatible implicit declaration of built-in function 'strchr' rules.c:166: warning: incompatible implicit declaration of built-in function 'strcat' rules.c:175: warning: incompatible implicit declaration of built-in function 'strcat' rules.c:179: warning: incompatible implicit declaration of built-in function 'strcat' rules.c: In function 'MatchClass': rules.c:255: warning: incompatible implicit declaration of built-in function 'strchr' rules.c: In function 'Mangle': rules.c:431: warning: incompatible implicit declaration of built-in function 'strcpy' rules.c:455: warning: incompatible implicit declaration of built-in function 'strcat' rules.c:474: warning: incompatible implicit declaration of built-in function 'strlen' rules.c:493: warning: incompatible implicit declaration of built-in function 'strlen' rules.c:642: warning: incompatible implicit declaration of built-in function 'strchr' rules.c:662: warning: incompatible implicit declaration of built-in function 'strchr' cc -O2 -pipe -fno-strict-aliasing -I../cracklib -DIN_CRACKLIB -c stringlib.c stringlib.c: In function 'Clone': stringlib.c:49: warning: incompatible implicit declaration of built-in function 'malloc' stringlib.c:49: warning: incompatible implicit declaration of built-in function 'strlen' stringlib.c:52: warning: incompatible implicit declaration of built-in function 'strcpy' ar rv libcrack.a fascist.o packlib.o rules.o stringlib.o ar: warning: creating libcrack.a a - fascist.o a - packlib.o a - rules.o a - stringlib.o ranlib libcrack.a cc -O2 -pipe -fno-strict-aliasing -I../cracklib -DIN_CRACKLIB -fPIC -o fascist.So -c fascist.c fascist.c: In function 'GTry': fascist.c:431: warning: incompatible implicit declaration of built-in function 'strlen' fascist.c: In function 'FascistGecos': fascist.c:502: warning: incompatible implicit declaration of built-in function 'strncpy' fascist.c:513: warning: incompatible implicit declaration of built-in function 'strcpy' fascist.c:577: warning: incompatible implicit declaration of built-in function 'strcat' fascist.c: In function 'FascistLook': fascist.c:631: warning: incompatible implicit declaration of built-in function 'strncpy' fascist.c:635: warning: incompatible implicit declaration of built-in function 'strlen' fascist.c:650: warning: incompatible implicit declaration of built-in function 'strchr' fascist.c:662: warning: incompatible implicit declaration of built-in function 'strcpy' fascist.c: In function 'FascistCheck': fascist.c:761: warning: incompatible implicit declaration of built-in function 'strncpy' fascist.c:778: warning: incompatible implicit declaration of built-in function 'exit' cc -O2 -pipe -fno-strict-aliasing -I../cracklib -DIN_CRACKLIB -fPIC -o packlib.So -c packlib.c packlib.c: In function 'PWOpen': packlib.c:34: warning: incompatible implicit declaration of built-in function 'memset' packlib.c: In function 'PutPW': packlib.c:180: warning: incompatible implicit declaration of built-in function 'strncpy' packlib.c:225: warning: incompatible implicit declaration of built-in function 'memset' packlib.c: In function 'GetPW': packlib.c:288: warning: incompatible implicit declaration of built-in function 'strcpy' cc -O2 -pipe -fno-strict-aliasing -I../cracklib -DIN_CRACKLIB -fPIC -o rules.So -c rules.c rules.c: In function 'Suffix': rules.c:63: warning: incompatible implicit declaration of built-in function 'strlen' rules.c: In function 'Reverse': rules.c:82: warning: incompatible implicit declaration of built-in function 'strlen' rules.c: In function 'Pluralise': rules.c:150: warning: incompatible implicit declaration of built-in function 'strlen' rules.c:151: warning: incompatible implicit declaration of built-in function 'strcpy' rules.c:160: warning: incompatible implicit declaration of built-in function 'strcat' rules.c:163: warning: incompatible implicit declaration of built-in function 'strchr' rules.c:166: warning: incompatible implicit declaration of built-in function 'strcat' rules.c:175: warning: incompatible implicit declaration of built-in function 'strcat' rules.c:179: warning: incompatible implicit declaration of built-in function 'strcat' rules.c: In function 'MatchClass': rules.c:255: warning: incompatible implicit declaration of built-in function 'strchr' rules.c: In function 'Mangle': rules.c:431: warning: incompatible implicit declaration of built-in function 'strcpy' rules.c:455: warning: incompatible implicit declaration of built-in function 'strcat' rules.c:474: warning: incompatible implicit declaration of built-in function 'strlen' rules.c:493: warning: incompatible implicit declaration of built-in function 'strlen' rules.c:642: warning: incompatible implicit declaration of built-in function 'strchr' rules.c:662: warning: incompatible implicit declaration of built-in function 'strchr' cc -O2 -pipe -fno-strict-aliasing -I../cracklib -DIN_CRACKLIB -fPIC -o stringlib.So -c stringlib.c stringlib.c: In function 'Clone': stringlib.c:49: warning: incompatible implicit declaration of built-in function 'malloc' stringlib.c:49: warning: incompatible implicit declaration of built-in function 'strlen' stringlib.c:52: warning: incompatible implicit declaration of built-in function 'strcpy' ld -shared -o libcrack.so.1 fascist.So packlib.So rules.So stringlib.So ( cd util && make DICTPATH="/usr/local/libdata/cracklib/pw_dict" && exit $? ) cc -O2 -pipe -fno-strict-aliasing -I../cracklib '-DCRACKLIB_DICTPATH="/usr/local/libdata/cracklib/pw_dict"' -c packer.c cc -O2 -pipe -fno-strict-aliasing -I../cracklib '-DCRACKLIB_DICTPATH="/usr/local/libdata/cracklib/pw_dict"' -o\ packer packer.o ../cracklib/libcrack.a cc -O2 -pipe -fno-strict-aliasing -I../cracklib '-DCRACKLIB_DICTPATH="/usr/local/libdata/cracklib/pw_dict"' -c unpacker.c cc -O2 -pipe -fno-strict-aliasing -I../cracklib '-DCRACKLIB_DICTPATH="/usr/local/libdata/cracklib/pw_dict"' -o\ unpacker unpacker.o ../cracklib/libcrack.a cc -O2 -pipe -fno-strict-aliasing -I../cracklib '-DCRACKLIB_DICTPATH="/usr/local/libdata/cracklib/pw_dict"' -c testnum.c cc -O2 -pipe -fno-strict-aliasing -I../cracklib '-DCRACKLIB_DICTPATH="/usr/local/libdata/cracklib/pw_dict"' -o\ testnum testnum.o ../cracklib/libcrack.a cc -O2 -pipe -fno-strict-aliasing -I../cracklib '-DCRACKLIB_DICTPATH="/usr/local/libdata/cracklib/pw_dict"' -c teststr.c cc -O2 -pipe -fno-strict-aliasing -I../cracklib '-DCRACKLIB_DICTPATH="/usr/local/libdata/cracklib/pw_dict"' -o\ teststr teststr.o ../cracklib/libcrack.a cc -O2 -pipe -fno-strict-aliasing -I../cracklib '-DCRACKLIB_DICTPATH="/usr/local/libdata/cracklib/pw_dict"' -c testlib.c cc -O2 -pipe -fno-strict-aliasing -I../cracklib '-DCRACKLIB_DICTPATH="/usr/local/libdata/cracklib/pw_dict"' -o\ testlib testlib.o ../cracklib/libcrack.a touch all ===> Installing for cracklib-2.7_2 ===> Generating temporary packing list ===> Checking if security/cracklib already installed install -o root -g wheel -m 444 /usr/ports/security/cracklib/work/cracklib,2.7/cracklib/libcrack.a /usr/local/lib install -o root -g wheel -m 444 /usr/ports/security/cracklib/work/cracklib,2.7/cracklib/libcrack.so.1 /usr/local/lib /bin/ln -sf libcrack.so.1 /usr/local/lib/libcrack.so install -o root -g wheel -m 444 /usr/ports/security/cracklib/work/cracklib,2.7/cracklib/packer.h /usr/local/include install -o root -g wheel -m 555 /usr/ports/security/cracklib/work/cracklib,2.7/util/mkdict /usr/local/bin install -s -o root -g wheel -m 555 /usr/ports/security/cracklib/work/cracklib,2.7/util/packer /usr/local/bin install -s -o root -g wheel -m 555 /usr/ports/security/cracklib/work/cracklib,2.7/util/testlib /usr/local/bin install -s -o root -g wheel -m 555 /usr/ports/security/cracklib/work/cracklib,2.7/util/testnum /usr/local/bin install -s -o root -g wheel -m 555 /usr/ports/security/cracklib/work/cracklib,2.7/util/teststr /usr/local/bin install -s -o root -g wheel -m 555 /usr/ports/security/cracklib/work/cracklib,2.7/util/unpacker /usr/local/bin install -o root -g wheel -m 444 /usr/ports/security/cracklib/files/cracklib.3 /usr/local/man/man3 /bin/mkdir -p /usr/local/libdata/cracklib ( cd cracklib && make all && exit $? ) ( cd util && make DICTPATH="/usr/local/libdata/cracklib/pw_dict" && exit $? ) `all' is up to date. if "sort" dies from lack of space, see "util/mkdict" util/mkdict /usr/share/dict/words | util/packer "/usr/local/libdata/cracklib/pw_dict" 234407 234407 touch installed ===> Compressing manual pages for cracklib-2.7_2 ===> Running ldconfig /sbin/ldconfig -m /usr/local/lib ===> Registering installation for cracklib-2.7_2 ===> Returning to build of apg-2.3.0b_2 ===> Configuring for apg-2.3.0b_2 ===> Building for apg-2.3.0b_2 cc -O2 -pipe -fno-strict-aliasing -DAPG_USE_CRYPT -DAPG_USE_CRACKLIB '-DCRACKLIB_DICTPATH="/usr/local/libdata/cracklib/pw_dict"'\ -I/usr/local/include -L/usr/local/lib -o apg bloom.c ./sha/sha.c ./cast/cast.c rnd.c pronpass.c randpass.c restrict.c errors.c apg.c\ getopt.c convert.c -lm -lcrypt -lcrack cc -O2 -pipe -fno-strict-aliasing -DAPGBFM -o apgbfm apgbfm.c bloom.c sha/sha.c errors.c getopt.c convert.c -lm cc -O2 -pipe -fno-strict-aliasing -DCLISERV -DAPG_USE_CRACKLIB '-DCRACKLIB_DICTPATH="/usr/local/libdata/cracklib/pw_dict"'\ -I/usr/local/include -L/usr/local/lib -o apgd bloom.c ./sha/sha.c ./cast/cast.c rnd.c pronpass.c randpass.c restrict.c errors.c apg.c\ getopt.c convert.c -lm -lcrypt -lcrack freebsd# make install ===> Installing for apg-2.3.0b_2 ===> apg-2.3.0b_2 depends on shared library: crack.1 - found ===> Generating temporary packing list ===> Checking if security/apg already installed install -s -o root -g wheel -m 555 /usr/ports/security/apg/work/apg-2.3.0b/apg /usr/local/bin install -s -o root -g wheel -m 555 /usr/ports/security/apg/work/apg-2.3.0b/apgbfm /usr/local/bin install -s -o root -g wheel -m 555 /usr/ports/security/apg/work/apg-2.3.0b/apgd /usr/local/sbin install -o root -g wheel -m 444 /usr/ports/security/apg/work/apg-2.3.0b/doc/man/apg.1 /usr/local/man/man1 install -o root -g wheel -m 444 /usr/ports/security/apg/work/apg-2.3.0b/doc/man/apgbfm.1 /usr/local/man/man1 install -o root -g wheel -m 444 /usr/ports/security/apg/work/apg-2.3.0b/doc/man/apgd.8 /usr/local/man/man8 /bin/mkdir -p /usr/local/share/doc/apg install -o root -g wheel -m 444 /usr/ports/security/apg/work/apg-2.3.0b/doc/APG_TIPS\ /usr/ports/security/apg/work/apg-2.3.0b/doc/pronun.txt /usr/ports/security/apg/work/apg-2.3.0b/doc/rfc0972.txt\ /usr/ports/security/apg/work/apg-2.3.0b/doc/rfc1750.txt /usr/local/share/doc/apg ===> Compressing manual pages for apg-2.3.0b_2 ===> Registering installation for apg-2.3.0b_2 freebsd#
使い方
man ページから。
SYNOPSIS
apg [-a algorithm] [-M mode] [-E char_string] [-n num_of_pass] [-m
min_pass_len] [-x max_pass_len] [-r dictfile] [-b filter_file] [-p
min_substr_len] [-s] [-c cl_seed] [-d] [-y] [-l] [-t] [-k] [-q] [-h]
[-v]
OPTIONS
Password generation modes options
-a algorithm
use algorithm for password generation.
0 - (default) pronounceable password generation
1 - random character password generation
-n num_of_pass
generate num_of_pass number of passwords. Default is 6.
-m min_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.
-x max_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.
-M mode
Use symbolsets specified with mode for password generation.
mode is a text string consisting of characters S, s, N, n, C, c,
L, l. Where:
S generator must use special symbol set for every generated
password.
s generator should use special symbol set for password gen-
eration.
N generator must use numeral symbol set for every generated
password.
n generator should use numeral symbol set for password gen-
eration.
C generator must use capital symbol set for every generated
password.
c generator should use capital symbol set for password gen-
eration.
L generator must use small letters symbol set for every
generated password (always present if pronounceable pass-
word generation algorithm is used).
l generator should use small letters symbol set for pass-
word generation.
R,r not supported any more. Use -E char_string option
instead.
mode can not be more than 4 characters in length.
Note:
Usage of L, M, N, C will slow down password generation process.
Examples:
-M sncl or -M SNCL or -M Cn
-E char_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 -a 1 -M n -n 3 -m 8 -E 23456789 will generate a set
of passwords that will look like this
10100110
01111000
11011101
Command apg -a 1 -M nc -n 3 -m 26 -E GHIJKLMNOPQRSTUVWXYZ will
generate a set of passwords that will look like this
16A1653CD4DE5E7BD9584A3476
C8F78E06944AFD57FB9CB882BC
8C8DF37CD792D36D056BBD5002
Password quality control options
-k check every generated password using cracklib. To use this abil-
ity you must enable cracklib support during programm building.
-r dictfile
check generated passwords for their appearance in dictfile
-b filter_file
check generated passwords for their appearance in filter_file.
filter_file should be created with apgbfm(1) utility.
-p min_substr_len
this option tells apg(1) to check every substring of the gener-
ated password for appearance in filter_file. If any of such sub-
strings would be found in the filter_file then generated pass-
word 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.
Pseudo random number generator options
-s ask user for random sequence for password generation
-c cl_seed
use cl_seed as a random seed for password generation. I use it
when i have to generate passwords in a shell script.
Password output options
-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 man
crypt(3))
-q quiet mode (do not print warnings)
-l spell genetated passwords. Useful when you want to read gener-
ated password by telephone.
WARNING: Think twice before read your password by phone.
-t print pronunciation for generated pronounceable password
-h print help information and exit
-v print version information and exit
DEFAULT OPTIONS
apg -a 0 -M sncl -n 6 -x 10 -m 8 (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 -m 8 -x 12 -s
[ end ]----> pwgen.sh
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.
DIAGNOSTICS
If /dev/random is not available, apg will display a message about it.
FILES
None.
BUGS
None. If you've found one, please send bug description to the author.
SEE ALSO
apgd(8), apgbfm(1)
AUTHOR
Adel I. Mirzazhanov, <a-del@iname.com>
Project home page: http://www.adel.nursat.kz/apg/
となっている。実例として、当社でいつも使っているパスワード生成ルールに従って出力してみる。(英大文字・英小文字・数字を必須として、8桁以上のもの)
freebsd# ./apg -a 1 -n 1 -m 8 -x 24 -M NCL -k -r /usr/share/dict/words.english I0jxbeqVywqRzDyjqnL freebsd#
-l で、発音表記も付けられる。(電話で伝えるときに・・・と書かれているが、もちろんそのすぐ後に書かれているように、電話でパスワードを伝えるなんてことをするなら、よく周りに注意しましょう。)
freebsd# ./apg -a 1 -n 1 -m 8 -x 24 -M NCL -k -r /usr/share/dict/words.english -l 4slvmnZm FOUR-sierra-lima-victor-mike-november-Zulu-mike freebsd#
csh (FreeBSD には、最初から bash は入っていない) でファイルに出力する場合は、以下のとおり。
#!/bin/csh /usr/local/bin/apg -a 1 -n 1 -m 8 -x 24 -M NCL -k -r /usr/share/dict/words.english >> passwd.txt
リンク
- セキュリティ関連メモ のトップページへ
- メインページへ