Web フックを使用した警告のエクスポート
概要
Web フックは、Sophos Linux Sensor (SLS) が他のアプリケーションに警告を送信する方法の 1つです。出力の種類 webhook は、Web フックエンドポイントに HTTP リクエストで警告を送信します。この出力の種類を警告テンプレートと組み合わせると、ユーザーは複数のサードパーティサービスとのアドホック統合を作成できるため、非常に効果的です。一般的なユースケースには、警告の概要を Slack に送信したり、優先度の高い警告が表示された際に Jira チケットを自動作成したり、さらには Splunk のクラウドインスタンスに警告を直接送信したりする、などがあります。
この文章では、Web フックを使用して SLS 警告を自動的にエクスポートする方法について説明します。
注
ここで説明する手順を実行する前に、使用中の環境で SLS を実行することが非常に重要です。 使用中の環境に SLS をインストールする手順は、Sophos Linux Sensor のインストールを参照してください。
Web フックを使用して警告をログに記録するように SLS を設定する方法
Web フックを使用して、警告データを Web サーバーにエクスポートするように SLS を設定するには、任意のテキストエディタを使用して、/etc/sophos/runtimedetections-rules.yaml
に次の行を追加します。
次に例を示します。
alert_output:
outputs:
# Send Alerts to a local web server
- type: webhook
enabled: true
url: http://localhost:8080/sophos_alerts
# Send Alerts to an arbitrary service with all settings
- type: webhook
enabled: true
url: https://api.example-company.com/sophos-alerts
template: "New Sophos Alert {{.UUID}}"
timeout: 5
method: PUT
headers:
"Content-Type": "application/json"
"Authorization": "BEARER your-generated-token"
# Send Alerts to Slack using their webhook JSON format
- type: webhook
enabled: true
url: https://hooks.slack.com/services/123ABC/ab914B12eeigVh2xZ
template:'{"text": "New Sophos Alert {{.PolicyType}} {{.Description}}"}'
Key | Required | Description |
---|---|---|
type | yes | The output type. |
enabled | yes | Enables/disables the output. |
url | yes | The URL to send the request to. |
headers | no | The headers to pass along with the request. Defaults to "Content-Type: application/json". |
method | no | The HTTP method to use. Defaults to POST. |
timeout | no | The timeout in seconds. Defaults to 30. |
Web フックを使用して警告を S3 & SQS、Splunk、Google Cloud Storage、ELK、Azure Storage などにエクスポートする手順の詳細は、警告のエクスポートを参照してください。