收集 Linux auditd 和 AIX 系統記錄

支援的國家/地區:

這個剖析器會處理 SYSLOG 格式的 Linux 稽核記錄,並將其轉換為 UDM。這個外掛程式會處理 JSON 格式和純文字記錄訊息,並使用 grok、XML 剖析和 JSON 剖析技術擷取欄位,然後根據事件類型將這些欄位對應至適當的 UDM 欄位。剖析器也會處理 AIX 系統的特定稽核記錄格式,並使用 security_result 和中繼詳細資料等其他欄位擴充 UDM。

事前準備

  • 確認您有 Google Security Operations 執行個體。
  • 確認您具備 Auditd 主機的根存取權。
  • 確認您已在 Auditd 主機上安裝 rsyslog。
  • 請確認您有 Windows 2012 SP2 以上版本或 Linux 主機 (含 systemd)。
  • 如果透過 Proxy 執行,請確認防火牆通訊埠已開啟。

取得 Google SecOps 擷取驗證檔案

  1. 登入 Google SecOps 控制台。
  2. 依序前往「SIEM 設定」>「收集代理程式」
  3. 下載擷取驗證檔案

取得 Google SecOps 客戶 ID

  1. 登入 Google SecOps 控制台。
  2. 依序前往「SIEM 設定」>「設定檔」
  3. 複製並儲存「機構詳細資料」專區中的客戶 ID

安裝 Bindplane 代理程式

  1. 如要在 Windows 上安裝,請執行下列指令碼:
    msiexec /i "https://github.com/observIQ/bindplane-agent/releases/latest/download/observiq-otel-collector.msi" /quiet
  2. 如要在 Linux 上安裝,請執行下列指令碼:
    sudo sh -c "$(curl -fsSlL https://github.com/observiq/bindplane-agent/releases/latest/download/install_unix.sh)" install_unix.sh
  3. 如需其他安裝選項,請參閱這份安裝指南

設定 Bindplane 代理程式,擷取系統記錄檔並傳送至 Google SecOps

  1. 存取安裝 Bindplane 的電腦。
  2. 按照下列方式編輯 config.yaml 檔案:

    receivers:
      tcplog:
        # Replace the below port <54525> and IP <0.0.0.0> with your specific values
        listen_address: "0.0.0.0:54525" 
    
    exporters:
        chronicle/chronicle_w_labels:
            compression: gzip
            # Adjust the creds location below according the placement of the credentials file you downloaded
            creds: '{ json file for creds }'
            # Replace <customer_id> below with your actual ID that you copied
            customer_id: <customer_id>
            endpoint: malachiteingestion-pa.googleapis.com
            # You can apply ingestion labels below as preferred
            ingestion_labels:
            log_type: SYSLOG
            namespace: auditd
            raw_log_field: body
    service:
        pipelines:
            logs/source0__chronicle_w_labels-0:
                receivers:
                    - tcplog
                exporters:
                    - chronicle/chronicle_w_labels
    
  3. 使用下列指令重新啟動 Bindplane 代理程式,以套用變更: sudo systemctl bindplane restart

從 Auditd 匯出系統記錄

  1. 存取要匯出稽核記錄的電腦。
  2. 開啟 Auditd 設定檔 (通常位於 /etc/audit/auditd.conf)。

    sudo vi /etc/audit/auditd.conf
    
  3. 找出或新增下列指令行,設定 auditd:

    active = yes
    output = syslog
    log_format = ENRICHED
    dispatcher = /sbin/audispd
    

選用:指定 Syslog Facility:在 auditd.conf 中新增或修改下列行:

