Hadoop HttpFS を使用した調査の設定
概要
Hadoop は、分散コンピューティング環境で実行されるアプリケーションを処理するオープンソースのフレームワークです。Hadoop HttpFS は、Hadoop クラスタ内のノードで実行される REST API で、1つのアクセスポイントを介して Hadoop アクションを実行することを許可します。Sophos Linux Sensor (SLS) を使用すると、次のようにして、HttpFS を使用して データを Hadoop クラスタに送信するための調査を設定できます。
要件
- Hadoop Cluster
- SLS running in your environment
- Kerberos Server (Optional, required for using authentication)
- Kerberos keytab file for the sensor (Optional, required for using authentication)
1.SLS の設定:
次の設定ファイルを編集します: /etc/sophos/runtimedetections-rules.yaml
HttpFS 用のシンクを追加し、センサーがディレクトリを作成できるようにし、フライトレコーダーをオンにします。次に例を示します。
cloud_meta: auto
blob_storage_create_buckets_enabled: true
investigations:
reporting_interval: 30s
sinks:
- name: "[namenode hostname/ip]:14000/runtimedetections-investigations/"
backend: httpfs
automated: true
type: parquet
partition_format: "hostname_partition={{.Hostname}}/date_partition={{.Time.Format \"2006-01-02\"}}"
credentials
blob_storage_httpfs_user: [hadoop user to write as]
blob_storage_httpfs_use_ssl: false
flight_recorder:
enabled: true
tables:
- name: "shell_commands"
rows: 1000
enabled: true
- name: "tty_data"
rows: 1000
enabled: true
- name: "connections"
rows: 2000
enabled: true
- name: "sensor_metadata"
rows: 500
enabled: true
- name: "alerts"
rows: 100
enabled: true
- name: "sensors"
rows: 10
enabled: true
- name: "process_events"
rows: 4000
enabled: true
- name: "container_events"
rows: 300
enabled: true
変更したファイルを保存し、SLS を再起動します。次に、HDFS をチェックして、SLS が HttpFS に書き込みむことができたことを確認します。
hdfs dfs -ls /runtimedetections-investigations/
設定で有効化されたすべてのテーブルが一覧表示されるはずです。
drwxr--r-- - root supergroup 0 2020-10-27 18:33 /runtimedetections-investigations/alerts
drwxr--r-- - root supergroup 0 2020-10-27 18:33 /runtimedetections-investigations/connections
drwxr--r-- - root supergroup 0 2020-10-27 18:33 /runtimedetections-investigations/container_events
drwxr--r-- - root supergroup 0 2020-10-27 18:33 /runtimedetections-investigations/process_events
drwxr--r-- - root supergroup 0 2020-10-27 18:33 /runtimedetections-investigations/sensor_metadata
drwxr--r-- - root supergroup 0 2020-10-27 18:33 /runtimedetections-investigations/sensors
2.SLS 設定の編集:
SLS が正しく設定されたことを確認したら、レポート間隔をより適切な値に変更します。次に例を示します。
cloud_meta: auto
blob_storage_create_buckets_enabled: true
investigations:
reporting_interval: 5m
#...
3.Kerberos を使用した認証 (任意)
SLS は、Kerberos で保護された HttpFS クラスタに書き込むことができます。認証に必要な 4つの情報は次のとおりです。
blob_storage_httpfs_krb5_conf | The krb5 client config configured for the relevant kerberos environment. Note: Currently, the only encryption types supported by the client are: des3-cbc-sha1-kd and des3-hmac-sha1 |
blob_storage_httpfs_keytab | Path to the client keytab file |
blob_storage_httpfs_principal | The principal in the keytab to use. Ie. "root/webserver-7fc8ddf957-f25w5.default.svc.cluster.local" |
blob_storage_httpfs_domain | The domain for the principle. Ie. EXAMPLE.COM |
次に例を示します。
cloud_meta: auto
blob_storage_create_buckets_enabled: true
investigations:
reporting_interval: 30s
sinks:
- name: "[namenode hostname/ip]:14000/runtimedetections-investigations/"
backend: httpfs
automated: true
type: parquet
partition_format: "hostname_partition={{.Hostname}}/date_partition={{.Time.Format \"2006-01-02\"}}"
credentials:
blob_storage_httpfs_auth_type: kerberos
blob_storage_httpfs_use_ssl: false
blob_storage_httpfs_krb5_conf: /etc/sophos/krb5.conf
blob_storage_httpfs_keytab: /etc/sophos/root.keytab
blob_storage_httpfs_principal: "root/kerberos-sidecar-7fc8ddf957-f25w5.default.svc.cluster.local"
blob_storage_httpfs_domain: "EXAMPLE.COM"
flight_recorder:
enabled: true
tables:
- name: "shell_commands"
rows: 1000
enabled: true
- name: "tty_data"
rows: 1000
enabled: true
- name: "connections"
rows: 2000
enabled: true
- name: "sensor_metadata"
rows: 500
enabled: true
- name: "alerts"
rows: 100
enabled: true
- name: "sensors"
rows: 10
enabled: true
- name: "process_events"
rows: 4000
enabled: true
- name: "container_events"
rows: 300
enabled: true
設定を導入し、SLS を再起動します。次に、HDFS をチェックして、センサーが HttpFS に書き込みむことができることを確認します。
hdfs dfs -ls /runtimedetections-investigations/
設定で有効化されたすべてのテーブルが一覧表示されるはずです。
drwxr--r-- - root supergroup 0 2020-10-27 18:33 /runtimedetections-investigations/alerts
drwxr--r-- - root supergroup 0 2020-10-27 18:33 /runtimedetections-investigations/connections
drwxr--r-- - root supergroup 0 2020-10-27 18:33 /runtimedetections-investigations/container_events
drwxr--r-- - root supergroup 0 2020-10-27 18:33 /runtimedetections-investigations/process_events
drwxr--r-- - root supergroup 0 2020-10-27 18:33 /runtimedetections-investigations/sensor_metadata
drwxr--r-- - root supergroup 0 2020-10-27 18:33 /runtimedetections-investigations/sensors