pwgenは特定の長さのパスワードを出力できますか?


9

コマンドラインツールpwgenを使用してパスワードを生成しています。これは、sha1コマンドラインフラグを使用した場合の再現性が気に入っているためです。manページを引用するには:

   -H, --sha1=/path/to/file[#seed]
          Will  use the sha1's hash of given file and the optional seed to
          create password. It will allow you to compute the same  password
          later, if you remember the file, seed, and pwgen's options used.
          ie: pwgen -H ~/your_favorite.mp3#your@email.com gives a list  of
          possibles  passwords for your pop3 account, and you can ask this
          list again and again.

          WARNING: The passwords generated using this option are not  very
          random.   If you use this option, make sure the attacker can not
          obtain a copy of the file.  Also, note that the name of the file
          may  be  easily available from the ~/.history or ~/.bash_history
          file.

これを使用して、次のようなパスワードを生成(および取得)します。

pwgen -1cnsy --sha1=/path/to/my/gpg/private-key.asc#username@example.com

唯一の問題は、パスワードに必要な文字数を指定する方法がわからないことです。デフォルトでは8文字のパスワードを生成します。これはブルートフォース攻撃の影響を受けやすくなります。

または、apg文字数を指定できるを使用することもできますapgが、ファイルと文字列をシードとして使用して繰り返し可能な文字を取得する方法がわかりません。

pwgen指定した長さのパスワードを生成する方法はありますか?


このような秘密鍵を使用すると、危険にさらされます。変更されないランダムファイルを使用することをお勧めします(彼らが言及するMP3など)。または、このアドバイスを使用してください(文字通りではありません!)。
フォンブランド2013年

このような秘密キーを使用すると、どのように危険にさらされますか?暗号は元に戻せませんよね?
ケリック

破壊される可能性のあるプログラムによって読み取られています。リスクは最小限ですが、なぜリスクを冒すのか...
フォンブランド2013年

回答:


11

Usage: pwgen [ OPTIONS ] [ pw_length ] [ num_pw ]

したがって:

pwgen -1cnsy --sha1=/path/to/my/gpg/private-key.asc#username@example.com 42

pwgen要求した長さのパスワードを喜んで出力しますが、セキュリティを向上させない特定のポイント(指定されたファイルのエントロピーによって決定される)を超えることに注意してください。


1
私は... manページの上部にある使用例をざっと見るのをやめる必要があります。残りのmanページを注意深く調べました。ありがとう!
ケリック
弊社のサイトを使用することにより、あなたは弊社のクッキーポリシーおよびプライバシーポリシーを読み、理解したものとみなされます。
Licensed under cc by-sa 3.0 with attribution required.