AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 1075146
Accepted
mveroone
mveroone
Asked: 2021-08-21 01:06:58 +0800 CST2021-08-21 01:06:58 +0800 CST 2021-08-21 01:06:58 +0800 CST

nss-pam-ldapd 密码验证仅在使用 `su` 时在 CentOS 7 上不起作用

  • 772

语境

我这里有 2 台不同的机器,它们的主要区别是一个运行 CentOS6,另一个运行 CentOS7。两者都运行最新的可用分发版本的 lib:COS7 为 0.8.13,CentOS6 为 0.7.5 两者都运行“正常”配置的 nss-pam-ldapd:

/etc/nslcd.conf

uid nslcd
gid ldap

uri ldap://ldap.example.org/
base dc=example,dc=org

ssl no
tls_cacertdir /etc/openldap/cacerts
idle_timelimit 240

base   group  ou=groups,dc=example,dc=org

binddn cn=Readonly,dc=example,dc=org
bindpw **************

服务器权限:

olcAccess: {0}to attrs=userPassword,shadowLastChange by dn="cn=Manager,dc=cube-net,dc=org" write by dn="cn=Readonly,dc=example,dc=org" none by anonymous auth by self write by * none
olcAccess: {1}to dn.base="cn=Readonly,dc=example,dc=org" by dn="cn=Manager,dc=example,dc=org" write by * none
olcAccess: {2}to dn.base="" by * read
olcAccess: {3}to * by dn="cn=Manager,dc=example,dc=org" write by dn="cn=Readonly,dc=example,dc=org" read by self write by * read

问题

我可以很好地查找用户,但我无法以su在 CentOS 7 上使用的用户身份登录。我得到:

mveroone@vm:~$ passwd
Changing password for user mveroone.
(current) LDAP Password: 
New password: 
Retype new password: 
passwd: all authentication tokens updated successfully.
mveroone@vm:~$ su - mveroone
Password: 
su: Permission denied
mveroone@vm:~$ ssh localhost
Authorized uses only. All activity may be \ monitored and reported.
mveroone@localhost's password: 
Last login: Fri Aug 20 16:10:24 2021

Authorized uses only. All activity may be \ monitored and reported.
mveroone@vm:~$ 

所以是的,我可以使用 SSH 登录,更改我的密码,但不能使用 su。

我试过的

使用简单的绑定方法在两台服务器上执行 aldapwhoami工作,但不是 SASL(无可用机制)

root@vm:~# ldapwhoami -D uid=user,ou=users,dc=example,dc=org -W -H ldap://ldap.example.org  
Enter LDAP Password: 
dn:uid=user,ou=users,dc=example,dc=org

nslcd -d在尝试使用密码验证时运行su仅在 COS7 中显示:

nslcd: DEBUG: accept() failed (ignored): Resource temporarily unavailable

尽管根据几个邮件列表线程,这似乎是一个可以忽略的错误。

当使用附加调试()运行 nslcd 时nslcd -dd,我可以看到它首先尝试与用户绑定,这成功了,然后它搜索'(objectClass=*)',过滤属性:dn和 base = 本身有效:

ldap_free_request (origid 1, msgid 1)
ldap_parse_result
ldap_msgfree
ldap_search_ext
put_filter: "(objectClass=*)"
put_filter: simple
put_simple_filter: "objectClass=*"
ldap_build_search_req ATTRS: dn
ldap_send_initial_request
ldap_send_server_request
ldap_result ld 0x7f7a9800cf60 msgid 2
wait4msg ld 0x7f7a9800cf60 msgid 2 (timeout 10000000 usec)
wait4msg continue ld 0x7f7a9800cf60 msgid 2 all 0
** ld 0x7f7a9800cf60 Connections:
 * host: ldap.example.org  port: 389  (default)
  refcnt: 2  status: Connected
  last used: Fri Aug 20 11:42:05 2021


** ld 0x7f7a9800cf60 Outstanding Requests:
 * msgid 2,  origid 2, status InProgress
   outstanding referrals 0, parent count 0
  ld 0x7f7a9800cf60 request count 1 (abandoned 0)
** ld 0x7f7a9800cf60 Response Queue:
   Empty
  ld 0x7f7a9800cf60 response count 0
ldap_chkResponseList ld 0x7f7a9800cf60 msgid 2 all 0
ldap_chkResponseList returns ld 0x7f7a9800cf60 NULL
ldap_int_select
read1msg: ld 0x7f7a9800cf60 msgid 2 all 0
read1msg: ld 0x7f7a9800cf60 msgid 2 message type search-entry
ldap_get_dn
nslcd: [0e0f76] <authc="user"> DEBUG: ldap_result(): uid=user,ou=users,dc=example,dc=org
ldap_msgfree
ldap_abandon 2
ldap_abandon_ext 2
do_abandon origid 2, msgid 2
ldap_msgdelete ld=0x7f7a9800cf60 msgid=2
ldap_free_request (origid 2, msgid 2)
ldap_free_connection 0 1
ldap_free_connection: refcnt 1
ldap_msgfree
nslcd: [0e0f76] <authc="user"> DEBUG: ldap_unbind()
ldap_unbind

所以路径是:

  • 绑定(确定)
  • 搜索自己的DN(ok)
  • 放弃
  • 解绑

然后告诉我它无法验证用户。(“权限被拒绝”,所以它与“身份验证失败”不同)我执行了一个数据包捕获,它显示了同样的事情。

我已经尝试通过 nslcd 的 0.8.x 版本的变更日志来查看是否发生了一些变化,但是有很多变化,没有足够的细节。

pam-ldap nss
  • 1 1 个回答
  • 218 Views

1 个回答

  • Voted
  1. Best Answer
    mveroone
    2021-08-21T06:36:15+08:002021-08-21T06:36:15+08:00

    nslcd好的,所以它最终与PAM-LDAP完全无关......

    /etc/pam.d/su最后有这一行(在他的“auth”块之外)

    auth    required    pam_wheel.so    use_uid
    

    例如,其中没有/etc/pam.d/sshd。

    评论它解决了这个问题

    该行也存在于 CentOS 6 上,但include上面有一条语句跳过了任何进一步的行,而不是substack没有。

    • 0

相关问题

  • SunLDAP Schema Extensions 以支持 Linux/Unix 身份验证 + Sudo

  • ldap 和 getent 或 repquota 的奇怪行为

  • pam_mkhomdir + nfs 创建 noboy:nogroup 拥有的主目录

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve