我目前有一个运行OpenSSH的Ubuntu Server 12.04以及Samba和其他一些服务。 在目前我有公钥authentication设置,我想知道是否有可能设置双因素authentication? 我一直在寻找Google Authenticator,我目前使用的是我的Gmail帐户。
我发现一个PAM模块,看起来像它将兼容,但似乎你被迫使用密码和生成的代码。
我想知道是否有方法使用Google Authenticator应用程序(或类似的)与我的公钥一起validation到我的SSH服务器?
红帽在RHEL(也就是CentOS)6.3中为OpenSSH添加了一个补丁程序,要求使用多重身份validation机制,所以你可以这样做:
RequiredAuthentications2 publickey,keyboard-interactive
有关更多详细信息,请参阅发行说明 。
不幸的是,这个function似乎不在OpenSSH上游,也不在Ubuntu 12.04中,所以除非你想find补丁并重新编译OpenSSH,恐怕你运气不好。
您正在寻找Duo Security
您可以同时使用Google身份validation器PAM模块和公钥,但是当前只能使用一个用于给定身份validation。 也就是说,如果用户使用授权的公钥login,则不需要令牌。
或者说,否则:令牌只需要密码validation,而不是SSH密钥。
这个限制并不是来自Google Authenticator模块,而是来自SSH,它只为PAM提供双因素authentication(通过ChallengeResponseAuthentication
),但是在提供有效的公钥时不会调用PAM。
这个问题是从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/也提到了同时使用publickey和PAMauthentication的可能性。
我知道这个问题有点陈旧,但是为了寻求解决scheme的未来人士(也包括我自己),也有人谈论在sshd_config文件中使用ForceCommand选项来运行脚本,然后执行身份validation。 这里有一个脚本示例,您可以根据自己的需要进行修改,尽pipe在这个例子中,他是从authorized_keys文件中调用它,而不是使用sshd_config的ForceCommand在系统范围内调用它。
获取YubiKey并遵循本指南http://berrange.com/posts/2011/12/18/multi-factor-ssh-authentication-using-yubikey-and-ssh-public-keys-together/
AFAIK,这是最好的方式来实现您的服务器上的Yubikey SSH访问。 上面的指南使你可以使用public-key + yubikey,而如果你使用的是官方指南( http://code.google.com/p/yubico-pam/wiki/YubikeyAndSSHViaPAM ),它不适用于public-键。
问候,贵宾
如果您在私钥上设置了密码,那么您已经有了双重身份validation。 为了login人们需要: