linux - 具有 MFA 的堡垒服务器

标签 linux ssh google-authenticator multi-factor-authentication

我有一个堡垒服务器,使用 google-authenticator 服务启用了 MFA。但我无法通过我的堡垒使用 proxycommand:

> ssh -vvv -i ~/.ssh/file.pem  user@ip -o "proxycommand ssh -q -W %h:%p user@bastion"
OpenSSH_7.9p1 Ubuntu-10, OpenSSL 1.1.1b  26 Feb 2019
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: resolve_canonicalize: hostname ip is address
debug1: Executing proxy command: exec ssh -q -W ip:22 user@bastion
debug1: identity file /home/user/.ssh/file.pem type -1
debug1: identity file /home/user/.ssh/file.pem-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.9p1 Ubuntu-10
Password: 
Verification code: 


connection exited by timeout 

是否可以将 proxycommand 与 MFA 结合使用?

/etc/pam.d/common-session:

session [default=1]         pam_permit.so
session requisite           pam_deny.so
session required            pam_permit.so
session optional            pam_umask.so
session required    pam_unix.so 
session optional    pam_systemd.so 

auth required pam_google_authenticator.so nullok

/etc/ssh/sshd_config:

PubkeyAuthentication yes
PasswordAuthentication yes
ChallengeResponseAuthentication yes

UsePAM yes
X11Forwarding yes
PrintMotd no

AcceptEnv LANG LC_*
Subsystem   sftp    /usr/lib/openssh/sftp-server

最佳答案

问题出在防火墙规则上,proxycommand 可与 MFA 配合使用!

关于linux - 具有 MFA 的堡垒服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56584163/

相关文章:

go - SSH 脚本使用 pty 和 io.Copy 通过菜单流式输出

ios - 在 objective-c 中从另一个 iOS 应用程序设置 Google Authenticator?

linux - 从另一个终端减少/增加 omxplayer 音量

docker - JetBrains 空间。 docker-compose 与 -H 标志部署在远程服务器上

iphone - 如何使用 iPhone 控制任何基于 IR 的家用电器?是否需要基于 SSH/UPnP 的应用程序?

google-authenticator - 我们可以安装 Google Authenticator 扩展吗?

c# - OtpSharp 无法与 google 身份验证器配合使用

php - 安装 PECL 失败,未找到 raphf.so

linux - 在 RHEL 6.9 上安装 krb5-server 时面临库依赖

c - 有谁知道什么是亲缘关系?