收集 OpenLDAP 日志
本文档介绍了如何使用 Bindplane 将 OpenLDAP 日志注入 Google Security Operations。
OpenLDAP 是一种开源 LDAP 目录服务器,可生成访问、审核和复制日志。解析器会从 OpenLDAP 日志条目中提取字段,并将其映射到统一数据模型 (UDM),捕获用户身份、身份验证事件、LDAP 操作和安全结果。
准备工作
请确保满足以下前提条件:
- Google SecOps 实例
- Windows Server 2016 或更高版本,或者具有
systemd的 Linux 主机 - Bindplane 代理与 OpenLDAP 服务器之间的网络连接
- 如果通过代理运行,请确保防火墙端口根据 Bindplane 代理要求处于打开状态
- 对 OpenLDAP 服务器拥有特权访问权限,并具有根权限或管理员权限
获取 Google SecOps 注入身份验证文件
- 登录 Google SecOps 控制台。
- 依次前往 SIEM 设置 > 收集代理。
下载数据注入身份验证文件 。将该文件安全地保存在将安装 Bindplane 的系统上。
获取 Google SecOps 客户 ID
- 登录 Google SecOps 控制台。
- 依次前往 SIEM 设置 > 个人资料。
从组织详细信息 部分复制并保存客户 ID 。
安装 Bindplane 代理
按照以下说明在 Windows 或 Linux 操作系统上安装 Bindplane 代理。
Windows 安装
- 以管理员身份打开命令提示符 或 PowerShell 。
运行以下命令:
msiexec /i "https://github.com/observIQ/bindplane-agent/releases/latest/download/observiq-otel-collector.msi" /quiet等待安装完成。
运行以下命令,验证安装是否成功:
sc query observiq-otel-collector
该服务应显示为正在运行 。
Linux 安装
- 打开具有根权限或 sudo 权限的终端。
运行以下命令:
sudo sh -c "$(curl -fsSlL https://github.com/observiq/bindplane-agent/releases/latest/download/install_unix.sh)" install_unix.sh等待安装完成。
运行以下命令,验证安装是否成功:
sudo systemctl status observiq-otel-collector
该服务应显示为已启用(正在运行) 。
其他安装资源
如需了解其他安装选项和问题排查方法,请参阅 Bindplane 代理安装指南。
配置 Bindplane 代理以注入 syslog 并发送到 Google SecOps
找到配置文件
Linux :
sudo systemctl status observiq-otel-collectorWindows :
notepad "C:\Program Files\observIQ OpenTelemetry Collector\config.yaml"
修改配置文件
将
config.yaml的全部内容替换为以下配置:receivers: udplog: listen_address: "0.0.0.0:514" exporters: chronicle/openldap: compression: gzip creds_file_path: '/etc/bindplane-agent/ingestion-auth.json' customer_id: '<customer_id>' endpoint: malachiteingestion-pa.googleapis.com log_type: OPENLDAP raw_log_field: body service: pipelines: logs/openldap: receivers: - udplog exporters: - chronicle/openldap
配置参数
替换以下占位符:
接收器配置:
udplog:基于协议的接收器类型:udplog(适用于 UDP syslog)tcplog(适用于 TCP syslog)syslog(适用于 RFC 3164/5424 syslog)
0.0.0.0:要监听的 IP 地址:0.0.0.0(监听所有接口,推荐)- 特定 IP 地址(监听一个接口)
514:要监听的端口号(例如514、1514、6514)
导出器配置:
<customer_id>:上一步中的客户 IDmalachiteingestion-pa.googleapis.com:区域端点网址:- 美国:
malachiteingestion-pa.googleapis.com - 欧洲:
europe-malachiteingestion-pa.googleapis.com - 亚洲:
asia-southeast1-malachiteingestion-pa.googleapis.com - 如需完整列表,请参阅区域端点
- 美国:
- 根据平台调整
creds_file_path:- Linux:
/etc/bindplane-agent/ingestion-auth.json - Windows:
C:\Program Files\observIQ OpenTelemetry Collector\ingestion-auth.json
- Linux:
保存配置文件
- 修改后,保存文件:
- Linux:依次按
Ctrl+O、Enter和Ctrl+X - Windows:依次点击文件 > 保存
- Linux:依次按
重启 Bindplane 代理以应用更改
如需在 Linux 中重启 Bindplane 代理,请执行以下操作:
运行以下命令:
sudo systemctl restart observiq-otel-collector验证服务是否正在运行:
sudo systemctl status observiq-otel-collector检查日志中的错误:
sudo journalctl -u observiq-otel-collector -f
如需在 Windows 中重启 Bindplane 代理,请执行以下操作:
请从下列选项中选择一项:
- 以管理员身份运行命令提示符或 PowerShell:
net stop observiq-otel-collector && net start observiq-otel-collector- 服务控制台:
- 按
Win+R,输入services.msc,然后按 Enter 键。 - 找到 observIQ OpenTelemetry Collector 。
- 右键点击并选择重启 。
- 按
验证服务是否正在运行:
sc query observiq-otel-collector检查日志中的错误:
type "C:\Program Files\observIQ OpenTelemetry Collector\log\collector.log"
配置 OpenLDAP syslog 转发
您可以将 OpenLDAP (slapd) 配置为通过 syslog 记录日志。将 syslog 守护程序配置为将 OpenLDAP 日志转发到 Bindplane 代理。
验证 OpenLDAP 是否已配置为记录到 syslog。检查
slapd.conf或cn=config中是否存在loglevel指令:loglevel stats connsOpenLDAP 日志默认记录到
local4syslog 设施。将 rsyslog 配置为将这些日志转发到 Bindplane 代理。创建配置文件:sudo nano /etc/rsyslog.d/openldap-forward.conf添加以下内容:
local4.* @BINDPLANE_AGENT_IP:514重启 rsyslog 服务:
sudo systemctl restart rsyslog
UDM 映射表
| 日志字段 | UDM 映射 | 逻辑 |
|---|---|---|
| op、fd、ou、cn、dc、dc1、base1、base2、base3、scope_data、valueData、method、filter、tag_data、err、attrData、ou_2、ou_1、syslog_message、immutable_user_id、resource | additional.fields | 与根据这些字段创建的标签合并 |
| extensions.auth.type | 设置为“AUTHTYPE_UNSPECIFIED” | |
| caller_ip、proxy1_ip、proxy2_ip | intermediary | 从 intermediary、proxy_1、proxy_2 合并 |
| msg1、inner_message | metadata.description | msg1 或 inner_message 中的值 |
| metadata.event_type | 最初设置为“GENERIC_EVENT”,然后如果存在 principal IP,则设置为“STATUS_UPDATE”;如果存在用户,则设置为“USER_UNCATEGORIZED”;如果存在时间戳或 inner_ts,则设置为“USER_LOGIN” | |
| ldap_action | metadata.product_event_type | ldap_action 中的值(小写) |
| ldap_conn | metadata.product_log_id | 移除“conn=”后的 ldap_conn 中的值 |
| user_agent | network.http.user_agent | 直接复制值 |
| session_id | network.session_id | 直接复制值 |
| principal_ip、prin_ip、caller_ip、r_ip_or_host、proxy_client_ip、src_ip、client_ip | principal.asset.ip | 从 principal_ip(将 - 替换为 . 后)、prin_ip、caller_ip、r_ip_or_host(如果是 IP)、proxy_client_ip、src_ip、client_ip 合并 |
| r_ip_or_host、src_host | principal.hostname | 如果是主机名,则为 r_ip_or_host 中的值,否则为 src_host |
| principal_ip、prin_ip、caller_ip、r_ip_or_host、proxy_client_ip、src_ip、client_ip | principal.ip | 从 principal_ip(将 - 替换为 . 后)、prin_ip、caller_ip、r_ip_or_host(如果是 IP)、proxy_client_ip、src_ip、client_ip 合并 |
| 国家/地区 | principal.location.country_or_region | 直接复制值 |
| prin_port、port、src_port | principal.port | prin_port、port 或 src_port 中的值,转换为整数 |
| syslog_process | principal.process.file.full_path | 直接复制值 |
| syslog_pid | principal.process.pid | 直接复制值 |
| org_name | principal.user.company_name | 直接复制值 |
| user、cn、uid | principal.user.userid | user、cn 或 uid 中的值 |
| security_result | security_result | 直接合并 |
| action、sec_action | security_result.action | action(基于错误代码)或 sec_action(基于 login_status)中的值 |
| resource、immutable_user_id | security_result.detection_fields | 与 resource 和 immutable_user_id 中的标签合并 |
| inner_descrption、security_description | security_result.description | inner_descrption 或 security_description 中的值 |
| tuser、username、userid | target.user.userid | tuser、username 或 userid 中的值 |
| metadata.product_name | 设置为“OpenLDAP” | |
| metadata.vendor_name | 设置为“OpenLDAP” | |
eventType |
event.idm.read_only_udm.metadata.product_event_type |
从更改日志映射 |
cn |
event.idm.read_only_udm.additional.fields |
从更改日志映射 |
sequenceId |
event.idm.read_only_udm.additional.fields |
从更改日志映射 |
dc_2 |
event.idm.read_only_udm.additional.fields |
从更改日志映射 |
dc_3 |
event.idm.read_only_udm.additional.fields |
从更改日志映射 |
dc |
event.idm.read_only_udm.additional.fields |
从更改日志映射 |
dc_1 |
event.idm.read_only_udm.additional.fields |
从更改日志映射 |
user |
event.idm.read_only_udm.principal.user.userid |
从更改日志映射 |
path |
event.idm.read_only_udm.principal.process.file.full_path |
从更改日志映射 |
ip1 |
principal.ip |
从更改日志映射 |
base", "err", "attr", "tag", "scope", and "valueData |
additional.fields |
从更改日志映射 |
security_result.action |
ALLOW |
从更改日志映射 |
security_result.action |
BLOCK |
从更改日志映射 |