收集 Red Hat Directory Server LDAP 記錄
本文說明如何使用 Bindplane 代理程式,將 Red Hat 目錄伺服器 LDAP 記錄擷取至 Google Security Operations。
Red Hat Directory Server 是以開放標準為基礎建構的企業級 LDAP 目錄服務,可為 Linux 和 UNIX 環境提供集中式使用者身分管理、驗證和存取權控管。目錄伺服器會將存取、錯誤、稽核、稽核失敗和安全性記錄儲存在 /var/log/dirsrv/slapd-instance_name/ 目錄中,記錄用戶端連線、LDAP 作業、設定變更、失敗作業,以及驗證嘗試和授權問題等安全性事件。
事前準備
請確認您已完成下列事前準備事項:
- Google SecOps 執行個體
- 搭載
systemd的 Linux 主機 - Bindplane 代理程式與 Red Hat 目錄伺服器主機之間的網路連線
- 如果是在 Proxy 後方執行,請確認防火牆通訊埠已按照 Bindplane 代理程式規定開啟
- Red Hat Directory Server 主機的 root 或 sudo 存取權
- 已安裝並執行 Red Hat Directory Server 11 以上版本
- 在目錄伺服器主機上安裝並執行的
rsyslog服務
取得 Bindplane 代理程式的 Google SecOps 憑證
如要向 Google SecOps 驗證 Bindplane 代理程式,請選擇下列其中一種方法:
- 新部署作業:使用 Chronicle API (選項 1)。
- 舊版部署作業:在 2027 年 7 月 20 日停用 Ingestion API 前,請繼續使用擷取驗證檔案 (選項 2)。
方法 1:為 Chronicle API 建立服務帳戶 (建議)
- 登入 Google Cloud 控制台,然後選取連結至 Google SecOps 執行個體的 Google Cloud 專案。
- 依序前往「IAM & Admin」(IAM 與管理) >「Service Accounts」(服務帳戶)。
- 按一下「建立服務帳戶」。
- 提供下列設定詳細資料:
- 「Service account name」(服務帳戶名稱):輸入帳戶名稱 (例如
bindplane-ingest)。 - 服務帳戶說明:輸入說明 (例如
Bindplane agent log ingestion)。
- 「Service account name」(服務帳戶名稱):輸入帳戶名稱 (例如
- 點按「Create and continue」(建立並繼續)。
- 在「將專案存取權授予這個服務帳戶」部分,按一下「選取角色」,然後選取「Chronicle 編輯者」。
- 依序點選「繼續」和「完成」。
- 按一下您建立的服務帳戶,然後前往「金鑰」分頁。
- 依序點選「新增金鑰」>「建立新的金鑰」。
- 選取「JSON」,然後點選「建立」。金鑰檔案會下載到電腦。
- 將金鑰檔案儲存為 Bindplane 收集器目錄中的
ingestion-auth.json(Linux 為/opt/observiq-otel-collector/ingestion-auth.json,Windows 為C:\Program Files\observIQ OpenTelemetry Collector\ingestion-auth.json),或更新config.yaml中的creds_file_path,使其與儲存檔案的路徑相符。 - 依序前往「IAM 與管理」>「設定」,然後複製「專案編號」。匯出工具設定時會用到。
方法 2:下載擷取驗證檔案 (舊版)
- 登入 Google SecOps 控制台。
- 依序前往「SIEM 設定」>「收集代理程式」。
- 下載擷取驗證檔案。
- 將檔案安全地儲存在要安裝 Bindplane 代理程式的系統中。
取得 Google SecOps 客戶 ID
- 登入 Google SecOps 控制台。
- 依序前往「SIEM 設定」>「設定檔」。
複製並儲存「機構詳細資料」部分的客戶 ID。
安裝 Bindplane 代理程式
請按照下列指示,在 Linux 作業系統上安裝 Bindplane 代理程式。
Linux 安裝
- 開啟具有 root 或 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服務應顯示為「active (running)」。
其他安裝資源
如需其他安裝選項和疑難排解資訊,請參閱 Bindplane 代理程式安裝指南。
設定 Bindplane 代理,擷取系統記錄檔並傳送至 Google SecOps
找出設定檔
Linux:
sudo nano /opt/observiq-otel-collector/config.yaml
編輯設定檔
將
config.yaml的全部內容替換為下列設定:receivers: udplog: listen_address: "0.0.0.0:514" exporters: chronicle/redhat_ds: protocol: https # Region of your instance, for example us, europe, asia-southeast1 location: <LOCATION> # Project number of the Google Cloud project linked to the instance project: '<PROJECT_NUMBER>' compression: gzip creds_file_path: '/opt/observiq-otel-collector/ingestion-auth.json' customer_id: '<customer_id>' endpoint: chronicle.googleapis.com log_type: REDHAT_DIRECTORY_SERVER raw_log_field: body service: pipelines: logs/redhat_ds: receivers: - udplog exporters: - chronicle/redhat_ds
設定參數
替換下列預留位置:
接收器設定:
udplog:依通訊協定區分的接收端類型:- UDP syslog 的
udplog tcplog(適用於 TCP Syslog)syslog(適用於 RFC 3164/5424 syslog)
- UDP syslog 的
0.0.0.0:要監聽的 IP 位址:0.0.0.0:在所有介面上監聽 (建議)- 在一個介面上接聽的特定 IP 位址
514:要接聽的通訊埠號碼 (例如514、1514、6514)
匯出工具設定:
<customer_id>:先前步驟中的客戶 IDlocation:將<LOCATION>替換為 Google SecOps 執行個體的區域 (例如us、europe或asia-southeast1)。匯出工具會以這個值做為chronicle.googleapis.com的前置字元。如需完整清單,請參閱「區域性端點」。project:依序前往「IAM 與管理」>「設定」,然後將<PROJECT_NUMBER>替換為專案編號。endpoint:維持設為chronicle.googleapis.com。- 根據平台,將
creds_file_path調整為服務帳戶 JSON 金鑰檔案的路徑 (選項 1):- Linux:
/opt/observiq-otel-collector/ingestion-auth.json
- Linux:
舊版擷取 API 匯出工具
如果您使用選項 2 的擷取驗證檔案,請將
exporters區塊替換為下列內容。將creds_file_path設為擷取驗證檔案的路徑。如果執行個體位於美國境外,請將malachiteingestion-pa.googleapis.com替換為區域端點 (例如europe-malachiteingestion-pa.googleapis.com)。exporters: chronicle/redhat_ds: compression: gzip creds_file_path: '/opt/observiq-otel-collector/ingestion-auth.json' customer_id: '<customer_id>' endpoint: malachiteingestion-pa.googleapis.com log_type: REDHAT_DIRECTORY_SERVER raw_log_field: body
儲存設定檔
- 編輯完畢後,請儲存檔案:
- Linux:依序按下
Ctrl+O、Enter和Ctrl+X
- Linux:依序按下
重新啟動 Bindplane 代理程式,套用變更
如要在 Linux 中重新啟動 Bindplane 代理程式,請執行下列指令:
sudo systemctl restart observiq-otel-collector確認服務正在執行:
sudo systemctl status observiq-otel-collector檢查記錄是否有錯誤:
sudo journalctl -u observiq-otel-collector -f
在 Red Hat 目錄伺服器中啟用稽核和稽核失敗記錄
根據預設,Red Hat 目錄伺服器會啟用存取、錯誤和安全性記錄,但會停用稽核和稽核失敗記錄。啟用這些記錄檔,即可擷取所有目錄變更和失敗的作業。
- 在目錄伺服器主機上,開啟具有 root 或 sudo 權限的終端機。
執行下列指令,啟用稽核記錄:
dsconf -D "cn=Directory Manager" instance_name config replace nsslapd-auditlog-logging-enabled=on執行下列指令,啟用稽核失敗記錄:
dsconf -D "cn=Directory Manager" instance_name config replace nsslapd-auditfaillog-logging-enabled=on確認已啟用所有記錄類型:
dsconf -D "cn=Directory Manager" instance_name config get nsslapd-accesslog-logging-enabled nsslapd-errorlog-logging-enabled nsslapd-auditlog-logging-enabled nsslapd-auditfaillog-logging-enabled nsslapd-securitylog-logging-enabled確認記錄目錄中是否有記錄檔:
ls -la /var/log/dirsrv/slapd-instance_name/
選用:使用網路控制台啟用記錄功能
- 登入 Red Hat Directory Server 網頁控制台。
- 選取執行個體。
- 依序前往 「Server」(伺服器) >「Logging」(記錄)。
- 選取要啟用的記錄類型 (例如「稽核記錄」)。
- 啟用所選記錄類型的記錄功能切換鈕。
- 按一下「Save Log Settings」。
設定 rsyslog,將目錄伺服器記錄轉送至 Bindplane 代理
Red Hat Directory Server 會將記錄寫入 /var/log/dirsrv/slapd-instance_name/ 中的檔案,而非直接寫入 syslog。使用 rsyslog imfile 模組監控這些記錄檔,並將項目轉送至 Bindplane 代理程式。
為目錄伺服器記錄檔轉送建立新的 rsyslog 設定檔:
sudo nano /etc/rsyslog.d/rhds-forward.conf在設定檔中新增下列內容:
# Load the imfile module to read log files module(load="imfile" PollingInterval="10") # Monitor the access log input(type="imfile" File="/var/log/dirsrv/slapd-instance_name/access" Tag="dirsrv-access" Severity="info" Facility="local6") # Monitor the error log input(type="imfile" File="/var/log/dirsrv/slapd-instance_name/errors" Tag="dirsrv-errors" Severity="err" Facility="local6") # Monitor the audit log input(type="imfile" File="/var/log/dirsrv/slapd-instance_name/audit" Tag="dirsrv-audit" Severity="info" Facility="local6") # Monitor the security log input(type="imfile" File="/var/log/dirsrv/slapd-instance_name/security" Tag="dirsrv-security" Severity="info" Facility="local6") # Forward all Directory Server logs to the Bindplane agent local6.* @BINDPLANE_IP:514驗證 rsyslog 設定語法:
sudo rsyslogd -N1重新啟動 rsyslog 服務,以套用變更:
sudo systemctl restart rsyslog檢查 Bindplane 代理程式記錄,確認目錄伺服器記錄是否已轉送:
sudo journalctl -u observiq-otel-collector -f
UDM 對應表
| 記錄欄位 | UDM 對應 | 邏輯 |
|---|---|---|
attrs_label |
about.labels |
已合併 |
cn_label |
about.labels |
已合併 |
conn_label |
about.labels |
已合併 |
csn_label |
about.labels |
已合併 |
err_label |
about.labels |
已合併 |
etime_label |
about.labels |
已合併 |
fd_label |
about.labels |
已合併 |
filter_label |
about.labels |
已合併 |
label |
about.labels |
已合併 |
method_label |
about.labels |
已合併 |
msgid_label |
about.labels |
已合併 |
name_label |
about.labels |
已合併 |
nentries_label |
about.labels |
已合併 |
offset_label |
about.labels |
已合併 |
op_label |
about.labels |
已合併 |
optime_label |
about.labels |
已合併 |
org_label |
about.labels |
已合併 |
ou_label |
about.labels |
已合併 |
scope_label |
about.labels |
已合併 |
slot_label |
about.labels |
已合併 |
tag_label |
about.labels |
已合併 |
targetop_label |
about.labels |
已合併 |
version_label |
about.labels |
已合併 |
wtime_label |
about.labels |
已合併 |
desc |
metadata.description |
直接對應 |
creationDate |
metadata.event_timestamp |
已剖析為 UNIX_MS |
recordDate |
metadata.event_timestamp |
剖析為 UNIX_MS |
time |
metadata.event_timestamp |
已剖析為 dd/MMM/yyyy:HH:mm:ss Z |
ts |
metadata.event_timestamp |
剖析為 MMM d HH:mm:ss |
operation |
metadata.product_event_type |
直接對應 |
mrId |
metadata.product_log_id |
直接對應 |
properties._ecs_agent_version |
metadata.product_version |
直接對應 |
host |
principal.asset.hostname |
直接對應 |
oid |
principal.asset.product_object_id |
直接對應 |
host |
principal.hostname |
直接對應 |
client_ip |
principal.ip |
已合併 |
namespace |
principal.namespace |
直接對應 |
user |
principal.user.userid |
直接對應 |
sec_result |
security_result |
已合併 |
properties._hostname |
target.asset.hostname |
直接對應 |
properties.host |
target.asset.hostname |
直接對應 |
properties._hostname |
target.hostname |
直接對應 |
properties.host |
target.hostname |
直接對應 |
target_ip |
target.ip |
已合併 |
properties.country |
target.location.country_or_region |
直接對應 |
properties._file_path |
target.process.file.full_path |
直接對應 |
properties._file_size |
target.process.file.size |
已重新命名/對應 |
discipline_label |
target.resource.attribute.labels |
已合併 |
document_type_label |
target.resource.attribute.labels |
已合併 |
environment_label |
target.resource.attribute.labels |
已合併 |
hostgroup_label |
target.resource.attribute.labels |
已合併 |
platform_label |
target.resource.attribute.labels |
已合併 |
product_label |
target.resource.attribute.labels |
已合併 |
project_label |
target.resource.attribute.labels |
已合併 |
base |
target.user.group_identifiers |
已合併 |
dn |
target.user.group_identifiers |
已合併 |
| 不適用 | metadata.event_type |
常數:NETWORK_CONNECTION |
| 不適用 | metadata.product_name |
常數:REDHAT_DIRECTORY_SERVER |
| 不適用 | metadata.vendor_name |
常數:REDHAT |
| 不適用 | target.platform |
常數:LINUX |
properties._file_inode |
event.idm.read_only_udm.additional.fields |
從變更記錄對應 |
properties._file_offset |
event.idm.read_only_udm.additional.fields |
從變更記錄對應 |
conn |
event.idm.read_only_udm.additional.fields |
從變更記錄對應 |
op |
event.idm.read_only_udm.additional.fields |
從變更記錄對應 |
err |
event.idm.read_only_udm.additional.fields |
從變更記錄對應 |
tag |
event.idm.read_only_udm.additional.fields |
從變更記錄對應 |
nentries |
event.idm.read_only_udm.additional.fields |
從變更記錄對應 |
wtime |
event.idm.read_only_udm.additional.fields |
從變更記錄對應 |
optime |
event.idm.read_only_udm.additional.fields |
從變更記錄對應 |
etime |
event.idm.read_only_udm.additional.fields |
從變更記錄對應 |
csn |
event.idm.read_only_udm.additional.fields |
從變更記錄對應 |
cn |
event.idm.read_only_udm.additional.fields |
從變更記錄對應 |
ou |
event.idm.read_only_udm.additional.fields |
從變更記錄對應 |
filter |
event.idm.read_only_udm.additional.fields |
從變更記錄對應 |
attrs |
event.idm.read_only_udm.additional.fields |
從變更記錄對應 |
scope |
event.idm.read_only_udm.additional.fields |
從變更記錄對應 |
o |
event.idm.read_only_udm.additional.fields |
從變更記錄對應 |
targetop |
event.idm.read_only_udm.additional.fields |
從變更記錄對應 |
msgid |
event.idm.read_only_udm.additional.fields |
從變更記錄對應 |
method |
event.idm.read_only_udm.additional.fields |
從變更記錄對應 |
version |
event.idm.read_only_udm.additional.fields |
從變更記錄對應 |
fd |
event.idm.read_only_udm.additional.fields |
從變更記錄對應 |
slot |
event.idm.read_only_udm.additional.fields |
從變更記錄對應 |
name |
event.idm.read_only_udm.additional.fields |
從變更記錄對應 |
properties.discipline" ,"properties.document_type" ,"properties.environment" ,"properties.hostgroup" ,"properties.platform" ,"properties.product |
target.resource.attribute.labels |
從變更記錄對應 |
變更記錄
還有其他問題嗎?向社群成員和 Google SecOps 專家尋求解答。