Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DeepSecurity support #27

Merged
merged 6 commits into from
Dec 16, 2020
Merged

Conversation

EijiSugiura
Copy link

Issue #, if available:

Description of changes:

Supports DeepSecurity CEF format logs.

CEF logs in JSON samples,

{
    "message":"Oct 28 14:46:28 ip-10-0-XX-XX CEF: 0|Trend Micro|Deep Security Agent|20.0.0.1194|1000552|Generic Cross Site Scripting(XSS) Prevention|10|cn1=2312751 cn1Label=Host ID dvc=10.0.XX.XX TrendMicroDsTenant=tenant name TrendMicroDsTenantId=XXXXXX dmac=0E:37:8C:B4:47:10 smac=0E:28:7B:CF:58:50 TrendMicroDsFrameType=IP src=10.0.XX.XX dst=10.0.YY.YY in=5770 cs3=DF 0 cs3Label=Fragmentation Bits proto=TCP spt=54056 dpt=8080 cs2=0x00 ACK PSH cs2Label=TCP Flags cnt=1 act=IDS:Log cn3=1472 cn3Label=DPI Packet Position cs5=60218 cs5Label=DPI Stream Position cs1=XSS Attack cs1Label=DPI Note cs6=8 cs6Label=DPI Flags TrendMicroDsPacketData=IDwh...YXku\\=\\=",
    "hostname":"ip-10-0-XX-XX",
    "timestamp":"2020-10-28T14:46:28+09:00"
}

{
    "message":"Nov 28 10:33:58 ip-10-0-XX-XX CEF: 0|Trend Micro|Deep Security Agent|20.0.0.1194|3002831|Unix - Syslog|6|cn1=2313513 cn1Label=Host ID dvc=10.0.XX.XX TrendMicroDsTenant=tenant name TrendMicroDsTenantId=XXXXXX cs1=Non standard syslog message (size too large) cs1Label=LI Description fname=/var/log/messages shost=ip-10-0-XX-XX msg=Nov 28 10:33:57 ip-10-0-XX-XX error: message:Could not push log to Elasticsearch: {\"took\"\\=>329, \"errors\"\\=>true, ...",
    "hostname":"ip-10-0-XX-XX",
    "timestamp":"2020-11-28T10:33:58+09:00"
}

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

'rule.category': 'cs1',
'host.id': 'cn1',
'event.original': 'msg',
}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should be done with ecs settings.


return logdata


Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Belows are copied from __init__.py.

Copy link
Contributor

@nakajiak nakajiak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

プルリクありがとうございます!いくつか修正して欲しいので対応をお願いします。

@@ -0,0 +1,165 @@
# es_loaderでDeepSecurityのログを取り込む
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

プルリクありがとうございます。
このファイルはこちらに保存をお願いします。
/docs/contributed/deepsecurity_ja.md
es-loaderの下に置くと、lambdaのパッケージサイズが増えるのと管理が煩雑になるので、docsは一カ所にまとめようと思います。

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

了解です。移動します!

"index_patterns" : [
"log-deepsecurity*"
],
"mappings" : {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

log-* ですでに定義済みのフィールドは、再度の定義は不要なので削除をお願いします。
destination,ip, destination.port, source.ip, souce.port, timestamp 等
文字列のtypeはデフォルトでkeywordとしてるので、数字になる可能性等がなければこちらも設定不要です。
https://github.com/aws-samples/siem-on-amazon-elasticsearch/blob/dc942d03c64c1130b9add025f32de0595fad0abc/source/lambda/deploy_es/data.ini#L42-L46

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

重複していたものと、keywordを指定したものを削除しました。

index = log-deepsecurity
s3_key = ds_agent
format = json
scripted_fields = True
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scrpted_fieldsはobsoletedする予定なので、こちらのフィールドに置き換えをお願いします。
https://github.com/aws-samples/siem-on-amazon-elasticsearch/blob/dc942d03c64c1130b9add025f32de0595fad0abc/source/lambda/es_loader/aws.ini#L184-L191

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

更新しておきました。

@@ -634,3 +634,30 @@ event.kind = event
script_ecs = cloud.instance.id event.action event.category event.outcome source.ip source.port user.name user.id
geoip = source


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

source/lambda/es_loader/user.ini.sample への追加でお願いします。

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

移動しました!

@@ -634,3 +634,30 @@ event.kind = event
script_ecs = cloud.instance.id event.action event.category event.outcome source.ip source.port user.name user.id
geoip = source


[deepsecurity]
# https://cloudone.trendmicro.com/docs/workload-security/event-syslog-message-formats/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

こちらのコメントの追加をお願いします

# See README for more details
# https://github.com/aws-samples/siem-on-amazon-elasticsearch/blob/main/docs/contributed/deepsecurity_ja.md

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

追加しておきました!

import base64
import json
import ipaddress

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

この方法で関数のimport をして、106行以降の削除お願いします

from siem import merge, put_value_into_dict, get_value_from_dict

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

importして、削除しておきました!

[deepsecurity]
index = log-deepsecurity
s3_key = ds_agent
format = json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CEFフォーマットのサポートのissueを作りました。+1をお願いします
#28

@nakajiak nakajiak merged commit 2918074 into aws-samples:develop Dec 16, 2020
@nakajiak
Copy link
Contributor

マージしました。ありがとうございます!

@nakajiak nakajiak added this to the v2.2.0 milestone Dec 16, 2020
@nakajiak nakajiak modified the milestones: v2.2.0, v2.1.1 Dec 25, 2020
@nakajiak nakajiak added the enhancement New feature or request label Dec 25, 2020
fshuhe added a commit to fshuhe/siem-on-amazon-opensearch-service that referenced this pull request Feb 7, 2022
fshuhe added a commit to fshuhe/siem-on-amazon-opensearch-service that referenced this pull request Feb 7, 2022
nakajiak added a commit that referenced this pull request Feb 7, 2022
Dashboard for S3 accesslog #27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants