-
Notifications
You must be signed in to change notification settings - Fork 458
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MongoDB Atlas] mongod audit datastream (#9020)
* add mongod audit datastream * MongoDB Atlas integration package with mongod_audit data stream * update dashboard and system test * add forwarded tag * update codeowners * update pr link in changelog * resolve review comments * update groupid description Co-authored-by: Ishleen Kaur <[email protected]> * resolve review comments * make secret parameter true * update readme * update system test * resolve review comments * update description in fields.yml * update redact field value * add more events for pipeline test --------- Co-authored-by: Ishleen Kaur <[email protected]>
- Loading branch information
1 parent
7da891c
commit 4b43599
Showing
19 changed files
with
2,479 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
FROM golang:1.19 | ||
|
||
COPY ./test /go | ||
COPY ./mongodb_atlas /go | ||
CMD ["./test"] | ||
|
||
HEALTHCHECK --interval=1s --retries=90 CMD curl localhost:7780/api/atlas/v2/groups/mongodb-group1/processes --digest -u admin:MongoDB@123 |
5 changes: 5 additions & 0 deletions
5
packages/mongodb_atlas/_dev/deploy/docker/mongodb_atlas/mongod_audit_data.log
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ "atype": "authenticate", "ts": { "$date": "2023-04-01T12:00:00.000Z" }, "uuid": { "$binary": "some-unique-identifier", "$type": "04" }, "local": { "ip": "127.0.0.1", "port": 27017 }, "remote": { "ip": "192.168.1.100", "port": 54320 }, "users": [{ "user": "auditUser", "db": "admin" }], "roles": [{ "role": "dbAdmin", "db": "admin" }], "result": 0 } | ||
{ "atype": "authCheck", "ts": { "$date": "2023-04-01T12:05:00.000Z" }, "uuid": { "$binary": "another-unique-identifier", "$type": "04" }, "local": { "ip": "127.0.0.1", "port": 27017 }, "remote": { "ip": "192.168.1.101", "port": 54321 }, "users": [{ "user": "userTest", "db": "test" }], "roles": [{ "role": "read", "db": "test" }], "result": 13 } | ||
{ "atype": "createIndex", "ts": { "$date": "2023-04-01T12:10:00.000Z" }, "uuid": { "$binary": "yet-another-unique-identifier", "$type": "04" }, "local": { "ip": "127.0.0.1", "port": 27017 }, "remote": { "ip": "192.168.1.102", "port": 54322 }, "users": [{ "user": "indexManager", "db": "test" }], "roles": [{ "role": "dbOwner", "db": "test" }], "result": 0 } | ||
{ "atype": "dropCollection", "ts": { "$date": "2023-04-01T12:15:00.000Z" }, "uuid": { "$binary": "unique-identifier-drop-coll", "$type": "04" }, "local": { "ip": "127.0.0.1", "port": 27017 }, "remote": { "ip": "192.168.1.103", "port": 54323 }, "users": [{ "user": "adminUser", "db": "test" }], "roles": [{ "role": "dbAdmin", "db": "test" }], "result": 0 } | ||
{ "atype": "createUser", "ts": { "$date": "2023-04-01T12:20:00.000Z" }, "uuid": { "$binary": "unique-identifier-create-user", "$type": "04" }, "local": { "ip": "127.0.0.1", "port": 27017 }, "remote": { "ip": "192.168.1.104", "port": 54324 }, "users": [{ "user": "admin", "db": "admin" }], "roles": [{ "role": "userAdmin", "db": "admin" }], "result": 0 } |
Binary file renamed
BIN
+6.66 MB
...ges/mongodb_atlas/_dev/deploy/docker/test → ...las/_dev/deploy/docker/mongodb_atlas/test
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
packages/mongodb_atlas/data_stream/mongod_audit/_dev/test/pipeline/test-common-config.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
dynamic_fields: | ||
"event.ingested": ".*" | ||
fields: | ||
tags: | ||
- preserve_original_event |
20 changes: 20 additions & 0 deletions
20
packages/mongodb_atlas/data_stream/mongod_audit/_dev/test/pipeline/test-mongod-audit.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"events": [ | ||
{ | ||
"@timestamp": "2024-02-08T06:20:49.729Z", | ||
"message": "No data for given time period or host is unreachable" | ||
}, | ||
{ | ||
"@timestamp": "2024-02-08T06:20:56.621Z", | ||
"message": "{ \"atype\": \"logout\", \"ts\": { \"$date\": \"2024-01-29T06:57:15.366+00:00\" }, \"uuid\": { \"$binary\": \"bY/PMV8IR36q+hmAJZYyfw==\", \"$type\": \"04\" }, \"local\": { \"ip\": \"127.0.0.1\", \"port\": 27017 }, \"remote\": { \"ip\": \"127.0.0.1\", \"port\": 43714 }, \"users\":[ { \"user\":\"mms-monitoring-agent\", \"db\":\"admin\" } ], \"roles\": [ { \"role\": \"backup\", \"db\": \"admin\" }, { \"role\": \"clusterAdmin\", \"db\": \"admin\" }, { \"role\": \"dbAdminAnyDatabase\", \"db\": \"admin\" }, { \"role\": \"readWriteAnyDatabase\", \"db\": \"admin\" }, { \"role\": \"restore\", \"db\": \"admin\" }, { \"role\": \"userAdminAnyDatabase\", \"db\": \"admin\" } ], \"result\": 0 }" | ||
}, | ||
{ | ||
"@timestamp": "2024-02-08T07:20:00.123Z", | ||
"message": "{\"atype\":\"authenticate\",\"ts\":{\"$date\":\"2023-04-01T12:00:00.000Z\"},\"uuid\":{\"$binary\":\"some-unique-identifier\",\"$type\":\"04\"},\"local\":{\"ip\":\"127.0.0.1\",\"port\":27017},\"remote\":{\"ip\":\"192.168.1.100\",\"port\":54320},\"users\":[{\"user\":\"auditUser\",\"db\":\"admin\"}],\"roles\":[{\"role\":\"dbAdmin\",\"db\":\"admin\"}],\"result\":0}" | ||
}, | ||
{ | ||
"@timestamp": "2024-02-08T07:30:56.234Z", | ||
"message": "{\"atype\":\"authCheck\",\"ts\":{\"$date\":\"2023-04-01T12:05:00.000Z\"},\"uuid\":{\"$binary\":\"another-unique-identifier\",\"$type\":\"04\"},\"local\":{\"ip\":\"127.0.0.1\",\"port\":27017},\"remote\":{\"ip\":\"192.168.1.101\",\"port\":54321},\"users\":[{\"user\":\"userTest\",\"db\":\"test\"}],\"roles\":[{\"role\":\"read\",\"db\":\"test\"}],\"result\":13}" | ||
} | ||
] | ||
} |
204 changes: 204 additions & 0 deletions
204
...db_atlas/data_stream/mongod_audit/_dev/test/pipeline/test-mongod-audit.json-expected.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,204 @@ | ||
{ | ||
"expected": [ | ||
null, | ||
{ | ||
"@timestamp": "2024-01-29T06:57:15.366Z", | ||
"ecs": { | ||
"version": "8.11.0" | ||
}, | ||
"event": { | ||
"action": "logout", | ||
"category": [ | ||
"network", | ||
"authentication" | ||
], | ||
"kind": "event", | ||
"module": "mongodb_atlas", | ||
"original": "{ \"atype\": \"logout\", \"ts\": { \"$date\": \"2024-01-29T06:57:15.366+00:00\" }, \"uuid\": { \"$binary\": \"bY/PMV8IR36q+hmAJZYyfw==\", \"$type\": \"04\" }, \"local\": { \"ip\": \"127.0.0.1\", \"port\": 27017 }, \"remote\": { \"ip\": \"127.0.0.1\", \"port\": 43714 }, \"users\":[ { \"user\":\"mms-monitoring-agent\", \"db\":\"admin\" } ], \"roles\": [ { \"role\": \"backup\", \"db\": \"admin\" }, { \"role\": \"clusterAdmin\", \"db\": \"admin\" }, { \"role\": \"dbAdminAnyDatabase\", \"db\": \"admin\" }, { \"role\": \"readWriteAnyDatabase\", \"db\": \"admin\" }, { \"role\": \"restore\", \"db\": \"admin\" }, { \"role\": \"userAdminAnyDatabase\", \"db\": \"admin\" } ], \"result\": 0 }", | ||
"type": [ | ||
"access", | ||
"info" | ||
] | ||
}, | ||
"mongodb_atlas": { | ||
"mongod_audit": { | ||
"local": { | ||
"ip": "127.0.0.1", | ||
"port": 27017 | ||
}, | ||
"remote": { | ||
"ip": "127.0.0.1", | ||
"port": 43714 | ||
}, | ||
"result": "Success", | ||
"user": { | ||
"names": [ | ||
{ | ||
"db": "admin", | ||
"user": "mms-monitoring-agent" | ||
} | ||
], | ||
"roles": [ | ||
{ | ||
"db": "admin", | ||
"role": "backup" | ||
}, | ||
{ | ||
"db": "admin", | ||
"role": "clusterAdmin" | ||
}, | ||
{ | ||
"db": "admin", | ||
"role": "dbAdminAnyDatabase" | ||
}, | ||
{ | ||
"db": "admin", | ||
"role": "readWriteAnyDatabase" | ||
}, | ||
{ | ||
"db": "admin", | ||
"role": "restore" | ||
}, | ||
{ | ||
"db": "admin", | ||
"role": "userAdminAnyDatabase" | ||
} | ||
] | ||
}, | ||
"uuid": { | ||
"binary": "bY/PMV8IR36q+hmAJZYyfw==", | ||
"type": "04" | ||
} | ||
} | ||
}, | ||
"related": { | ||
"ip": [ | ||
"127.0.0.1" | ||
] | ||
}, | ||
"tags": [ | ||
"preserve_original_event" | ||
] | ||
}, | ||
{ | ||
"@timestamp": "2023-04-01T12:00:00.000Z", | ||
"ecs": { | ||
"version": "8.11.0" | ||
}, | ||
"event": { | ||
"action": "authenticate", | ||
"category": [ | ||
"network", | ||
"authentication" | ||
], | ||
"kind": "event", | ||
"module": "mongodb_atlas", | ||
"original": "{\"atype\":\"authenticate\",\"ts\":{\"$date\":\"2023-04-01T12:00:00.000Z\"},\"uuid\":{\"$binary\":\"some-unique-identifier\",\"$type\":\"04\"},\"local\":{\"ip\":\"127.0.0.1\",\"port\":27017},\"remote\":{\"ip\":\"192.168.1.100\",\"port\":54320},\"users\":[{\"user\":\"auditUser\",\"db\":\"admin\"}],\"roles\":[{\"role\":\"dbAdmin\",\"db\":\"admin\"}],\"result\":0}", | ||
"type": [ | ||
"access", | ||
"info" | ||
] | ||
}, | ||
"mongodb_atlas": { | ||
"mongod_audit": { | ||
"local": { | ||
"ip": "127.0.0.1", | ||
"port": 27017 | ||
}, | ||
"remote": { | ||
"ip": "192.168.1.100", | ||
"port": 54320 | ||
}, | ||
"result": "Success", | ||
"user": { | ||
"names": [ | ||
{ | ||
"db": "admin", | ||
"user": "auditUser" | ||
} | ||
], | ||
"roles": [ | ||
{ | ||
"db": "admin", | ||
"role": "dbAdmin" | ||
} | ||
] | ||
}, | ||
"uuid": { | ||
"binary": "some-unique-identifier", | ||
"type": "04" | ||
} | ||
} | ||
}, | ||
"related": { | ||
"ip": [ | ||
"127.0.0.1", | ||
"192.168.1.100" | ||
] | ||
}, | ||
"tags": [ | ||
"preserve_original_event" | ||
] | ||
}, | ||
{ | ||
"@timestamp": "2023-04-01T12:05:00.000Z", | ||
"ecs": { | ||
"version": "8.11.0" | ||
}, | ||
"event": { | ||
"action": "authCheck", | ||
"category": [ | ||
"network", | ||
"authentication" | ||
], | ||
"kind": "event", | ||
"module": "mongodb_atlas", | ||
"original": "{\"atype\":\"authCheck\",\"ts\":{\"$date\":\"2023-04-01T12:05:00.000Z\"},\"uuid\":{\"$binary\":\"another-unique-identifier\",\"$type\":\"04\"},\"local\":{\"ip\":\"127.0.0.1\",\"port\":27017},\"remote\":{\"ip\":\"192.168.1.101\",\"port\":54321},\"users\":[{\"user\":\"userTest\",\"db\":\"test\"}],\"roles\":[{\"role\":\"read\",\"db\":\"test\"}],\"result\":13}", | ||
"type": [ | ||
"access", | ||
"info" | ||
] | ||
}, | ||
"mongodb_atlas": { | ||
"mongod_audit": { | ||
"local": { | ||
"ip": "127.0.0.1", | ||
"port": 27017 | ||
}, | ||
"remote": { | ||
"ip": "192.168.1.101", | ||
"port": 54321 | ||
}, | ||
"result": "Unauthorized to perform the operation", | ||
"user": { | ||
"names": [ | ||
{ | ||
"db": "test", | ||
"user": "userTest" | ||
} | ||
], | ||
"roles": [ | ||
{ | ||
"db": "test", | ||
"role": "read" | ||
} | ||
] | ||
}, | ||
"uuid": { | ||
"binary": "another-unique-identifier", | ||
"type": "04" | ||
} | ||
} | ||
}, | ||
"related": { | ||
"ip": [ | ||
"127.0.0.1", | ||
"192.168.1.101" | ||
] | ||
}, | ||
"tags": [ | ||
"preserve_original_event" | ||
] | ||
} | ||
] | ||
} |
13 changes: 13 additions & 0 deletions
13
packages/mongodb_atlas/data_stream/mongod_audit/_dev/test/system/test-default-config.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
vars: | ||
url: | ||
- http://{{Hostname}}:{{Port}} | ||
public_key: | ||
- admin | ||
private_key: | ||
- MongoDB@123 | ||
data_stream: | ||
vars: | ||
groupId: | ||
- mongodb-group1 | ||
input: cel | ||
service: mongodbatlas |
Oops, something went wrong.