web-dev-qa-db-ja.com

SSH:2要素認証

私は現在、Ubuntu Server 12.04でOpenSSHを実行しており、Sambaといくつかの他のサービスも一緒に実行しています。現在、公開鍵認証を設定していますが、2要素認証を設定することは可能ですか?現在、Gmailアカウントで使用しているGoogle認証システムを確認しています。

互換性があるように見えるPAMモジュールを見つけましたが、パスワードと生成されたコードを使用せざるを得ないようです。

SSHサーバーへの認証に公開鍵と一緒にGoogle認証システムアプリケーション(または類似のもの)を使用する方法があるかどうか疑問に思っていますか?

30
Concrete Donkey

Red Hatは、RHEL(およびCentOS)6.3のOpenSSHにパッチを追加して、複数の認証メカニズムを必要とするようにしたので、次のようなことができます。

RequiredAuthentications2 publickey,keyboard-interactive

詳細については リリースノート を参照してください。

残念ながら、この機能はOpenSSHアップストリームにもUbuntu 12.04にもないようです。そのため、パッチを見つけてOpenSSHを再コンパイルしない限り、運が悪いと思います。

8
mgorven

あなたが探している Duo Security

8
Ajith

Google Authenticator PAMモジュールと公開鍵の両方を使用できますが、特定の認証に使用されるのは一度に1つだけです。つまり、ユーザーが承認済みの公開鍵でログインする場合、トークンは必要ありません。

または、別の言い方をすると、トークンはパスワード認証にのみ必要で、SSHキーには必要ありません。

ちなみにこの制限は、Google Authenticatorモジュールによるものではなく、PAMに対して(ChallengeResponseAuthenticationを介した)2要素認証のみを実装するSSHによるものですが、有効な公開鍵が提供されている場合はPAMを呼び出しません。

5
ℝaphink

この質問は2012年からです。それ以来、SSHが変更され、SSH2プロトコルが実装されました。

SSHの最新バージョン(> = 6.2)では、man sshd_configは次のように述べています。

AuthenticationMethods
       Specifies the authentication methods that must be successfully completed for a user to be
       granted access.  This option must be followed by one or more comma-separated lists of
       authentication method names.  Successful authentication requires completion of every method
       in at least one of these lists.

       For example, an argument of ``publickey,password publickey,keyboard-interactive'' would
       require the user to complete public key authentication, followed by either password or key-
       board interactive authentication.  Only methods that are next in one or more lists are
       offered at each stage, so for this example, it would not be possible to attempt password or
       keyboard-interactive authentication before public key.

       This option is only available for SSH protocol 2 and will yield a fatal error if enabled if
       protocol 1 is also enabled.  Note that each authentication method listed should also be
       explicitly enabled in the configuration.  The default is not to require multiple authentica-
       tion; successful completion of a single authentication method is sufficient.

このページ http://lwn.net/Articles/544640/ では、公開鍵とPAM認証を同時に使用する可能性についても触れています。

3
liquidity

私はこの質問が少し古いことを知っていますが、解決策を探している将来の人々(私も含む)のために、sshd_configファイルのForceCommandオプションを使用して、認証を実行するスクリプトを実行することについての話もあります。スクリプトの例があります here ニーズに合わせて少し変更できますが、その例では、sshd_configのForceCommandでシステム全体に適用するのではなく、authorized_keysファイルからスクリプトを呼び出します。

2
Amazingant

YubiKeyを入手してこのガイドに従ってください http://berrange.com/posts/2011/12/18/multi-factor-ssh-authentication-using-yubikey-and-ssh-public-keys-together/

私の知る限り、これはSSHアクセスのためにサーバーにYubikeyを実装する最良の方法です。上記のガイドでは、公開キー+ユビキーを使用できますが、公式ガイド( http://code.google.com/p/yubico-pam/wiki/YubikeyAndSSHViaPAM )を使用する場合は、公開鍵では機能しません。

よろしく、VIP

1
vagarwal

秘密鍵にパスフレーズを設定した場合、すでに2要素認証が行われています。ログインするには、次のものが必要です。

  1. あなたが持っているもの-あなたの秘密鍵
  2. 知っていること-秘密鍵のパスフレーズ
0
Bart B