「Universal 2nd Factor」の版間の差分

提供: ArchWiki
ナビゲーションに移動 検索に移動
42行目: 42行目:
 
$ pamu2fcfg -o pam://hostname -i pam://hostname -n >> ~/.config/Yubico/u2f_keys
 
$ pamu2fcfg -o pam://hostname -i pam://hostname -n >> ~/.config/Yubico/u2f_keys
   
=== Passwordless sudo ===
+
=== パスワードなしの sudo ===
   
  +
{{Warning|設定に変更を加える前に、root 権限で別のシェルを開始してください。(例 {{ic|sudo -s}})。このようにすることで、問題が発生した場合に変更を元に戻すことができます。}}
{{Warning|Before making any changes to your configuration, start a separate shell with root permissions (e.g. {{ic|sudo -s}}). This way you can revert any changes if something goes wrong.}}
 
   
Open {{ic|/etc/pam.d/sudo}} and add
+
{{ic|/etc/pam.d/sudo}} を開いて、以下を追加
   
 
auth sufficient pam_u2f.so origin=pam://hostname appid=pam://hostname
 
auth sufficient pam_u2f.so origin=pam://hostname appid=pam://hostname
   
  +
1行目の記述します。前述の {{ic|hostname}} は必ず書きかえてください。次に、新しいターミナルを起動し、{{ic|sudo ls}} と入力します。キーの LED が点滅し、それをクリックするとコマンドが実行されます。
as the first line. Be sure to replace the {{ic|hostname}} as mentioned above. Then create a new terminal and type {{ic|sudo ls}}. Your key's LED should flash and after clicking it the command is executed.
 
   
 
=== GDM login ===
 
=== GDM login ===

2021年7月12日 (月) 11:12時点における版

Universal 2nd Factor (U2F) はスマートカードと同様のセキュリティ技術に基づいて、専用の USB または NFC デバイスを使用した二要素認証 (2FA) を強化、簡素化するためのオープンスタンダードです。

当初は Google と Yubico が開発し、NXP セミコンダクターズが貢献していましたが、現在は、FIDO アライアンスがホストしています。

U2F および U2F-devices については、Category:Universal 2nd Factor も参照してください。

Web サイトの認証

U2F は、Google、Facebook、Twitter、Github などの主要なサイトでサポートされています。twofactorauth.org または dongleauth.info には他のサイトや設定資料へのリンクがありますのでご確認ください。サポートしている全てのブラウザでは、 libfido2 をインストールするだけでよいでしょう。Yubico はテスト用に demo page を提供しています。

Firefox

Firefox 設定#​Fido U2F 認証

Chromium/Chrome

Chromium 設定#U2F 認証

Arch Linux の認証

YubiKey を開発した Yubico 社は、U2F PAM モジュールを開発しました。U2F PAM モジュールは、ログイン時の二番目の要素として、またはパスワードを完全に置き換えるために使用することができます。

PAM モジュールのインストール

このモジュールは、pam-u2f パッケージの一部です。

鍵の追加

鍵は pamu2fcfg ツールで追加する必要があります:

$ mkdir ~/.config/Yubico
$ pamu2fcfg -o pam://hostname -i pam://hostname > ~/.config/Yubico/u2f_keys

U2F キーのボタンをクリックして、鍵を確認します。

ノート: 異なるネットワークの DHCP などが原因で、システムのホスト名が変更された場合、ログインできなくなります。これを防ぐために、上記のオプションを指定し、hostname を実際のホスト名に置き換えることをお勧めします。

複数の鍵を所有している場合は、それらを追加してください

$ pamu2fcfg -o pam://hostname -i pam://hostname -n >> ~/.config/Yubico/u2f_keys

パスワードなしの sudo

警告: 設定に変更を加える前に、root 権限で別のシェルを開始してください。(例 sudo -s)。このようにすることで、問題が発生した場合に変更を元に戻すことができます。

/etc/pam.d/sudo を開いて、以下を追加

auth            sufficient      pam_u2f.so origin=pam://hostname appid=pam://hostname

1行目の記述します。前述の hostname は必ず書きかえてください。次に、新しいターミナルを起動し、sudo ls と入力します。キーの LED が点滅し、それをクリックするとコマンドが実行されます。

GDM login

Open /etc/pam.d/gdm-password and add

auth            required      pam_u2f.so nouserok origin=pam://hostname appid=pam://hostname

after the existing auth lines. Please note the use of the nouserok option which allows the rule to fail if the user did not configure a key. This way setups with multiple users where only some of them use a U2F key are supported.

ノート: This method will not work with encrypted home partitions because the decryption is not done before the login process completed, so the u2f_keys file is unavailable. In this case use a central mapping file as explained in the official documentation of pam-u2f.

Other authentication methods

Enable the PAM module for other services like explained above. For example, to secure the screensaver of Cinnamon, edit /etc/pam.d/cinnamon-screensaver.

Troubleshooting

If you managed to lock yourself out of the system, boot into recovery mode or from a USB pen drive. Then revert the changes in the PAM config and reboot.

OpenSSH

OpenSSH supports FIDO/U2F hardware tokens natively since 8.2. Both the client and server must support the ed25519-sk key types. Generate a security key backed key pair with:

$ ssh-keygen -t ecdsa-sk
ノート: If you are using a Yubikey, firmware version 5.2.3 is needed for the ed25519-sk key type.