有“31”台服务器由相同的 RedOS 映像(基于 CentOS 7)配置。它们进入 LDAP samba 域,并配置为通过基于 ldap 用户组的 ssh 进行授权。为此目的,进行了以下更改:
以 root 身份创建
echo "Domain admins" > /etc/ssh/access_groups.conf && chmod 600 /etc/ssh/access_groups.conf
修改/etc/pam.d/sshd
____missed default____
account required pam_nologin.so
account sufficient pam_localuser.so
account required pam_listfile.so onerr=fail item=group sense=allow file=/etc/ssh/access_groups.conf
account include password-auth
_______ missed default____
visudo /etc/sudoers.d/01-域-用户
#sudo admin users LDAP auth
"%mydomain.local\Domain admins" ALL=(ALL) NOPASSWD:ALL
systemctl 重新启动 sshd
此配置已成功应用于大约30台服务器并且正在运行。在服务器 31 上,该配置不起作用。尝试登录时,客户端显示连接已被服务器关闭。
debug3: failed to open file:C:/dev/tty error:3
debug1: read_passphrase: can't open /dev/tty: No such file or directory
t1_rushao@ruyansvap38's password:
debug3: send packet: type 50
debug2: we sent a password packet, wait for reply
Connection closed by 10.65.201.61 port 22
在服务器端
sshd[18238]: pam_sss(sshd:auth): authentication success; logname= uid=0 euid=0 tty=ssh ruser= rhost=10.65.90.176 user=t1_rushao
sshd[18238]: pam_listfile(sshd:account): Refused user t1_rushao for service sshd
sshd[18238]: Failed password for t1_rushao from 10.65.90.176 port 59786 ssh2
sshd[18238]: fatal: Access denied for user t1_rushao by PAM account configuration [preauth]
如果我注释掉“account required pam_listfile.so...”我可以通过 ssh 作为域用户进行连接,但 sudo 也不起作用。同时,
id t1_rushao
uid=1006007868(t1_rushao) gid=1006000513(domain users) groups=1006000513(domain users),1006000512(domain admins)
sssd 服务正在工作,服务器上域用户的授权似乎也正在工作,我尝试了 kinit、net ads join 几次。/etc/security/access.conf 默认情况下被完全注释掉。
我已经不知道为什么这个配置在这台服务器上不起作用。我知道问题出在域组中的某个地方,系统无法将用户组与设置相匹配,但为什么呢?