关于“man slapo-auditlog”,我只需要添加以下内容。
dn: olcOverlay=auditlog,olcDatabase={1}hdb,cn=config changetype: add objectClass: olcOverlayConfig objectClass: olcAuditLogConfig olcOverlay: auditlog olcAuditlogFile: /tmp/auditlog.ldif
首先,“olcOverlay = auditlog”在Centos 6上默认没有安装,所以我不能把它添加到任何东西。 如果我删除“changetype:add”,我会得到这个错误。
additional info: objectClass: value #1 invalid per syntax
我发现我可以创build自己的cn =模块,然后olcAuditLogConfig存在,我可以执行上面的LDIF。 但我仍然没有得到审计日志。
dn: cn=module{0},cn=config objectClass: olcModuleList cn: module{0} olcModulePath: /usr/lib64/openldap/ olcModuleLoad: auditlog.la
我的LDAP设置可以在这里find(现在稍微修改我自己的服务器)
如何在Centos 6上以最安全和最正确的方式configurationLDAP进行用户身份validation?
现在我已经有了一切工作,我非常接近解决scheme。 这是一个许可问题。 这是如何将审计日志添加到安装在Centos 6上的openldap。
首先启用该模块。
ldapadd -H ldaps://ldap.example.net -x -D "cn=admin,cn=config" -w secret << EOF dn: cn=module{0},cn=config objectClass: olcModuleList cn: module{0} olcModulePath: /usr/lib64/openldap/ olcModuleLoad: auditlog.la EOF
设置ldap有权写入的文件夹。
mkdir slapd chmod 755 /var/log/slapd/ chown ldap:ldap /var/log/slapd/ ls -alvhZ /var/log/slapd/
然后configurationolcAuditLogConfig覆盖。
ldapadd -H ldaps://ldap.example.net -x -D "cn=admin,cn=config" -w secret << EOF dn: olcOverlay=auditlog,olcDatabase={1}bdb,cn=config changetype: add objectClass: olcOverlayConfig objectClass: olcAuditLogConfig olcOverlay: auditlog olcAuditlogFile: /var/log/slapd/auditlog.log EOF
插入一些东西到数据库。
ldapadd -H ldaps://ldap.example.net -x -D "cn=admin,cn=config" -w secret << EOF dn: cn=management11191,ou=group,dc=example,dc=net cn: management11191 objectClass: posixGroup gidNumber: 2005 memberUid: user1 memberUid: user3 EOF
如果您看到任何内容,请检查auditlog文件。
$ cat /var/log/slapd/auditlog.log ... $ ls -alvhZ /var/log/slapd/auditlog.log -rw-r--r--. ldap ldap unconfined_u:object_r:slapd_log_t:s0 /var/log/slapd/auditlog.log
您需要安装openldap-servers-overlays软件包:
Name : openldap-servers-overlays Arch : x86_64 Version : 2.3.43 Release : 12.el5_7.9 Size : 358 k Repo : installed Summary : Overlays for OpenLDAP server. URL : http://www.openldap.org/ License : OpenLDAP Description: OpenLDAP is an open-source suite of LDAP (Lightweight Directory Access : Protocol) applications and development tools. LDAP is a set of : protocols for accessing directory services (usually phone book style : information, but other information is possible) over the Internet, : similar to the way DNS (Domain Name System) information is propagated : over the Internet. : : This package contains overlay modules for OpenLDAP server daemon.
取消注释slapd.conf的auditlog模块:
modulepath /usr/lib64/openldap moduleload auditlog.la
指定auditlog文件:
database bdb overlay auditlog auditlog /tmp/audit.log suffix "dc=domain,dc=com" rootdn "cn=Manager,dc=domain,dc=com"
修改/添加一些值的属性,看看上面的日志,你会看到这样的东西:
# modify 1319524581 dc=domain,dc=com cn=Manager,dc=domain,dc=com dn: cn=xx,ou=yy,dc=domain,dc=com changetype: modify replace: initials initials: Hai initials: Do - replace: entryCSN entryCSN: 20111025063621Z#000000#00#000000 - replace: modifiersName modifiersName: cn=Manager,dc=domain,dc=com - replace: modifyTimestamp modifyTimestamp: 20111025063621Z - # end replace 1319524581