我已经创建了一个openLDAP服务器和一个客户端。现在的要求是仅允许某些特定LDAP组的成员在此客户端上执行SSH。
客户端计算机
我可以使用“ getent group”查看LDAP组
这是我的/etc/pam.d/sshd文件
%PAM-1.0
account required pam_access.so
auth required pam_listfile.so onerr=fail item=group sense=allow
file=/etc/openldap/sshgroups
auth required pam_sepermit.so
auth substack password-auth
auth include postlogin
# Used with polkit to reauthorize users in remote sessions
-auth optional pam_reauthorize.so prepare
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_mkhomedir.so skel=/etc/skel/ umask=0022
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
session include postlogin
# Used with polkit to reauthorize users in remote sessions
-session optional pam_reauthorize.so prepare
文件/ etc / openldap / sshgroups的内容:
root
centos
ldap-test-group
但是所有LDAP用户都可以登录到客户端计算机。
这是怎么了?
答案 0 :(得分:0)
经过大量的试用和试用后,我可以使用pam_access.so和access.conf来获取它。