
Yubikeyトークンまたはパスワードを使用してログインできるように、Linux Mint 19.3にパスワードのないログインを設定しようとしています。以下の指示に従いました。ユビックウェブサイトそしてこのスレッド、しかし、動作させることはできません。
簡単に言えば、私がしたことは次のとおりです。
sudo pamu2fcfg -u `whoami` > /etc/Yubico/u2f_keys
存在する/etc/pam.d/私が作る汎用-u2f次のコンテンツが含まれています。
auth sufficient pam_u2f.so authfile=/etc/Yubico/u2f_keys debug debug_file=/var/log/pam_u2f.log authpending_file=/etc/Yubico/pam-u2f-authpending
追加しました
今後@include common-u2f
次のファイルから:光DM、Sudo、ログイン、シナモンスクリーンセーバー@include common-auth
これで command を使用してsudo
画面のロックを解除し、Yubikey のみを使用してログインできるようになります(ログアウト後にのみ)。しかし、再起動後にログインしようとすると、奇妙な現象が発生します。 Yubikey Flashに火が入ってくるのを見てタップすると、デスクトップが出てくるように画面が黒く変わり、再びログイン画面に戻ります。したがって、デフォルトでYubikeyを使用しようとすると、ログインループになります。これを削除するには、トークンを削除してパスワードを使用します。
デバッグログを見ると、それが私を2回認証しようとしていることがわかりました。最初は動作しますが、2番目はu2fデバイスが見つからないと文句を言います。再起動後にpam_u2f.soモジュールを2回呼び出す理由がわかりません。 sudo、画面のロック解除、およびログイン(ログアウト後)の場合は、期待どおりに一度だけ呼び出します。デバッグログの内容は次のとおりです。
debug(pam_u2f): ../pam-u2f.c:99 (parse_cfg): called.
debug(pam_u2f): ../pam-u2f.c:100 (parse_cfg): flags 0 argc 4
debug(pam_u2f): ../pam-u2f.c:102 (parse_cfg): argv[0]=authfile=/etc/Yubico/u2f_keys
debug(pam_u2f): ../pam-u2f.c:102 (parse_cfg): argv[1]=debug
debug(pam_u2f): ../pam-u2f.c:102 (parse_cfg): argv[2]=debug_file=/var/log/pam_u2f.log
debug(pam_u2f): ../pam-u2f.c:102 (parse_cfg): argv[3]=authpending_file=/etc/Yubico/pam-u2f-authpending
debug(pam_u2f): ../pam-u2f.c:104 (parse_cfg): max_devices=0
debug(pam_u2f): ../pam-u2f.c:105 (parse_cfg): debug=1
debug(pam_u2f): ../pam-u2f.c:106 (parse_cfg): interactive=0
debug(pam_u2f): ../pam-u2f.c:107 (parse_cfg): cue=0
debug(pam_u2f): ../pam-u2f.c:108 (parse_cfg): nodetect=0
debug(pam_u2f): ../pam-u2f.c:109 (parse_cfg): manual=0
debug(pam_u2f): ../pam-u2f.c:110 (parse_cfg): nouserok=0
debug(pam_u2f): ../pam-u2f.c:111 (parse_cfg): openasuser=0
debug(pam_u2f): ../pam-u2f.c:112 (parse_cfg): alwaysok=0
debug(pam_u2f): ../pam-u2f.c:113 (parse_cfg): authfile=/etc/Yubico/u2f_keys
debug(pam_u2f): ../pam-u2f.c:114 (parse_cfg): authpending_file=/etc/Yubico/pam-u2f-authpending
debug(pam_u2f): ../pam-u2f.c:115 (parse_cfg): origin=(null)
debug(pam_u2f): ../pam-u2f.c:116 (parse_cfg): appid=(null)
debug(pam_u2f): ../pam-u2f.c:117 (parse_cfg): prompt=(null)
debug(pam_u2f): ../pam-u2f.c:169 (pam_sm_authenticate): Origin not specified, using "pam://host1"
debug(pam_u2f): ../pam-u2f.c:181 (pam_sm_authenticate): Appid not specified, using the same value of origin (pam://host1)
debug(pam_u2f): ../pam-u2f.c:192 (pam_sm_authenticate): Maximum devices number not set. Using default (24)
debug(pam_u2f): ../pam-u2f.c:210 (pam_sm_authenticate): Requesting authentication for user user1
debug(pam_u2f): ../pam-u2f.c:221 (pam_sm_authenticate): Found user user1
debug(pam_u2f): ../pam-u2f.c:222 (pam_sm_authenticate): Home directory for user1 is /home/user1
debug(pam_u2f): ../pam-u2f.c:271 (pam_sm_authenticate): Using authentication file /etc/Yubico/u2f_keys
debug(pam_u2f): ../util.c:105 (get_devices_from_authfile): Authorization line: user1:
debug(pam_u2f): ../util.c:110 (get_devices_from_authfile): Matched user: user1
debug(pam_u2f): ../util.c:137 (get_devices_from_authfile): KeyHandle for device number 1:
debug(pam_u2f): ../util.c:156 (get_devices_from_authfile): publicKey for device number 1:
debug(pam_u2f): ../util.c:167 (get_devices_from_authfile): Length of key number 1 is 65
debug(pam_u2f): ../util.c:137 (get_devices_from_authfile): KeyHandle for device number 2:
debug(pam_u2f): ../util.c:156 (get_devices_from_authfile): publicKey for device number 2:
debug(pam_u2f): ../util.c:167 (get_devices_from_authfile): Length of key number 2 is 65
debug(pam_u2f): ../util.c:194 (get_devices_from_authfile): Found 2 device(s) for user user1
debug(pam_u2f): ../pam-u2f.c:340 (pam_sm_authenticate): Using file '/etc/Yubico/pam-u2f-authpending' for emitting touch request notifications
debug(pam_u2f): ../util.c:277 (do_authentication): Device max index is 0
debug(pam_u2f): ../util.c:311 (do_authentication): Attempting authentication with device number 1
debug(pam_u2f): ../util.c:335 (do_authentication): Challenge: { "keyHandle": "", "version": "U2F_V2", "challenge": "", "appId": "pam:\/\/host1" }
debug(pam_u2f): ../util.c:349 (do_authentication): Response: { "signatureData": "", "clientData": "" }
debug(pam_u2f): ../pam-u2f.c:410 (pam_sm_authenticate): done. [Success]
debug(pam_u2f): ../pam-u2f.c:99 (parse_cfg): called.
debug(pam_u2f): ../pam-u2f.c:100 (parse_cfg): flags 0 argc 4
debug(pam_u2f): ../pam-u2f.c:102 (parse_cfg): argv[0]=authfile=/etc/Yubico/u2f_keys
debug(pam_u2f): ../pam-u2f.c:102 (parse_cfg): argv[1]=debug
debug(pam_u2f): ../pam-u2f.c:102 (parse_cfg): argv[2]=debug_file=/var/log/pam_u2f.log
debug(pam_u2f): ../pam-u2f.c:102 (parse_cfg): argv[3]=authpending_file=/etc/Yubico/pam-u2f-authpending
debug(pam_u2f): ../pam-u2f.c:104 (parse_cfg): max_devices=0
debug(pam_u2f): ../pam-u2f.c:105 (parse_cfg): debug=1
debug(pam_u2f): ../pam-u2f.c:106 (parse_cfg): interactive=0
debug(pam_u2f): ../pam-u2f.c:107 (parse_cfg): cue=0
debug(pam_u2f): ../pam-u2f.c:108 (parse_cfg): nodetect=0
debug(pam_u2f): ../pam-u2f.c:109 (parse_cfg): manual=0
debug(pam_u2f): ../pam-u2f.c:110 (parse_cfg): nouserok=0
debug(pam_u2f): ../pam-u2f.c:111 (parse_cfg): openasuser=0
debug(pam_u2f): ../pam-u2f.c:112 (parse_cfg): alwaysok=0
debug(pam_u2f): ../pam-u2f.c:113 (parse_cfg): authfile=/etc/Yubico/u2f_keys
debug(pam_u2f): ../pam-u2f.c:114 (parse_cfg): authpending_file=/etc/Yubico/pam-u2f-authpending
debug(pam_u2f): ../pam-u2f.c:115 (parse_cfg): origin=(null)
debug(pam_u2f): ../pam-u2f.c:116 (parse_cfg): appid=(null)
debug(pam_u2f): ../pam-u2f.c:117 (parse_cfg): prompt=(null)
debug(pam_u2f): ../pam-u2f.c:169 (pam_sm_authenticate): Origin not specified, using "pam://host1"
debug(pam_u2f): ../pam-u2f.c:181 (pam_sm_authenticate): Appid not specified, using the same value of origin (pam://host1)
debug(pam_u2f): ../pam-u2f.c:192 (pam_sm_authenticate): Maximum devices number not set. Using default (24)
debug(pam_u2f): ../pam-u2f.c:210 (pam_sm_authenticate): Requesting authentication for user user1
debug(pam_u2f): ../pam-u2f.c:221 (pam_sm_authenticate): Found user user1
debug(pam_u2f): ../pam-u2f.c:222 (pam_sm_authenticate): Home directory for user1 is /home/user1
debug(pam_u2f): ../pam-u2f.c:271 (pam_sm_authenticate): Using authentication file /etc/Yubico/u2f_keys
debug(pam_u2f): ../util.c:105 (get_devices_from_authfile): Authorization line: user1:
debug(pam_u2f): ../util.c:110 (get_devices_from_authfile): Matched user: user1
debug(pam_u2f): ../util.c:137 (get_devices_from_authfile): KeyHandle for device number 1:
debug(pam_u2f): ../util.c:156 (get_devices_from_authfile): publicKey for device number 1:
debug(pam_u2f): ../util.c:167 (get_devices_from_authfile): Length of key number 1 is 65
debug(pam_u2f): ../util.c:137 (get_devices_from_authfile): KeyHandle for device number 2:
debug(pam_u2f): ../util.c:156 (get_devices_from_authfile): publicKey for device number 2:
debug(pam_u2f): ../util.c:167 (get_devices_from_authfile): Length of key number 2 is 65
debug(pam_u2f): ../util.c:194 (get_devices_from_authfile): Found 2 device(s) for user user1
debug(pam_u2f): ../pam-u2f.c:340 (pam_sm_authenticate): Using file '/etc/Yubico/pam-u2f-authpending' for emitting touch request notifications
debug(pam_u2f): ../util.c:271 (do_authentication): Unable to discover device(s), cannot find U2F device
debug(pam_u2f): ../pam-u2f.c:371 (pam_sm_authenticate): do_authentication returned -2
debug(pam_u2f): ../pam-u2f.c:410 (pam_sm_authenticate): done. [Authentication failure]
ログに示すように、私を2回認証しようとしました。理由はわかりません。どんな助けでも大変感謝します!
答え1
徹底的な調査とデバッグの終わりに、私は非常に単純な事実に気づきました。ホームフォルダが暗号化されているため、パスワードのないログインは機能しません。私のパスワードでのみ復号化でき、Linuxは実際のパスワードをどこにも保存しないため(ハッシュのみ)、再起動後にログインするときにパスワードを提供する必要があります。しかし、これは、ログアウトした後にYubikeyを使用してログインし、一般認証PAMファイルに依存する他のコマンドを使用できる理由を説明します。
答え2
私はこれがこのアプローチのスタイルでなければならないと思います。 https://github.com/agherzan/yubikey-full-disk-encryption
パスワードを入力すると、ホームフォルダディレクトリに必要なハッシュを解放する必要があるため、キーを使用した後も同じ方法を使用する必要があります。
インストール後に家を暗号化するときにこの記事を見てください。 https://www.linuxupising.com/2018/04/how-to-encrypt-home-folder-in-ubuntu.html
ステップ5でキーを取得できます。回復パスワードを印刷して記録してください。
鍵の後に開梱を「再ルーティング」することが可能でなければならないと思います。そうしないと、家を鍵で暗号化する必要がありますが、鍵を紛失するとパスワードでログインできなくなります。パスワードとU2Fキーの両方を復号できる場合は、非対称キーを使用して自宅を暗号化することが可能であると思います。
方法を教えるLinuxセキュリティの専門家が必要です。、おそらくここ https://blog.rtwm.io/2021/03/complete-u2f-yubikey-linux-mint-20-login-with-encrypted-home-folders/
結局は解決しそうだ
ファイルを読む/etc/pam.d/common-auth
その一部は
# and here are more per-package modules (the "Additional" block)
auth optional pam_ecryptfs.so unwrap
これは...pam_ecryptfs.so unwrap
ホームフォルダに関する可能性が高いので、
auth required pam_u2f.so authfile={your-non-home-location}
それの前に... pam_ecryptfs.so unwrap
続く…