S3/Athena を使用した調査データの取得
S3
Sophos Liunux Sensor (SLS) メタイベント用と、クエリの結果用の 2つのバケットが追加で必要です。バケット名とリージョンをメモしてください。
SLS の設定
SLS が実行されている場所の /etc/sophos/runtimedetections-rules.yaml
を編集することで、調査をサポートするデータを送信するようにセンサーを設定できます。
次に例を示します。
cloud_meta: auto
# blob_storage_create_buckets_enabled adds the ability for the sensor to create buckets
# if the bucket doesn't exist.By default this field is set to false.
blob_storage_create_buckets_enabled: true
investigations:
# enable_incremental_flush adds the ability to flush row groups rather than
# writing files during each flush event.Enabling this will result in larger files
# being created.By default this field is set to false.
#
# Minimum chunksizes for an incremental flush:
# GCP: 256KB
# AWS: 5MB
# AZURE: 1MB
enable_incremental_flush: true
# reporting_interval sets a time interval for forced flushes.
reporting_interval: 5m
# timeout set the amount of time allowed for investigations data to be written
# to a sink.By default the timeout is 1/3 of the reporting_interval duration.
timeout: 90s
# sinks are a list of destinations where investigations data should be sent.
sinks:
- name: <investigations-metadata-bucket-name>
backend: aws
automated: true
type: parquet
flight_recorder:
enabled: true
tables:
- name: "shell_commands"
enabled: true
- name: "tty_data"
enabled: true
- name: "sensors"
enabled: true
- name: "sensor_metadata"
enabled: true
- name: "connections"
enabled: true
- name: "process_events"
enabled: true
- name: "container_events"
enabled: true
IAM
SLS パーミッション
作成したバケットへの s3:CreateBucket
および s3:PutObject
パーミッションをセンサーに許可する必要があります。バケット内のすべてのオブジェクトへのアクセスを許可します。
S3 への認証オプション
ユーザーは、次のオプションを使用して S3 で認証できます。
- EC2 インスタンスの認証情報
- EKS サービスアカウントのロール
- 環境変数
- ファイル内の認証情報
EC2 インスタンスの認証情報
SLS は、EC2 インスタンスの認証情報を自動的に検出し、それらを使用して s3 で認証します。
EKS サービスアカウントのロール
EKS を使用する際、SLS は、サービスアカウントの AWS IAM ロールによって提供される認証情報を自動的に検出して使用します。
環境変数
認証のもう 1つの方法は、次の環境変数を定義することです。
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_SESSION_TOKEN (任意)
ファイル内の認証情報
ファイル内の認証情報は、センサーの runtimedetections.yaml
ファイルの「credentials」フィールドで定義できます。
次に例を示します。
sinks:
- name: <investigations-metadata-bucket-name>
backend: aws
automated: true
type: parquet
credentials:
blob_storage_access_key_id: XXX
blob_storage_secret_access_key: XXXX
blob_storage_session_token: xxx (optional)
blob_storage_region: us-east-1