Nix System Red Hat 로그 수집

다음에서 지원:

이 문서에서는 Bindplane을 사용하여 RHEL 서버 (Unix 시스템) 로그를 Google Security Operations에 수집하는 방법을 설명합니다. 파서는 syslog 및 JSON 형식 로그를 수집하고, 다양한 UDM 필드를 빈 문자열로 초기화하고, message 필드에서 여러 문자열 대체 작업을 실행한 다음 메시지를 JSON으로 파싱하려고 시도합니다. JSON 파싱이 실패하면 grok 패턴을 사용하여 messageevent_details.original 콘텐츠를 기반으로 필드를 추출하고, 추출된 필드를 이벤트 유형 및 다양한 조건부 검사를 기반으로 UDM에 매핑하여 다양한 Unix 시스템 프로세스 및 서비스의 다양한 로그 형식과 구조를 처리합니다.

시작하기 전에

다음 기본 요건이 충족되었는지 확인합니다.

  • Google SecOps 인스턴스
  • 프록시 뒤에서 실행하는 경우 방화벽 포트가 열려 있음
  • RHEL 서버에 대한 액세스 권한 관리

Google SecOps 수집 인증 파일 가져오기

  1. Google SecOps 콘솔에 로그인합니다.
  2. SIEM 설정 > 수집 에이전트로 이동합니다.
  3. 수집 인증 파일을 다운로드합니다. Bindplane이 설치될 시스템에 파일을 안전하게 저장합니다.

Google SecOps 고객 ID 가져오기

  1. Google SecOps 콘솔에 로그인합니다.
  2. SIEM 설정 > 프로필로 이동합니다.
  3. 조직 세부정보 섹션에서 고객 ID를 복사하여 저장합니다.

Bindplane 에이전트 설치

Linux 설치

  1. 루트 또는 sudo 권한으로 터미널을 엽니다.
  2. 다음 명령어를 실행합니다.

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

추가 설치 리소스

추가 설치 옵션은 설치 가이드를 참고하세요.

