• Linux OpenLDAP配置ACL


    版本 CentOS

    1、禁止匿名访问

    默认情况下匿名用户可以获取所有用户信息,甚至是密码字段,虽然密码字段是经过加密的那也很危险
    创建disable_anon.ldif文件

    dn: cn=config
    changetype: modify
    add: olcDisallows
    olcDisallows: bind_anon
    
    dn: cn=config
    changetype: modify
    add: olcRequires
    olcRequires: authc
    
    dn: olcDatabase={-1}frontend,cn=config
    changetype: modify
    add: olcRequires
    olcRequires: authc
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14

    导入配置

    ldapadd -Q -Y EXTERNAL -H ldapi:/// -f disable_anon.ldif

    2、设置ACL

    1. 拒绝所有用户查看用户信息,并且添加有ldap管理账号
      创建acl.ldif
    dn: olcDatabase={2}hdb,cn=config
    changetype: modify
    replace: olcAccess
    olcAccess: to attrs=userPassword
      by anonymous auth
      by dn.base="cn=ldapadmin,ou=manage,dc=taovip,dc=com" write
      by * none
    olcAccess: to *
      by anonymous auth
      by dn.base="cn=ldapadmin,ou=manage,dc=taovip,dc=com" write
      by dn.base="cn=ldapread,ou=manage,dc=taovip,dc=com" read
      by * none
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12

    导入配置

    ldapmodify -Q -Y EXTERNAL -H ldapi:/// -f acl.ldif

    1. 删除ACL
      创建文件del_acl.ldif
    dn: olcDatabase={2}hdb,cn=config
    changetype: modify
    delete: olcAccess
    olcAccess: {0}
    
    • 1
    • 2
    • 3
    • 4

    ldapmodify -Q -Y EXTERNAL -H ldapi:/// -f del_acl.ldif

    3、本人实践说明:

    ACL配置:

    1. 如下设置:

    只有管理员能修改密码,及管理员能查看所有目录
    其他账号不能修改密码,不能查看所有目录

    dn: olcDatabase={2}hdb,cn=config
    changetype: modify
    replace: olcAccess
    olcAccess: to attrs=userPassword
      by anonymous auth
      by dn.base="cn=Manager-Fxd,dc=fxd-ldap,dc=com" write
      by * none
    olcAccess: to *
      by anonymous auth
      by dn.base="cn=Manager-Fxd,dc=fxd-ldap,dc=com" write
      by dn.base="cn=Manager-Fxd,dc=fxd-ldap,dc=com" read
      by * none
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12

    2. 如下配置:

    所有用户需要权限校验
    超管账号可以查看和编辑所有目录和属性
    ou=People,dc=fxd-ldap,dc=com下的用户,可以查看除超管外的其他目录,查看不到密码属性

    dn: olcDatabase={2}hdb,cn=config
    changetype: modify
    replace: olcAccess
    olcAccess: to attrs=userPassword
      by anonymous auth
      by dn.base="cn=Manager-Fxd,dc=fxd-ldap,dc=com" write
      by * none
    olcAccess: to dn.base="cn=Manager-Fxd,dc=fxd-ldap,dc=com"
      by anonymous auth
      by self write
      by self read
      by * none
    olcAccess: to *
      by anonymous auth
      by dn.subtree="ou=People,dc=fxd-ldap,dc=com" write
      by dn.subtree="ou=People,dc=fxd-ldap,dc=com" read
      by * none 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
  • 相关阅读:
    2022中国老博会/老龄用品展/智慧养老展/北京老年产业展
    R语言基于指定规则、条件删除列表中的元素:使用purrr包的discard函数移除列表数据中的NA值
    操作系统-内存管理、进程线程
    解决Windows系统win+shift+s截图快捷键失效问题
    EPICS记录参考--Histogram记录(histogram)
    这几种常见的 JVM 调优场景,你知道吗?
    Ajax同源和跨域和节流防抖
    分享一个项目:go `file_line`,在编译期得到源码行号,减少运行期runtime消耗
    某职业学院未落实网络安全等级保护制度造成数据泄露——等保测评
    【linux】cpu过高解决方法
  • 原文地址:https://blog.csdn.net/qq_34486648/article/details/127834949