```none
syslog_facility = LOG_AUTHPRIV
```
  1. 開啟 audispd 設定檔 (通常位於 /etc/audisp/plugins.d/syslog.conf):

    sudo vi /etc/audisp/plugins.d/syslog.conf
    
  2. 找出或新增下列指令行,設定 audispd:

    active = yes
    direction = out
    path = builtin_syslog
    type = builtin
    args = LOG_INFO
    format = string
    
  3. 重新啟動 Auditd 服務,以套用變更:

    sudo systemctl restart auditd
    
  4. 使用 tail 等工具監控系統記錄,並確認 Auditd 記錄是否正在傳送:

    tail -f /var/log/syslog | grep auditd # Follow syslog and filter for auditd messages (path may vary depending on your system)
    
  5. 編輯 rsyslog.conf 或建立自訂設定:

    sudo vi /etc/rsyslog.d/50-audit-forwarding.conf
    
  6. 新增轉送記錄的規則:

    • if $programname == 'auditd' then @@<Bindplane_Agent>:<Bindplane_Port>
    • 使用 @ 表示 UDP,或使用 @@ 表示 TCP
    • <BindPlane_Agent> 替換為伺服器的 IP/主機名稱。
    • <BindPlane_Port> 替換為伺服器的通訊埠。
  7. 重新啟動 rsyslog 服務,以套用變更:

    sudo systemctl restart rsyslog
    

UDM 對應表

