收集 VSFTPD 日志

支持的语言:

本文档介绍了如何使用 Bindplane 将 VSFTPD 日志注入到 Google Security Operations。解析器使用 Grok 模式从日志中提取字段,并将它们映射到 UDM。它可处理各种日志类型,包括登录、上传、下载和目录操作,并使用 SSL/TLS 信息和操作(允许/阻止)等其他上下文来丰富数据。它还会针对不同的日志消息类型执行特定的转换,例如提取响应代码和说明,以及将文件大小转换为整数。

准备工作

请确保满足以下前提条件:

  • Google SecOps 实例
  • Windows 2016 或更高版本,或者具有 systemd 的 Linux 主机
  • 如果通过代理运行,请确保防火墙端口处于开放状态
  • 通过 VSFTPD 对主机进行特权访问

获取 Google SecOps 注入身份验证文件

  1. 登录 Google SecOps 控制台。
  2. 依次前往 SIEM 设置 > 收集代理
  3. 下载注入身份验证文件。将该文件安全地保存在将要安装 Bindplane 的系统上。

获取 Google SecOps 客户 ID

  1. 登录 Google SecOps 控制台。
  2. 依次前往 SIEM 设置 > 配置文件
  3. 复制并保存组织详细信息部分中的客户 ID

安装 Bindplane 代理

按照以下说明在 Windows 或 Linux 操作系统上安装 Bindplane 代理。

Windows 安装

  1. 以管理员身份打开命令提示符PowerShell
  2. 运行以下命令:

    msiexec /i "https://github.com/observIQ/bindplane-agent/releases/latest/download/observiq-otel-collector.msi" /quiet
    

Linux 安装

  1. 打开具有 root 或 sudo 权限的终端。
  2. 运行以下命令:

    sudo sh -c "$(curl -fsSlL https://github.com/observiq/bindplane-agent/releases/latest/download/install_unix.sh)" install_unix.sh
    

其他安装资源

如需了解其他安装选项,请参阅安装指南

配置 Bindplane 代理以注入 Syslog 并将其发送到 Google SecOps

  1. 访问配置文件:
    • 找到 config.yaml 文件。通常,它位于 Linux 上的 /etc/bindplane-agent/ 目录中或 Windows 上的安装目录中。
    • 使用文本编辑器(例如 nanovi 或记事本)打开该文件。
  2. 按如下方式修改 config.yaml 文件:

    receivers:
        udplog:
            # Replace the port and IP address as required
            listen_address: "0.0.0.0:514"
    
    exporters:
        chronicle/chronicle_w_labels:
            compression: gzip
            # Adjust the path to the credentials file you downloaded in Step 1
            creds_file_path: '/path/to/ingestion-authentication-file.json'
            # Replace with your actual customer ID from Step 2
            customer_id: <customer_id>
            endpoint: malachiteingestion-pa.googleapis.com
            # Add optional ingestion labels for better organization
            log_type: 'VSFTPD'
            raw_log_field: body
            ingestion_labels:
    
    service:
        pipelines:
            logs/source0__chronicle_w_labels-0:
                receivers:
                    - udplog
                exporters:
                    - chronicle/chronicle_w_labels
    
    • 根据基础架构的需要替换端口和 IP 地址。
    • <customer_id> 替换为实际的客户 ID。
    • /path/to/ingestion-authentication-file.json 更新为获取 Google SecOps 提取身份验证文件部分中保存身份验证文件的路径。

重启 Bindplane 代理以应用更改

  • 如需在 Linux 中重启 Bindplane 代理,请运行以下命令:

    sudo systemctl restart bindplane-agent
    
  • 如需在 Windows 中重启 Bindplane 代理,您可以使用服务控制台,也可以输入以下命令:

    net stop BindPlaneAgent && net start BindPlaneAgent
    

在 VSFTPD 上配置 Syslog

  1. 登录 VSFTPD 主机。
  2. 如需在 Ubuntu/Debian 中安装 rsyslog,请运行以下命令:

    sudo apt install rsyslog
    
  3. 如需在 CentOS/RHEL 中安装 rsyslog,请运行以下命令:

    sudo yum install rsyslog
    
  4. 修改 vsftpd 配置以使用 Syslog:

    sudo vi /etc/vsftpd.conf
    
  5. 确保已设置以下参数:

    syslog_enable=YES
    xferlog_enable=NO
    log_ftp_protocol=YES
    
  6. 保存并退出。

  7. 重启 vsftpd:

    sudo systemctl restart vsftpd
    
  8. 修改 rsyslog 配置,以将日志转发到 Bindplane 代理:

    sudo nano /etc/rsyslog.d/90-vsftpd.conf
    
  9. 添加以下行以使用 UDP(默认端口 514)转发日志:

    if ($programname == 'vsftpd') then @@BINDPLANE_IP:514
    
  10. BINDPLANE_IP 替换为实际的 Bindplane 代理 IP 地址。

    • 使用 @ 表示 UDP,使用 @@ 表示 TCP
  11. 重启 rsyslog:

    sudo systemctl restart rsyslog
    

