大网数据广告活动
服务器运维问答

Tacacs+ with PAM two-factor Google authentication?

· 52CE 我爱测

I'm working on a tacacs+ server for my campus network, and I have been wondering how I could set up a tacacs+ server to communicate to PAM running google's two-factor authentication. I've done quite a bit of googling, found some …

问题原文

原帖链接 · Disco King · CC BY-SA 3.0

I'm working on a tacacs+ server for my campus network, and I have been wondering how I could set up a tacacs+ server to communicate to PAM running google's two-factor authentication. I've done quite a bit of googling, found some useful information, but I haven't found a clear 'road map' and a lot of steps seem fuzzy at best. I've got an Ubuntu tacacs+ test bed running right now with no switches or routers configured yet.

Has anyone done something like this? I found a relatively good guide in a redhat e-mail chain here: https://www.redhat.com/archives/pam-list/2014-March/msg00008.html

I don't know exactly where to go next, or how this system works. Are there any examples I can follow or some suggestions anyone's got? I feel a bit like I'm in trial and error mode right now.

EDIT: Specifically, right now, I'm staring at example PAM configuration files in /etc/pam.d/(tac_plus? whatever it's called) and I'm not sure exactly what needs to go there. Is that Google authenticator stuff or tacacs+ stuff? My example looks something like the code posted below, but I'm not sure what goes here:

auth        required      pam_env.so
auth        sufficient    pam_unix.so nullok try_first_pass
auth        requisite     pam_succeed_if.so uid >= 500 quiet
auth        sufficient    pam_ldap.so use_first_pass
auth        required      pam_deny.so

account     required      pam_unix.so broken_shadow
account     sufficient    pam_localuser.so
account     sufficient    pam_succeed_if.so uid < 500 quiet
account     [default=bad success=ok user_unknown=ignore] pam_ldap.so
account     required      pam_permit.so

password    requisite     pam_cracklib.so try_first_pass retry=3
password    sufficient    pam_unix.so md5 shadow nullok try_first_pass 
use_authtok
password    sufficient    pam_ldap.so use_authtok
password    required      pam_deny.so

session     optional      pam_keyinit.so revoke
session     required      pam_limits.so
session     [success=1 default=ignore] pam_succeed_if.so service in 
crond quiet use_uid
session     required      pam_unix.so
session     required      pam_mkhomedir.so skel=/etc/skel/ umask=0077
session     optional      pam_ldap.so

There's also a config for tacacs which looks very straightforward, but like everything else, I've never seen it before, so I'm not too sure. It looks like this:

# admin group
group = admins {
        default service = permit
        login = PAM
        service = exec {
             priv-lvl = 15
        }
}

已采纳解答

原帖链接 · Jacob Evans · CC BY-SA 3.0

Breaking this into two pieces, the pam directory is for your authentication for services: tac_plus. The tac_plus configuration file is for the the service: tacacs+

PAM

Pam is your pluggable authentication, this is where you are going to configure user/password authentication with google auth, since google auth is very commonly used for services like RADIUSD and SSHD then I'll steal some public code for that.

#1 google result is Supertech Guy whom I've actually gone and written a rebuke on some of his security practices Here but essentially:

Add this to your auth section of pam.d/tac_plus

auth requisite pam_google_authenticator.so forward_pass
auth required pam_unix.so use_first_pass

You can modify the location of google auth keys if you want to feed users from ldap and pregenerate their BASE32 keys instead of using the google-auth tool. More about google_auth pam module

TACACS++

tac_plus is a service, when you authenticate with this service it will use the pam module for tac_plus, same as radiusd and sshd.

There's a ton of guides on how to configure that, http://www.shrubbery.net/tac_plus/ for example, sadly I have not configured tac_plus personally.

READ

When you authenticate with google auth forward_pass your password is password&googleauth

password: MyPassword

google totp: 222555

resulting password you enter: MyPassword222555

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-03-30)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。