Syslog를 수집하여 Google SecOps로 전송하도록 Bindplane 에이전트 구성

  1. 구성 파일에 액세스합니다.
    • config.yaml 파일을 찾습니다. 일반적으로 Linux의 /etc/bindplane-agent/ 디렉터리에 있습니다.
    • 텍스트 편집기 (예: nano 또는 vi)를 사용하여 파일을 엽니다.
  2. 다음과 같이 config.yaml 파일을 수정합니다.

          receivers:
              filelog/linux:
              include:
                - /var/log/messages
                - /var/log/lastlog
                - /var/log/btmp
                - /var/log/wtmp
                - /var/log/secure
                - /var/log/cron
                - /var/log/maillog
                - /var/log/boot
              start_at: end
              poll_interval: 5s
    
          exporters:
              chronicle/linux:
                  # Adjust the path to the credentials file you downloaded in Step 1
                  creds: '/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: 'NIX_SYSTEM'
                  override_log_type: false
                  raw_log_field: body
    
          service:
            pipelines:
              logs/linux:
                receivers:
                - filelog/linux
            exporters: [chronicle/linux]
          ```
    
  1. <customer_id>를 실제 고객 ID로 바꿉니다.
  2. Google SecOps 수집 인증 파일 가져오기 섹션에서 인증 파일이 저장된 경로로 /path/to/ingestion-authentication-file.json를 업데이트합니다.

    Bindplane 에이전트 시작 및 변경사항 적용

  3. Bindplane 에이전트를 시작합니다.

    sudo systemctl start bindplane-agent
    
  4. observIQ otel collector 서비스를 사용 설정합니다.

    systemctl enable --now bindplane-agent
    
  5. 필요한 경우 Bindplane 에이전트를 다시 시작합니다.

    sudo systemctl restart bindplane-agent
    

UDM 매핑 테이블

로그 필드 UDM 매핑 논리
AccessControlRuleAction security_result.action AccessControlRuleActionAllow이면 ALLOW로 설정합니다. AccessControlRuleActionBlock이면 BLOCK로 설정합니다.
ACPolicy security_result.rule_labels 키: ACPolicy, 값: ACPolicy
AccessControlRuleName security_result.rule_name 직접 매핑
acct event.idm.read_only_udm.target.user.userid 따옴표와 백슬래시를 삭제한 후 직접 매핑
addr event.idm.read_only_udm.target.ip, event.idm.read_only_udm.target.asset.ip 비어 있지 않거나 ? 또는 UNKNOWN인 경우 직접 매핑
ApplicationProtocol event.idm.read_only_udm.network.application_protocol 직접 매핑
auid event.idm.read_only_udm.additional.fields 키: auid, 값: auid
comm event.idm.read_only_udm.target.process.command_line 직접 매핑
command event.idm.read_only_udm.target.process.command_line 선행/후행 공백을 삭제한 후 직접 매핑
Computer event.idm.read_only_udm.principal.hostname, event.idm.read_only_udm.principal.asset.hostname 직접 매핑 비어 있으면 HostName를 사용합니다.
ConnectionID security_result.detection_fields 키: Connection ID, 값: ConnectionID
cwd event.idm.read_only_udm.target.process.file.full_path 따옴표를 삭제한 후 직접 매핑
data message 그록 패턴에 사용됩니다.
desc security_result.description 직접 매핑
description event.idm.read_only_udm.metadata.description, security_result.description 직접 매핑
descript security_result.description 해시를 삭제한 후 직접 매핑
DeviceUUID event.idm.read_only_udm.metadata.product_log_id 직접 매핑
DNSQuery event.idm.read_only_udm.additional.fields 키: DNSQuery, 값: DNSQuery
DNSRecordType event.idm.read_only_udm.additional.fields 키: DNSRecordType, 값: DNSRecordType
DNSResponseType event.idm.read_only_udm.additional.fields 키: DNSResponseType, 값: DNSResponseType
DNS_TTL event.idm.read_only_udm.additional.fields 키: DNS_TTL, 값: DNS_TTL
DstIP event.idm.read_only_udm.target.ip, event.idm.read_only_udm.target.asset.ip 직접 매핑
DstPort event.idm.read_only_udm.target.port 직접 매핑, 정수로 변환됨
dvc event.idm.read_only_udm.principal.ip, event.idm.read_only_udm.principal.asset.ip, event.idm.read_only_udm.principal.hostname, event.idm.read_only_udm.principal.asset.hostname, event.idm.read_only_udm.intermediary.ip, event.idm.read_only_udm.target.ip, event.idm.read_only_udm.target.asset.ip, event.idm.read_only_udm.target.hostname, event.idm.read_only_udm.target.asset.hostname 유효한 IP인 경우 principal/target IP에 매핑됩니다. 호스트 이름인 경우 principal/target 호스트 이름에 매핑됩니다. 유효한 IP인 경우 중개자 IP에도 사용됩니다.
EgressInterface event.idm.read_only_udm.principal.asset.attribute.labels 키: EgressInterface, 값: EgressInterface
EgressVRF event.idm.read_only_udm.principal.asset.attribute.labels 키: EgressVRF, 값: EgressVRF
EgressZone event.idm.read_only_udm.target.location.name 직접 매핑
eventType event.idm.read_only_udm.metadata.product_event_type, event.idm.read_only_udm.target.application 직접 매핑 SERVICE_STARTSERVICE_STOP의 경우 target.application에 매핑된 후 삭제됩니다.
EventTime @timestamp 타임스탬프로 파싱됩니다.
exe event.idm.read_only_udm.target.process.command_line 따옴표와 백슬래시를 삭제한 후 직접 매핑
extended_description event.idm.read_only_udm.metadata.description 하이픈과 따옴표를 삭제한 후 직접 매핑
Facility event.idm.read_only_udm.principal.resource.attribute.labels 키: Facility, 값: Facility
filepath event.idm.read_only_udm.principal.process.file.full_path 직접 매핑
file_path event.idm.read_only_udm.target.file.full_path 직접 매핑
file_path_value event.idm.read_only_udm.target.file.full_path 직접 매핑
FirstPacketSecond security_result.detection_fields 키: FirstPacketSecond, 값: FirstPacketSecond
from event.idm.read_only_udm.network.email.from 각괄호를 삭제한 후 직접 매핑
generic_ip event.idm.read_only_udm.principal.ip, event.idm.read_only_udm.principal.asset.ip 유효한 IP이고 A256:이 아닌 경우 직접 매핑
gid event.idm.read_only_udm.target.user.group_identifiers 직접 매핑
grp event.idm.read_only_udm.target.group.group_display_name 따옴표와 백슬래시를 삭제한 후 직접 매핑
hashing_algo security_result.summary 직접 매핑
home event.idm.read_only_udm.target.file.full_path 직접 매핑
HostName Computer Computer가 비어 있는 경우 사용됩니다.
HostIP event.idm.read_only_udm.principal.ip, event.idm.read_only_udm.principal.asset.ip % 앞의 HostIP 부분이 추출되어 validated_ip로 매핑됩니다.
hostname event.idm.read_only_udm.target.hostname, event.idm.read_only_udm.target.asset.hostname, event.idm.read_only_udm.principal.hostname, event.idm.read_only_udm.principal.asset.hostname 비어 있지 않거나 ?인 경우 직접 매핑
host_name event.idm.read_only_udm.target.hostname, event.idm.read_only_udm.target.asset.hostname 직접 매핑
InitiatorBytes event.idm.read_only_udm.network.sent_bytes 직접 매핑, 부호 없는 정수로 변환됨
InitiatorPackets event.idm.read_only_udm.network.sent_packets 직접 매핑, 정수로 변환됨
insertId event.idm.read_only_udm.metadata.product_log_id 직접 매핑
InstanceID security_result.detection_fields 키: Instance ID, 값: InstanceID
int_dvc event.idm.read_only_udm.intermediary.hostname 직접 매핑
ip event.idm.read_only_udm.target.ip, event.idm.read_only_udm.target.asset.ip, event.idm.read_only_udm.principal.ip, event.idm.read_only_udm.principal.asset.ip 직접 매핑
ip_protocol event.idm.read_only_udm.network.ip_protocol 직접 매핑
laddr event.idm.read_only_udm.principal.ip, event.idm.read_only_udm.principal.asset.ip 비어 있지 않거나 ?인 경우 직접 매핑
level security_result.severity info이면 INFORMATIONAL로 설정합니다.
log.syslog.facility.name event.idm.read_only_udm.target.application 직접 매핑
log.syslog.severity.name security_result.severity Emergency이면 HIGH로 설정합니다.
logName logname 직접 매핑
log_description security_result.description 직접 매핑
log_level security_result.severity error이면 ERROR로 설정합니다.
log_summary security_result.summary 직접 매핑
logger_name event.idm.read_only_udm.principal.resource.attribute.labels 키: logger_name, 값: logger_name
log_type event.idm.read_only_udm.metadata.log_type NIX_SYSTEM로 하드코딩되었습니다.
lport event.idm.read_only_udm.principal.port 직접 매핑, 정수로 변환됨
MG event.idm.read_only_udm.principal.resource.attribute.labels 키: MG, 값: MG
method event.idm.read_only_udm.network.http.method 직접 매핑, 대문자로 변환됨
msg1 event.idm.read_only_udm.metadata.description, event.idm.read_only_udm.additional.fields, security_result.description grok 패턴을 사용하여 파싱되었습니다. event_typeGENERIC_EVENT이면 description에 매핑됩니다.
msg2 event.idm.read_only_udm.network.received_bytes, security_result.summary 숫자가 포함된 경우 부호 없는 정수로 변환되고 received_bytes에 매핑됩니다. 그렇지 않으면 summary로 매핑됩니다.
NAPPolicy security_result.rule_labels 키: NAPPolicy, 값: NAPPolicy
name event.idm.read_only_udm.target.process.file.full_path 따옴표를 삭제한 후 직접 매핑
outcome security_result.action Succeeded이거나 success을 포함하는 경우 ALLOW로 설정합니다.
p_id event.idm.read_only_udm.target.process.pid 직접 매핑
pid event.idm.read_only_udm.target.process.pid, event.idm.read_only_udm.principal.process.pid 직접 매핑
principal_hostname event.idm.read_only_udm.principal.hostname, event.idm.read_only_udm.principal.asset.hostname 직접 매핑
principal_ip event.idm.read_only_udm.principal.ip, event.idm.read_only_udm.principal.asset.ip 직접 매핑
principal_present event.idm.read_only_udm.metadata.event_type truehas_targettrue이면 event_typeNETWORK_UNCATEGORIZED로 설정합니다. true 또는 user_presenttrue이면 event_typeUSER_UNCATEGORIZED로 설정합니다.
process event.idm.read_only_udm.target.application, event.idm.read_only_udm.metadata.product_event_type 직접 매핑 eventType가 비어 있으면 target.application로 사용됩니다.
ProcessID event.idm.read_only_udm.principal.process.pid 직접 매핑, 문자열로 변환됨
ProcessName event.idm.read_only_udm.principal.resource.attribute.labels 키: ProcessName, 값: ProcessName
prod_eve_type event.idm.read_only_udm.metadata.product_event_type 직접 매핑
product_event_type event.idm.read_only_udm.metadata.product_event_type 직접 매핑
Protocol event.idm.read_only_udm.network.ip_protocol icmp, udp 또는 tcp (대소문자 구분 안 함)와 일치하는 경우 해당 대문자 값에 매핑됩니다.
proto event.idm.read_only_udm.network.application_protocol ssh 또는 ssh2이면 SSH로 설정합니다.
pwd event.idm.read_only_udm.target.file.full_path 직접 매핑
reason security_result.summary, security_result.description actiondesc와 함께 사용하여 security_result.description를 만듭니다. security_result.summary에도 매핑됩니다.
relayHostname event.idm.read_only_udm.intermediary.hostname 직접 매핑
relayIp event.idm.read_only_udm.intermediary.ip 직접 매핑
res security_result.summary 직접 매핑
resource.labels.instance_id event.idm.read_only_udm.target.resource.product_object_id 직접 매핑
resource.labels.project_id event.idm.read_only_udm.target.asset.attribute.cloud.project.id 직접 매핑
resource.labels.zone event.idm.read_only_udm.target.asset.attribute.cloud.availability_zone 직접 매핑
resource.type event.idm.read_only_udm.target.resource.resource_subtype 직접 매핑
response_code event.idm.read_only_udm.network.http.response_code 직접 매핑, 정수로 변환됨
ResponderBytes event.idm.read_only_udm.network.received_bytes 직접 매핑, 부호 없는 정수로 변환됨
ResponderPackets event.idm.read_only_udm.network.received_packets 직접 매핑, 정수로 변환됨
rhost event.idm.read_only_udm.additional.fields 키: rhost, 값: rhost
ruser srcUser 직접 매핑
sec_action security_result.action action 또는 eventType을 기반으로 매핑됩니다.
sec_summary security_result.summary 직접 매핑
security_action security_result.action 직접 매핑
sent_bytes event.idm.read_only_udm.network.sent_bytes 직접 매핑, 부호 없는 정수로 변환됨
ses event.idm.read_only_udm.network.session_id, event.idm.read_only_udm.network.session_duration 숫자인 경우 UNIX 타임스탬프로 파싱되고 session_duration에 매핑됩니다. 그렇지 않으면 session_id로 매핑됩니다.
SeverityLevel security_result.severity 값에 따라 다양한 심각도로 매핑됩니다 (notice/info -> INFORMATIONAL, warn -> HIGH, error -> ERROR, other -> UNKNOWN_SEVERITY).
sessionId event.idm.read_only_udm.network.session_id 직접 매핑
size event.idm.read_only_udm.network.received_bytes 직접 매핑, 부호 없는 정수로 변환됨
source event.idm.read_only_udm.principal.hostname, event.idm.read_only_udm.principal.asset.hostname 선행 공백을 삭제한 후 직접 매핑
SourceSystem event.idm.read_only_udm.principal.resource.attribute.labels, event.idm.read_only_udm.principal.platform 키: SourceSystem, 값: SourceSystem platform에도 매핑됩니다 (Linux -> LINUX, Window -> WINDOWS, Mac/iOS -> MAC).
SrcIP event.idm.read_only_udm.principal.ip, event.idm.read_only_udm.principal.asset.ip 직접 매핑
SrcPort event.idm.read_only_udm.principal.port 직접 매핑, 정수로 변환됨
srcIp event.idm.read_only_udm.principal.ip, event.idm.read_only_udm.principal.asset.ip 직접 매핑
srcPort event.idm.read_only_udm.principal.port 직접 매핑, 정수로 변환됨
srcUser event.idm.read_only_udm.principal.user.userid 직접 매핑
src_user event.idm.read_only_udm.principal.user.userid 직접 매핑
src_user_display_name event.idm.read_only_udm.principal.user.user_display_name 직접 매핑
status security_result.action Deferred이면 BLOCK로 설정합니다. Sent이면 ALLOW로 설정합니다.
summary security_result.summary 직접 매핑
SyslogMessage security_result.description 직접 매핑
targetEmail event.idm.read_only_udm.network.email.to 직접 매핑
targetEmailfrom event.idm.read_only_udm.network.email.from 직접 매핑
targetHostname event.idm.read_only_udm.target.hostname, event.idm.read_only_udm.target.asset.hostname 직접 매핑
target_hostname event.idm.read_only_udm.target.hostname, event.idm.read_only_udm.target.asset.hostname 직접 매핑
target_ip event.idm.read_only_udm.target.ip, event.idm.read_only_udm.target.asset.ip 직접 매핑
target_mac event.idm.read_only_udm.target.mac 직접 매핑
target_uri event.idm.read_only_udm.target.url 직접 매핑
TenantId event.idm.read_only_udm.principal.user.product_object_id 직접 매핑
terminal event.idm.read_only_udm.additional.fields 키: terminal, 값: 비어 있지 않은 경우 terminal 또는 ?
TimeGenerated event.idm.read_only_udm.metadata.collected_timestamp 타임스탬프로 파싱됩니다.
timestamp @timestamp 타임스탬프로 파싱됩니다.
tls_cipher event.idm.read_only_udm.network.tls.cipher 직접 매핑
Type event.idm.read_only_udm.principal.resource.attribute.labels 키: Type, 값: Type
uid event.idm.read_only_udm.principal.user.userid 0이면 root로 설정합니다. 그렇지 않으면 직접 매핑합니다.
uid_2 event.idm.read_only_udm.target.user.userid uid가 비어 있으면 직접 매핑
unit event.idm.read_only_udm.target.application 직접 매핑
url event.idm.read_only_udm.target.url 직접 매핑
user username 직접 매핑
username event.idm.read_only_udm.target.user.userid, event.idm.read_only_udm.principal.user.userid 직접 매핑
user_display_name event.idm.read_only_udm.target.user.user_display_name 직접 매핑
user_present event.idm.read_only_udm.metadata.event_type true 또는 principal_presenttrue이면 event_typeUSER_UNCATEGORIZED로 설정합니다.
_Internal_WorkspaceResourceId event.idm.read_only_udm.target.resource.attribute.labels, event.idm.read_only_udm.target.resource.product_object_id 키: _Internal_WorkspaceResourceId, 값: _Internal_WorkspaceResourceId 정기 결제 ID가 추출되어 product_object_id에 매핑됩니다.
_ItemId event.idm.read_only_udm.principal.resource.attribute.labels 키: _ItemId, 값: _ItemId
_ResourceId event.idm.read_only_udm.principal.resource.attribute.labels, event.idm.read_only_udm.principal.resource.product_object_id 키: _ResourceId, 값: _ResourceId 정기 결제 ID가 추출되어 product_object_id에 매핑됩니다.
_timestamp @timestamp 타임스탬프로 파싱됩니다.
_timestamp_tz @timestamp 타임스탬프로 파싱됩니다.
  • event.idm.read_only_udm.metadata.event_type: 처음에는 GENERIC_EVENT로 설정된 후 파서 로직에 따라 덮어쓰여집니다.
  • event.idm.read_only_udm.metadata.product_name: Unix System로 하드 코딩됩니다.
  • event.idm.read_only_udm.extensions.auth.type: 특정 이벤트 유형의 경우 MACHINE로 설정됩니다.
  • event.idm.read_only_udm.target.asset.attribute.cloud.environment: Google Cloud 감사 로그의 경우 GOOGLE_CLOUD_PLATFORM로 설정됩니다.
  • event.idm.read_only_udm.target.resource.resource_type: Google Cloud 감사 로그의 경우 VIRTUAL_MACHINE로 설정됩니다.
  • event.idm.read_only_udm.extensions.auth.mechanism: 로그인 이벤트의 경우 USERNAME_PASSWORD로 설정합니다.
  • has_target_resource: resource.labels.instance_id 또는 _Internal_WorkspaceResourceId가 있는 경우 true로 설정합니다.

도움이 더 필요하신가요? 커뮤니티 회원 및 Google SecOps 전문가로부터 답변을 받으세요.