UDM 映射表

日志字段 UDM 映射 逻辑
certificate security_result.detection_fields.key:“cert”
security_result.detection_fields.valuecertificate 的值
certificate 字段的值会映射到键为“cert”的 security_result.detection_fields 对象。
cipher network.tls.cipher cipher 字段的值会直接映射。
client_ip principal.ip client_ip 字段的值会直接映射。
date metadata.event_timestamp monthyeartime 搭配使用,以构建 metadata.event_timestamp。该格式派生自原始日志中的 timestamp 字段,经过解析并转换为时间戳对象。
day metadata.event_timestamp monthyeartime 搭配使用,以构建 metadata.event_timestamp
desc metadata.description desc 字段(从 type 字段中提取)的值会直接映射。这适用于“MKDIR”“RMDIR”和“DELETE”操作。
description network.ftp.command
security_result.description
target.file.full_path
如果 type 是“FTP 命令”,则该值会映射到 network.ftp.command。如果 type 为“DEBUG”且与特定 SSL 模式不匹配,则会映射到 security_result.description。如果 type 以“OK”开头,但不是“OK LOGIN”,并且日志描述了文件操作(MKDIR、RMDIR、DELETE),则映射到 target.file.full_path
file_name target.file.full_path file_name 字段的值会直接映射。
file_size network.received_bytes
network.sent_bytes
如果 type 是“OK DOWNLOAD”或“FAIL DOWNLOAD”,则该值会转换为无符号整数并映射到 network.received_bytes。如果 type 是“OK UPLOAD”或“FAIL UPLOAD”,则该值会转换为无符号整数并映射到 network.sent_bytes。如果 type 为“OK LOGIN”,则设置为“USER_LOGIN”。如果 type 与文件操作(“OK UPLOAD”“OK DOWNLOAD”“FAIL DOWNLOAD”“OK MKDIR”“OK RMDIR”“OK DELETE”“FAIL UPLOAD”)相关,则设置为“FILE_UNCATEGORIZED”。对于所有其他 type 值,设置为“STATUS_UPDATE”。始终设置为“VSFTPD”。始终设置为“VSFTPD”。始终设置为“VSFTPD”。
month metadata.event_timestamp dayyeartime 搭配使用,以构建 metadata.event_timestamp
pid principal.process.pid pid 字段的值会直接映射。
response_code network.http.response_code response_code 字段的值会转换为整数并进行映射。
reused_status security_result.detection_fields.key:“重复使用状态”
security_result.detection_fields.valuereused_status 的值
reused_status 字段的值会映射到键为“reused status”的 security_result.detection_fields 对象。
speed additional.fields.key:“download_speed”或“upload_speed”
additional.fields.value.string_valuespeed 的值
如果 type 为“OK DOWNLOAD”或“FAIL DOWNLOAD”,则该值会映射到键为“download_speed”的 additional.fields。如果 type 为“OK UPLOAD”或“FAIL UPLOAD”,则该值会映射到 additional.fields,键为“upload_speed”。
ssl_shutdown_state security_result.detection_fields.key:“SSL 关闭状态”
security_result.detection_fields.valuessl_shutdown_state 的值
ssl_shutdown_state 字段的值会映射到键为“SSL Shutdown State”的 security_result.detection_fields 对象。
ssl_version network.tls.version ssl_version 字段的值会直接映射。
time metadata.event_timestamp daymonthyear 搭配使用,以构建 metadata.event_timestamp
type metadata.description
security_result.action_details
type 字段的值会映射到 metadata.description,除非该值为“OK LOGIN”。当它表示允许或阻止操作时(以“OK”或“FAIL”开头),也会映射到 security_result.action_details
userid principal.user.userid
target.user.userid
如果 type 为“OK LOGIN”,则该值会映射到 target.user.userid。否则,它会映射到 principal.user.userid
year metadata.event_timestamp daymonthtime 搭配使用,以构建 metadata.event_timestamp。如果 type 为“OK LOGIN”,则设置为“NETWORK”。如果 type 为“OK LOGIN”,则设置为“MACHINE”。如果 type 以“OK”开头,则设置为“ALLOW”。如果 type 以“FAIL”开头,则设置为“BLOCK”。

需要更多帮助?从社区成员和 Google SecOps 专业人士那里获得解答。