我使用的是 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也是?
我究竟做错了什么?任何帮助,将不胜感激。
我有一个 openVPN 设置,其中用户在运行 openVPN 的 Debian VM 上没有shell 帐户。我在谷歌搜索时发现的文章都有为经典 *nix 用户设置 Google Authenticator 的说明(例如,需要在用户的主目录中执行 Authenticator 二进制文件)。
是否有文档解释如何为仅基于.ovpn客户端使用的文件进行身份验证的 openvpn 服务器集成 Google 身份验证器?
我查看了https://github.com/evgeny-gridasov/openvpn-otp,但它仍然需要配置 Google Authenticator。
随着Google Authenticator的引入以及将其与 ssh一起使用的能力,我想知道是否有人已经通过 sshd_config 设置
这个想法通常与密钥无缝连接,并且通常在不太友好的环境中与两个因素机制连接。
我的指令中有以下指令 /etc/pam.d/sshdRHEL5 盒子上的文件中有点困惑。这些指令用于使 LDAP+RADIUS+OTP 工作。我想要做的是告诉 pam 不要检查用户 UID < 499 的 LDAP+RADIUS+OTP,并且还要排除 UID = 30027 进行相同的检查。
该指令按预期工作。它检查 UID 是否 >= 499,如果是,则跳过(验证足够的 pam_unix.so nullok_secure)。
auth [success=1 default=ignore] pam_succeed_if.so uid >= 499 quiet
Run Code Online (Sandbox Code Playgroud)
我在这里很困惑。这应该做 LDAP+RADIUS+OTP 因为 success=1 但不知何故它仍然有效。如果为真,它不应该跳过下一条规则吗?
auth [success=1 default=ignore] pam_succeed_if.so uid eq 30027 quiet
auth sufficient pam_unix.so nullok_secure
auth sufficient pam_radius_auth.so
auth required /lib/security/pam_google_authenticator.so forward_pass
Run Code Online (Sandbox Code Playgroud)
虽然,我已经让事情按照我想要的方式工作,但我对它的逻辑感到困惑。
好的,这就是我在使用 uid 为 30327 的本地用户 ssh 时在 /var/log/secure 中得到的信息 -
Aug 8 08:21:30 journey sshd[9357]: Accepted keyboard-interactive/pam for sidd from 10.1.1.178 port …Run Code Online (Sandbox Code Playgroud) 我正在尝试设置 Google-Authenticator(谷歌 2 因素身份验证)。
相关文件是:
[root@srv01 ~]# cat /etc/pam.d/sshd
#%PAM-1.0
auth required pam_google_authenticator.so
auth required pam_sepermit.so
auth include password-auth
account required pam_nologin.so
account include password-auth
password include password-auth
# pam_selinux.so close should be the first session rule
session required pam_selinux.so close
session required pam_loginuid.so
# pam_selinux.so open should only be followed by sessions to be executed in the user context
session required pam_selinux.so open env_params
session required pam_namespace.so
session optional pam_keyinit.so force revoke
session include password-auth
[root@srv01 ~]# egrep -v …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 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) 稍微谷歌搜索后,我可以看到一些使用 Windows Active Directory 配置 Google 身份验证器的参考,但是,我看不到如何在 Linux/CentOS 系统上执行此操作。
在 Linux (CentOS) 上使用 OpenLDAP 或 389 Directory Server 设置 Google Authenticator 会涉及什么?
我们有一个企业 VPN 服务器,在装有 Ubuntu 16.04 Xenial 的 AWS 实例上运行 OpenVPN 2.3。服务器已使用 Ansible playbook 进行配置。
我计划升级到 Ubuntu 18.04 Bionic,它还将 OpenVPN 升级到 2.4 版(这是一个预期的副作用,因为 OpenVPN 2.3 已被弃用)。所以我创建了一个带有 Bionic 的测试实例,并针对它运行了 Ansible playbook。配置包括通过 Google Authenticator 的 MFA,所以我也~/.google_authenticator从旧服务器复制文件并应用chmod 400到它。
在新服务器工作之前,我还必须解决一些兼容性问题:
openvpn-plugin-auth-pam.so 文件位置已更改,现在无需在服务器配置中指定其完整路径。CAP_AUDIT_WRITEopenvpnsystemd 服务中缺少权限(在此处查看更多详细信息)但是,即使在该身份验证之后,新服务器上的身份验证仍然失败。这是我的/etc/pam.d/openvpn样子:
auth required pam_google_authenticator.so
Run Code Online (Sandbox Code Playgroud)
如果我用 替换这一行auth required pam_permit.so,我将成功通过身份验证(当然使用任何密码)并连接,所以问题肯定是 MFA 介入的地方。
同时,pamtester告诉我pam_google_authenticator.so工作正常:
$ sudo pamtester openvpn vlad authenticate
Verification code:
pamtester: successfully authenticated
Run Code Online (Sandbox Code Playgroud)
这是我在尝试对 VPN 服务器进行身份验证时在 …
我当前的 sshd PAM 配置:
#%PAM-1.0
auth include system-auth
account required pam_nologin.so
account include system-auth
password include system-auth
session optional pam_keyinit.so force revoke
session include system-auth
session required pam_loginuid.so
Run Code Online (Sandbox Code Playgroud)
我正在添加 Google 身份验证器,但我们尚未准备好向所有用户推出它。
我相信以下内容应该需要“gauth”组中的用户使用 Google Authenticator PAM,但希望有人可以在我将自己锁定在 SSH 之外之前检查我的工作...
#%PAM-1.0
auth include system-auth
account required pam_nologin.so
account include system-auth
password include system-auth
auth [success=1 default=ignore] pam_succeed_if.so quiet user notingroup gauth
auth required pam_google_authenticator.so
session optional pam_keyinit.so force revoke
session include system-auth
session required pam_loginuid.so
Run Code Online (Sandbox Code Playgroud)
我是否正确理解“success=1”意味着“如果成功则跳过下一行”?
我找到了一篇文章 ( http://www.howtogeek.com/121650/how-to-secure-ssh-with-google-authenticators-two-factor-authentication/ ) 解释了如何配置 OpenSSH 以请求 Google 身份验证器成功登录后的代码。
是否可以配置 OpenSSH,以便发生以下情况:
这会很方便(因为在我的计算机上我只需要私钥)并且安全(因为我可以启用密码验证并且安全)。
有什么办法可以实现我想要的吗?
提前致谢。:)
我安装了 google 身份验证器(两步验证),“libpam-google-authenticator”包,尽管它要求为每个到 SSH 的连接提供代码。我想将 localhost 和我自己的 ip 从谷歌身份验证器列入白名单,所以我和 localhost 跳过两步验证
或者有没有办法跳过某些 ip 的 SSH 挑战?
我在我的 SSH 服务器上使用 Google Authenticator 和 Andoid 应用程序来生成代码。
在我运行$ google-authenticator应用程序后,创建一组紧急密钥:
https://www.google.com/chart?chs=200x200&chld=M|0&cht=qr&chl=otpauth://totp/user@machine%3Fsecret%ABCDEFGHIJKLMNOP
Your new secret key is: ABCDEFGHIJKLMNOP
Your verification code is 123456
Your emergency scratch codes are:
12345678
90123456
78901234
56789012
34567890
Run Code Online (Sandbox Code Playgroud)
如果使用所有5个代码,我该怎么办?如何生成新的集合?如果我运行$ google-authenticator它将生成新密钥ABCDEFGHIJKLMNOP,Android 应用程序将停止工作,直到我设置新密钥。
pam ×6
ssh ×5
ldap ×2
openvpn ×2
password ×2
security ×2
two-factor ×2
centos ×1
debian ×1
freeipa ×1
freeradius ×1
linux ×1
login ×1
redhat ×1
ubuntu ×1
ubuntu-18.04 ×1
verification ×1