【问题标题】:How can I create a pem file + google-authenticator access to Amazon EC2?如何创建对 Amazon EC2 的 pem 文件 + google-authenticator 访问权限?
【发布时间】:2015-10-01 11:15:34
【问题描述】:

我正在尝试为 Amazon EC2 Ubuntu 实例创建一个身份验证过程,该过程需要使用由 Amazon 生成的密钥对并使用 Google-Authenticator。因此,我想使用我的 pem 文件登录到实例,然后使用验证码提示进行提示。

Verification code:

我已经设法使用我的 pem 文件登录到我的服务器。我还成功安装了 Google-Authenticator,并使用它以我创建并提供特定密码的单独用户(不是 ubuntu)登录。

在我的/etc/ssh/sshd_config 我有:

ChallengeResponseAuthentication yes
PasswordAuthentication no
UsePAM yes
AuthenticationMethods keyboard-interactive

在我的/etc/pam.d/sshd:

@include common-auth
auth required pam_google_authenticator.so

如果我将publickey 添加到AuthenticationMethods,那么在登录时会提示我输入密码,而不是使用我在其中提供的 pem 文件:

ssh -i my-key.pem ubuntu@*.*.*.*

如何让 OpenSSH 通过 pem 文件进行身份验证 --> google-authenticator?

谢谢!

【问题讨论】:

    标签: authentication amazon-web-services amazon-ec2 openssh sshd


    【解决方案1】:

    我的解决方案是通过pem 文件、密码和验证 OTP 进行检查。为此我有:

    在:/etc/pam.d/sshd/

    @include common-auth
    auth required pam_sepermit.so
    auth required pam_google_authenticator.so
    

    在:/etc/ssh/sshd_config/

    AuthenticationMethods publickey,keyboard-interactive
    

    其余配置如上所述。注意publickeyAuthenticationMethods中要在keyboard-interactive之前,否则先验证码后pem文件检查。

    【讨论】:

      猜你喜欢
      • 2020-01-14
      • 1970-01-01
      • 2017-10-24
      • 2019-05-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多