記錄欄位 UDM 對應 邏輯
acct target.user.user_display_name 原始記錄中的 acct 值會對應至 UDM 中的 target.user.user_display_name 欄位。代表與活動相關聯的帳戶。
addr principal.ip 原始記錄中的 addr 值會對應至 UDM 中的 principal.ip 欄位。這代表事件中主要參與者的 IP 位址。
additional.fields additional.fields 系統會將從剖析的鍵/值組合或標籤中取得的其他欄位,新增至 UDM 的 additional.fields 陣列。
agent.googleapis.com/log_file_path (未對應) 這個標籤出現在部分原始記錄中,但未對應至 UDM 中的 IDM 物件。
algo (本範例未使用) 雖然剖析器和部分原始記錄中都有這個欄位,但提供的範例並未使用這個欄位,最終 UDM 中也不會顯示。
application principal.application 衍生自原始記錄中的 terminal 欄位,或視記錄類型而定,衍生自 exe 等其他欄位。代表相關應用程式。
arch security_result.about.platform_version 原始記錄的「arch」欄位架構會對應至「security_result.about.platform_version」。
auid about.user.useridsecurity_result.detection_fields.auid 稽核使用者 ID (auid) 會對應至 about.user.userid,並新增為 security_result 中的偵測欄位。
cmd target.process.command_line 原始記錄 cmd 欄位中的指令會對應至 target.process.command_line
collection_time (未對應) 這個欄位是記錄收集時間,不會對應至 UDM 中的 IDM 物件。
comm principal.application 指令名稱 (comm) 會對應至 principal.application
compute.googleapis.com/resource_name principal.hostname 這個標籤的資源名稱會對應至 principal.hostname
create_time (未對應) 這個欄位不會對應至 UDM 中的 IDM 物件。
cwd security_result.detection_fields.cwd 目前的工作目錄 (cwd) 會新增為 security_result 中的偵測欄位。
data (已處理) data 欄位包含主要記錄訊息,並由剖析器處理,以擷取各種欄位。不會直接對應至單一 UDM 欄位。
exe principal.process.file.full_pathtarget.process.file.full_path 可執行檔路徑 (exe) 會視情況對應至 principal.process.file.full_pathtarget.process.file.full_path
extensions.auth.type extensions.auth.type 剖析器邏輯會根據事件類型設定驗證類型。通常會設為 MACHINEAUTHTYPE_UNSPECIFIED
fp network.tls.client.certificate.sha256 系統會剖析指紋 (fp),擷取 SHA256 雜湊並對應至 network.tls.client.certificate.sha256
insertId (未對應) 這個欄位不會對應至 UDM 中的 IDM 物件。
jsonPayload.message (已處理) 這個欄位包含 JSON 格式的主要記錄訊息,並由剖析器處理。
key security_result.about.registry.registry_key 「鍵」欄位會對應至 security_result.about.registry.registry_key
labels (已處理) 系統會處理原始記錄中的標籤,並對應至各種 UDM 欄位或新增至 additional.fields
logName (未對應) 這個欄位不會對應至 UDM 中的 IDM 物件。
msg security_result.summary 訊息 (msg) 通常用於填入 security_result.summary 欄位。
network.application_protocol network.application_protocol 由剖析器邏輯根據事件類型設定 (例如 SSH、HTTP)。
network.direction network.direction 由剖析器邏輯根據事件類型設定 (例如 INBOUND、OUTBOUND)。
network.ip_protocol network.ip_protocol 由剖析器邏輯設定,通常是 SSH 事件的 TCP。
network.session_id network.session_id ses 欄位對應或從其他欄位衍生。
network.tls.cipher network.tls.cipher 密碼資訊會從原始記錄中擷取,並對應至這個欄位。
network.tls.curve network.tls.curve 系統會從原始記錄中擷取金鑰交換曲線,並對應至這個欄位。
pid principal.process.pidtarget.process.pid 程序 ID (pid) 會視情況對應至 principal.process.pidtarget.process.pid
ppid principal.process.parent_process.pidtarget.process.parent_process.pid 父項程序 ID (ppid) 會視環境對應至 principal.process.parent_process.pidtarget.process.parent_process.pid
principal.asset.hostname principal.asset.hostname 從「principal.hostname」複製的項目。
principal.asset.ip principal.asset.ip 從「principal.ip」複製的項目。
principal.platform principal.platform 由剖析器邏輯根據作業系統設定 (例如 LINUX)。
principal.port principal.port 與主體相關聯的通訊埠編號。
principal.user.group_identifiers principal.user.group_identifiers 與主要使用者相關聯的群組 ID。
receiveTimestamp (未對應) 這個欄位是記錄接收時間戳記,不會對應至 UDM 中的 IDM 物件。
res security_result.action_details 結果 (res) 會對應至 security_result.action_details
resource.labels (未對應) 這些標籤會出現在部分原始記錄中,但不會對應至 UDM 中的 IDM 物件。
resource.type (未對應) 這個欄位會出現在部分原始記錄中,但不會對應至 UDM 中的 IDM 物件。
security_result.action security_result.action 由剖析器邏輯根據 res 欄位設定 (例如 ALLOW、BLOCK)。
security_result.detection_fields security_result.detection_fields 原始記錄中的各種欄位會以鍵/值組合的形式新增至這個陣列,做為背景資訊。
security_result.rule_id security_result.rule_id 由剖析器邏輯設定,通常用於系統呼叫事件的 type_name
security_result.severity security_result.severity 由剖析器邏輯根據原始記錄中的嚴重程度層級設定。
security_result.summary security_result.summary 活動摘要,通常衍生自 msg 欄位或其他相關欄位。
ses network.session_id 工作階段 ID (ses) 已對應至 network.session_id
source (未對應) 這個欄位包含記錄來源的中繼資料,不會對應至 UDM 中的 IDM 物件。
subj (已處理) 系統會處理主旨欄位 (subj),擷取使用者和安全性背景資訊。
syscall security_result.about.labels.Syscall 系統呼叫號碼會新增為 security_result.about 中的標籤。
target.administrative_domain target.administrative_domain 目標使用者的網域。
target.group.group_display_name target.group.group_display_name 目標群組的名稱。
target.ip target.ip 目標的 IP 位址。
target.port target.port 與目標相關聯的通訊埠編號。
target.process.command_line target.process.command_line 目標程序的指令列。
target.resource.type target.resource.type 目標資源類型,由剖析器邏輯設定 (例如 CREDENTIAL、SETTING)。
target.user.attribute.permissions target.user.attribute.permissions 與目標使用者相關的權限。
target.user.group_identifiers target.user.group_identifiers 與目標使用者相關聯的群組 ID。
target.user.userid target.user.userid 目標的使用者 ID。
textPayload (已處理) 記錄的文字酬載,由剖析器處理以擷取各種欄位。
timestamp metadata.event_timestamp 事件的時間戳記。
tty security_result.about.labels.tty tty 會在 security_result.about 中新增為標籤。
type metadata.product_event_type 事件類型 (type) 會對應至 metadata.product_event_type
uid principal.user.useridtarget.user.userid 系統會根據環境,將使用者 ID (uid) 對應至 principal.user.useridtarget.user.userid

還有其他問題嗎?向社群成員和 Google SecOps 專業人員尋求答案。