我目前有一个运行 OpenSSH 的 Ubuntu Server 12.04 以及 Samba 和其他一些服务。目前我已经设置了公钥身份验证,我想知道是否可以设置两因素身份验证?我一直在查看目前与我的 Gmail 帐户一起使用的 Google 身份验证器。
我发现了一个看起来兼容的 PAM 模块,但似乎您被迫使用密码和生成的代码。
我想知道是否有一种方法可以使用 Google 身份验证器应用程序(或类似的东西)和我的公钥来对我的 SSH 服务器进行身份验证?
我使用的是 Ubuntu 14.04.1(使用 OpenSSH 6.6 和 libpam-google-authenticator 20130529-2)。
我正在尝试设置 SSH 登录,其中公钥进行身份验证(没有密码),并提示用户输入来自 Google 身份验证器的代码。
遵循/调整这些说明后,我收到了密码提示和 Google 身份验证提示:
我已经安装了软件包,编辑了我的/etc/ssh/sshd_config和/etc/pam.d/ssh文件
在/etc/ssh/sshd_config:
ChallengeResponseAuthentication yes
AuthenticationMethods publickey,keyboard-interactive
UsePAM yes
Run Code Online (Sandbox Code Playgroud)
并在底部/etc/pam.d/ssh:
auth required pam_google_authenticator.so nullok # (I want to give everyone a chance to set up their 2FA before removing "nullok")
Run Code Online (Sandbox Code Playgroud)
我知道 PAM 是顺序相关的,但sshd_config也是?
我究竟做错了什么?任何帮助,将不胜感激。
所以我有这个漂亮的小 yubikey,我想在验证 ssh 会话时添加一个额外的安全层。在服务器端,我已经禁用了密码验证,并且只允许在登录时使用 ssh 密钥。
问题是,在为 yubikey auth 配置 sshd 和 PAM 之后,sshd 仍然只需要一个 ssh 密钥,我从未被要求提供来自 yubikey 的响应。
我如何同时需要ssh 密钥和yubikey?
(ubuntu 14.04 - trusty)
/etc/pam.d/common-auth:
auth required pam_yubico.so mode=client try_first_pass id=<id> key=<secret>
auth [success=1 default=ignore] pam_unix.so nullok_secure try_first_pass
# here's the fallback if no module succeeds
auth requisite pam_deny.so
# prime the stack with a positive return value if there isn't one already;
# this avoids us returning an error just because nothing sets …Run Code Online (Sandbox Code Playgroud) 我有一个 Ubuntu 服务器,它有一个私有的、内部的、IP 和一个面向公众的 IP。我想在公共端为 SSH 设置两因素身份验证。这可能吗?我计划使用 Google Authenticator,但我也愿意接受其他想法。
在我当前的环境中,我的所有 Linux 服务器只能通过启用 MFA 的堡垒主机访问。
我已经设法让 Ansible 通过堡垒成功地与服务器通信,唯一的问题是它为每个主机建立了一个到堡垒的新连接,这意味着我必须输入与服务器一样多的 MFA 密钥。艰难时期。:(
我试过在我的 ssh 配置中搞乱这样的东西,试图让多路复用工作:
Host bastion
ControlMaster auto
ControlPath ~/.ssh/ansible-%r@%h:%p
ControlPersist 5m
Run Code Online (Sandbox Code Playgroud)
不幸的是,它似乎并没有这样做。任何人都知道如何阻止 Ansible 通过我的堡垒主机为它接触的每个主机重新建立连接?
谢谢!
我需要在 EC2 上为金融机构托管东西。银行想要完整的双因素身份验证,例如使用带有密码的密钥的 SSH。像 SecureID 或类似的东西会很棒。如何通过 SSH 有效地创建到我的 EC2 环境的两因素身份验证?
我也可以将 OpenVPN 视为双因素加密的一部分吗?
我有一个中央服务器,我将所有私有 ssh 密钥存储到我想要 ssh 到的不同机器上。目前,只有系统管理员可以访问这个“中央”服务器。
鉴于上述情况,我想提出以下问题:
我想知道是否可以同时完成以下操作:
使用中的Match块sshd_config我能够设置它,以便PasswordAuthentication除了非特权用户(让我们称之为peon)之外,通常被禁用。登录个人用户(具有 sudo 功能)需要 SSH 密钥。
然而,当我尝试启用双因素身份验证(pam_google_authenticator)我有打开ChallengeResponseAuthentication这似乎不是一个工作Match块,并因此开启了大家的密码验证回来。
有没有办法做到这一点?我对这种类型的东西并不太擅长,因此非常感谢详细的解释。
谢谢!
我正在尝试使用 libpam-google-authenticator 通过 ssh 启用 2FA。并非所有用户都需要启用身份验证器。每个人都使用 ssh 公钥,但没有人有密码。我正在运行 Debian buster,并且还尝试了 bullseye 的 libpam-google-authenticator。
我的问题是,无论我在 PAM 配置中输入什么内容,未启用身份验证器的用户都不会直接登录,而是总是要求输入密码。
我已经安装了 libpam-google-authenticator 并配置了 /etc/ssh/sshd_config:
PasswordAuthentication no
ChallengeResponseAuthentication yes
AuthenticationMethods publickey,keyboard-interactive
PasswordAuthentication no
PermitEmptyPasswords no
Run Code Online (Sandbox Code Playgroud)
我无法计算出正确的 PAM 配置,以便没有 .google_authenticator 文件的用户仍然可以登录。根据我使用的内容,系统要么提示用户输入密码(他们没有密码),要么不提示完全允许进入。
在 /etc/pam.d/sshd 中,我尝试过(像这样Trying to get SSH with public key (no password) + googleauthenticatorworking on Ubuntu 14.04.1):
#@include common-auth
auth required pam_google_authenticator.so debug nullok
Run Code Online (Sandbox Code Playgroud)
在这种情况下,没有身份验证器设置的用户将通过以下调试被拒绝;
Aug 05 15:11:18 <host> sshd(pam_google_authenticator)[746624]: debug: start of google_authenticator for "<user>"
Aug 05 15:11:18 <host> sshd(pam_google_authenticator)[746624]: debug: …Run Code Online (Sandbox Code Playgroud) 我正在寻找开源 2 因素身份验证服务。(现在我们正在使用 openLDAP。)
我们只是在使用 Linux 服务器。这就是为什么该服务应该与 PAM Linux 配合良好的原因。
为戴尔的 iDrac 和 Cisco 提供 2 因素身份验证支持也很好。
在此先感谢您提供任何链接:-)
我试图使 SSH 登录需要 2 个因素身份验证,但仅在一个端口上。
所以端口 1 只对 iptables 管理的 ip 列表开放。并且只需要密码/密钥
端口 2 对所有人开放,但需要 2 因素身份验证。
此设置是否可行,或者是否需要运行 2 个 sshd
two-factor ×11
ssh ×7
pam ×3
amazon-ec2 ×1
ansible ×1
bastion ×1
debian ×1
password ×1
public-key ×1
security ×1
ubuntu ×1