ldap 389ds - 日志记录 - cat <> stdout-fifo-pipe-file > /dev/stdout - 没有审核记录 0 字节文件

问题描述 投票:0回答:1

我有一个在后台运行 389ds 容器的 ldap(舵图)。

我注意到图表中,有一个文件夹:docker-entrypoint-init.d/,其中包含一堆编号的 shell 脚本。示例:1-logging.sh、2-somename.sh、3-othername.sh、... 等等。

Helm Chart 成功安装并运行 389ds LDAP 服务器,即 pod 为 RUNNING(绿色)。

  1. ldap 绑定/等操作运行正常,没有任何问题。
  2. 我可以成功运行 ldapmodify 命令等。

1-logging.sh 文件包含以下几行:(似乎正在创建一些管道,然后将管道输出重定向到 /dev/{stdout,stderror})。

# Activate fifo pipes
log_info "Activating stdout pipe"
cat <> /tmp/stdout-fifo > /dev/stdout &

log_info "Activating stderr pipe"
cat <> /tmp/stderr-fifo > /dev/stderr &

问题 1:这行 cat <> /tmp/stdout-fifo > /dev/stdout 到底在这里做什么?

我能够成功运行 ldapmodify 命令更改用户密码(在 Rancher UI > 工作负载 > pods > ldap-0 pod > 查看日志中查看 pod 的日志数据,会显示 pod 增长时的日志) ,并且有与 ldapmodify 操作相关的条目,即反映该目标用户的 ldap 数据库中发生的某些更改)。

对于任何其他操作,例如访问、错误,我看到相应的文件具有有效的大小并包含一些日志数据。用于审核和访问/错误的 LDAP 设置类似(根据下面显示的 URL)。

我还注意到,当我使用 View Logs(Rancher 中的 pod 级别)查看日志时,访问文件的内容并不完全包含/增长。 用于创建/指定访问、错误和审核

输出文件的

LDAP设置在此处定义:https://access.redhat.com/documentation/en-us/red_hat_directory_server/11/html/configuration_command_and_file_reference/core_server_configuration_reference# cnconfig-nsslapd_auditlog_Audit_Log 就我而言,我看到:

# cat -n /var/lib/dirsrv/etc/slapd-dir/dse.ldif|grep audit 28 nsslapd-auditlog: /tmp/stdout-fifo <-- audit log file 29 nsslapd-auditfaillog: /var/log/dirsrv/slapd-dir/audit <-- audit-fail log file 78 nsslapd-auditlog-mode: 640 79 nsslapd-auditlog-maxlogsperdir: 1 80 nsslapd-auditlog-logrotationtime: -1 81 nsslapd-auditlog-logrotationtimeunit: day 82 nsslapd-auditlog-logmaxdiskspace: 500 83 nsslapd-auditlog-logminfreediskspace: 200 84 nsslapd-auditlog-logging-enabled: on <-- audit logging turned ON

查看上面的配置,我看到 ldap 在其日志目录下创建了 3 个文件(访问、错误和审计),但是,
audit FAIL-LOG

文件为空空白 = 0 字节,可能是因为没有真正的文件运行 ldapmodify/审计相关操作时出错: # ls -l /var/log/dirsrv/slapd-dir | grep -v rotat total 192 -rw-r-----. 1 ldapuser ldap 157028 Mar 20 21:32 access -rw-r-----. 1 ldapuser ldap 0 Mar 20 21:30 audit <--------- 0 bytes -rw-r-----. 1 ldapuser ldap 22935 Mar 20 21:32 errors

问题 2

:我可以在上面的 nsslapd-audit 配置中更改什么,以便我可以在同一个 /var/log/dirsrv/slapd-dir/audit 中同时拥有 LDAP 审核“成功和失败”事件 文件,而不影响/触及 nsslapd-auditlog: 条目使用的 /tmp/stdout-fifo。

docker ldap fifo audit-logging 389ds
1个回答
0
投票
问题2答案:

已添加

nsslapd-auditfaillog: /tmp/stdout-fifo nsslapd-auditfaillog-logging-enabled: on ... more nssldapd-auditfaillog-* settings here...

注意

:如果您根本不指定 nsslapd-auditfaillog 条目,则根据以下 URL 中提到的文档(设置),失败的 ldap 审核日志/操作(即auditfaillog)将自动转到同一文件(由审核日志条目定义)。我确实指定了 nsslapd-auditfaillog-* 的所有其他设置

注意

:在我的例子中,我使用 FIFO 文件来进行审计和失败的审计操作。但如果您想要常规文件(而不是 FIFO),则不要使用 /tmp/stdout-fifo 文件,而是将auditlog 和auditfaillog 设置的文件值指定为

/var/log/dirsrv/slapd-dir/audit
,389ds 会将所有审核(成功和失败的数据)发送到单个文件。
稍后我们可以使用 FluentD/Fluent-Bit 来解析它、解析它并将其发送到某个目标输出(弹性索引等)。

参考:

https://access.redhat.com/documentation/en-us/red_hat_directory_server/11/html/configuration_command_and_file_reference/core_server_configuration_reference#cnconfig-nsslapd_auditfaillog_Audit_Fail_Log

© www.soinside.com 2019 - 2024. All rights reserved.