Skip to content

Commit ee91f6f

Browse files
ablakley-r7igorski-r7
authored andcommitted
[SOAR-18655] Mimecast V2 (#3063)
* Initial plugin * Initial plugin
1 parent ae7333a commit ee91f6f

23 files changed

+508
-0
lines changed

plugins/mimecast_v2/.CHECKSUM

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"spec": "4f06521e5c8a2a4506cf3cda093ee4ad",
3+
"manifest": "e0e42959bee1c96589545b1afb0b1f61",
4+
"setup": "ea867af34e3163ba06ef9660ec9023fc",
5+
"schemas": [
6+
{
7+
"identifier": "connection/schema.py",
8+
"hash": "8918ffcfac8cbf4e1b5696cb9dd9ddaf"
9+
},
10+
{
11+
"identifier": "monitor_siem_logs/schema.py",
12+
"hash": "0a566c7d94e6689de4d0528d24470b94"
13+
}
14+
]
15+
}

plugins/mimecast_v2/.dockerignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
unit_test/**/*
2+
unit_test
3+
examples/**/*
4+
examples
5+
tests
6+
tests/**/*
7+
**/*.json
8+
**/*.tar
9+
**/*.gz

plugins/mimecast_v2/Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM --platform=linux/amd64 rapid7/insightconnect-python-3-slim-plugin:6.2.3
2+
3+
LABEL organization=rapid7
4+
LABEL sdk=python
5+
6+
WORKDIR /python/src
7+
8+
ADD ./plugin.spec.yaml /plugin.spec.yaml
9+
ADD ./requirements.txt /python/src/requirements.txt
10+
11+
RUN if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
12+
13+
ADD . /python/src
14+
15+
RUN pip install .
16+
17+
# User to run plugin code. The two supported users are: root, nobody
18+
USER nobody
19+
20+
ENTRYPOINT ["/usr/local/bin/icon_mimecast_v2"]

plugins/mimecast_v2/Makefile

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Include other Makefiles for improved functionality
2+
INCLUDE_DIR = ../../tools/Makefiles
3+
MAKEFILES := $(wildcard $(INCLUDE_DIR)/*.mk)
4+
# We can't guarantee customers will have the include files
5+
# - prefix to ignore Makefiles when not present
6+
# https://www.gnu.org/software/make/manual/html_node/Include.html
7+
-include $(MAKEFILES)
8+
9+
ifneq ($(MAKEFILES),)
10+
$(info [$(YELLOW)*$(NORMAL)] Use ``make menu`` for available targets)
11+
$(info [$(YELLOW)*$(NORMAL)] Including available Makefiles: $(MAKEFILES))
12+
$(info --)
13+
else
14+
$(warning Makefile includes directory not present: $(INCLUDE_DIR))
15+
endif
16+
17+
VERSION?=$(shell grep '^version: ' plugin.spec.yaml | sed 's/version: //')
18+
NAME?=$(shell grep '^name: ' plugin.spec.yaml | sed 's/name: //')
19+
VENDOR?=$(shell grep '^vendor: ' plugin.spec.yaml | sed 's/vendor: //')
20+
CWD?=$(shell basename $(PWD))
21+
_NAME?=$(shell echo $(NAME) | awk '{ print toupper(substr($$0,1,1)) tolower(substr($$0,2)) }')
22+
PKG=$(VENDOR)-$(NAME)-$(VERSION).tar.gz
23+
24+
# Set default target explicitly. Make's default behavior is the first target in the Makefile.
25+
# We don't want that behavior due to includes which are read first
26+
.DEFAULT_GOAL := default # Make >= v3.80 (make -version)
27+
28+
29+
default: image tarball
30+
31+
tarball:
32+
$(info [$(YELLOW)*$(NORMAL)] Creating plugin tarball)
33+
rm -rf build
34+
rm -rf $(PKG)
35+
tar -cvzf $(PKG) --exclude=$(PKG) --exclude=tests --exclude=run.sh *
36+
37+
image:
38+
$(info [$(YELLOW)*$(NORMAL)] Building plugin image)
39+
docker build --pull -t $(VENDOR)/$(NAME):$(VERSION) .
40+
docker tag $(VENDOR)/$(NAME):$(VERSION) $(VENDOR)/$(NAME):latest
41+
42+
regenerate:
43+
$(info [$(YELLOW)*$(NORMAL)] Refreshing schema from plugin.spec.yaml)
44+
insight-plugin refresh
45+
46+
export: image
47+
$(info [$(YELLOW)*$(NORMAL)] Exporting docker image)
48+
@printf "\n ---> Exporting Docker image to ./$(VENDOR)_$(NAME)_$(VERSION).tar\n"
49+
@docker save $(VENDOR)/$(NAME):$(VERSION) | gzip > $(VENDOR)_$(NAME)_$(VERSION).tar
50+
51+
# Make will not run a target if a file of the same name exists unless setting phony targets
52+
# https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html
53+
.PHONY: default tarball image regenerate
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env python
2+
# GENERATED BY INSIGHT-PLUGIN - DO NOT EDIT
3+
import os
4+
import json
5+
from sys import argv
6+
7+
Name = "Mimecast V2"
8+
Vendor = "rapid7"
9+
Version = "1.0.0"
10+
Description = "[Mimecast](https://www.mimecast.com) is a set of cloud services designed to provide next generation protection against advanced email-borne threats such as malicious URLs, malware, impersonation attacks, as well as internally generated threats, with a focus on email security. This plugin utilizes the [Mimecast API](https://www.mimecast.com/developer/documentation)"
11+
12+
13+
def main():
14+
if 'http' in argv:
15+
if os.environ.get("GUNICORN_CONFIG_FILE"):
16+
with open(os.environ.get("GUNICORN_CONFIG_FILE")) as gf:
17+
gunicorn_cfg = json.load(gf)
18+
if gunicorn_cfg.get("worker_class", "sync") == "gevent":
19+
from gevent import monkey
20+
monkey.patch_all()
21+
elif 'gevent' in argv:
22+
from gevent import monkey
23+
monkey.patch_all()
24+
25+
import insightconnect_plugin_runtime
26+
from icon_mimecast_v2 import connection, actions, triggers, tasks
27+
28+
class ICONMimecastV2(insightconnect_plugin_runtime.Plugin):
29+
def __init__(self):
30+
super(self.__class__, self).__init__(
31+
name=Name,
32+
vendor=Vendor,
33+
version=Version,
34+
description=Description,
35+
connection=connection.Connection()
36+
)
37+
self.add_task(tasks.MonitorSiemLogs())
38+
39+
40+
"""Run plugin"""
41+
cli = insightconnect_plugin_runtime.CLI(ICONMimecastV2())
42+
cli.run()
43+
44+
45+
if __name__ == "__main__":
46+
main()

plugins/mimecast_v2/extension.png

4.21 KB
Loading

plugins/mimecast_v2/help.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# Description
2+
3+
[Mimecast](https://www.mimecast.com) is a set of cloud services designed to provide next generation protection against advanced email-borne threats such as malicious URLs, malware, impersonation attacks, as well as internally generated threats, with a focus on email security. This plugin utilizes the [Mimecast API](https://www.mimecast.com/developer/documentation)
4+
5+
# Key Features
6+
7+
* Email security
8+
* Malicious URL and attachment detection
9+
10+
# Requirements
11+
12+
* Mimecast 2.0 Application Client ID
13+
* Mimecast 2.0 Application Client Secret
14+
15+
# Supported Product Versions
16+
17+
* Mimecast 2.0 API 2025-01-23
18+
19+
# Documentation
20+
21+
## Setup
22+
23+
The connection configuration accepts the following parameters:
24+
25+
|Name|Type|Default|Required|Description|Enum|Example|Placeholder|Tooltip|
26+
| :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- |
27+
|client_id|credential_secret_key|None|True|The Mimecast 2.0 Application Client ID|None|ZA7vkbu7NqcfBcGrXyWW8Rzk2sv2un2DCY7GGCX4BFWgJBZM|None|None|
28+
|client_secret|credential_secret_key|None|True|The Mimecast 2.0 Application Client Secret|None|ohknqKJpCd99XTkHjeVuc2TgYaKWrWn4tEEHCLkXFZhFgDRdcpNGVx3EipX2CvmE|None|None|
29+
30+
Example input:
31+
32+
```
33+
{
34+
"client_id": "ZA7vkbu7NqcfBcGrXyWW8Rzk2sv2un2DCY7GGCX4BFWgJBZM",
35+
"client_secret": "ohknqKJpCd99XTkHjeVuc2TgYaKWrWn4tEEHCLkXFZhFgDRdcpNGVx3EipX2CvmE"
36+
}
37+
```
38+
39+
## Technical Details
40+
41+
### Actions
42+
43+
*This plugin does not contain any actions.*
44+
### Triggers
45+
46+
*This plugin does not contain any triggers.*
47+
### Tasks
48+
49+
50+
#### Monitor SIEM Logs
51+
52+
This task is used to monitor and retrieve the latest logs
53+
54+
##### Input
55+
56+
*This task does not contain any inputs.*
57+
58+
##### Output
59+
60+
|Name|Type|Required|Description|Example|
61+
| :--- | :--- | :--- | :--- | :--- |
62+
|data|[]object|True|List of logs|[{"processingId": "processingId", "aggregateId": "aggregateId", "spamProcessingDetail": "Spam Processing Detail", "numberAttachments": "1", "subject": "siem_recipient - email subject line", "tlsVersion": "TLSv1.2", "senderEnvelope": "[email protected]", "messageId": "messageId", "senderHeader": "[email protected]", "rejectionType": "rejectionType", "eventType": "receipt", "accountId": "C0A0", "recipients": "[email protected]", "tlsCipher": "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384", "action": "Allow", "subType": "Allow", "spamInfo": None, "senderIp": "123.123.123.123", "timestamp": 1689685338597, "direction": "Inbound", "spamScore": "0", "spamDetectionLevel": "0"}]|
63+
64+
Example output:
65+
66+
```
67+
{
68+
"data": [
69+
{
70+
"accountId": "C0A0",
71+
"action": "Allow",
72+
"aggregateId": "aggregateId",
73+
"direction": "Inbound",
74+
"eventType": "receipt",
75+
"messageId": "messageId",
76+
"numberAttachments": "1",
77+
"processingId": "processingId",
78+
"recipients": "[email protected]",
79+
"rejectionType": "rejectionType",
80+
"senderEnvelope": "[email protected]",
81+
"senderHeader": "[email protected]",
82+
"senderIp": "123.123.123.123",
83+
"spamDetectionLevel": "0",
84+
"spamInfo": null,
85+
"spamProcessingDetail": "Spam Processing Detail",
86+
"spamScore": "0",
87+
"subType": "Allow",
88+
"subject": "siem_recipient - email subject line",
89+
"timestamp": 1689685338597,
90+
"tlsCipher": "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
91+
"tlsVersion": "TLSv1.2"
92+
}
93+
]
94+
}
95+
```
96+
97+
### Custom Types
98+
99+
*This plugin does not contain any custom output types.*
100+
101+
## Troubleshooting
102+
103+
104+
# Version History
105+
106+
* 1.0.0 - Initial plugin
107+
108+
# Links
109+
110+
* [Mimecast](http://mimecast.com)
111+
112+
## References
113+
114+
* [Mimecast API](https://www.mimecast.com/developer/documentation)

plugins/mimecast_v2/icon.png

4.56 KB
Loading
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# GENERATED BY INSIGHT-PLUGIN - DO NOT EDIT
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# GENERATED BY INSIGHT-PLUGIN - DO NOT EDIT
2+
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# GENERATED BY INSIGHT-PLUGIN - DO NOT EDIT
2+
from .connection import Connection
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import insightconnect_plugin_runtime
2+
from .schema import ConnectionSchema, Input
3+
# Custom imports below
4+
5+
6+
class Connection(insightconnect_plugin_runtime.Connection):
7+
8+
def __init__(self):
9+
super(self.__class__, self).__init__(input=ConnectionSchema())
10+
11+
def connect(self, params):
12+
self.logger.info("Connect: Connecting...")
13+
# START INPUT BINDING - DO NOT REMOVE - ANY INPUTS BELOW WILL UPDATE WITH YOUR PLUGIN SPEC AFTER REGENERATION
14+
self.cleint_secret = params.get(Input.CLEINT_SECRET)
15+
self.client_id = params.get(Input.CLIENT_ID)
16+
# END INPUT BINDING - DO NOT REMOVE
17+
18+
def test(self):
19+
# TODO: Implement connection test
20+
pass
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# GENERATED BY INSIGHT-PLUGIN - DO NOT EDIT
2+
import insightconnect_plugin_runtime
3+
import json
4+
5+
6+
class Input:
7+
CLIENT_ID = "client_id"
8+
CLIENT_SECRET = "client_secret"
9+
10+
11+
class ConnectionSchema(insightconnect_plugin_runtime.Input):
12+
schema = json.loads(r"""
13+
{
14+
"type": "object",
15+
"title": "Variables",
16+
"properties": {
17+
"client_id": {
18+
"$ref": "#/definitions/credential_secret_key",
19+
"title": "Client ID",
20+
"description": "The Mimecast 2.0 Application Client ID",
21+
"order": 1
22+
},
23+
"client_secret": {
24+
"$ref": "#/definitions/credential_secret_key",
25+
"title": "Client Secret",
26+
"description": "The Mimecast 2.0 Application Client Secret",
27+
"order": 2
28+
}
29+
},
30+
"required": [
31+
"client_id",
32+
"client_secret"
33+
],
34+
"definitions": {
35+
"credential_secret_key": {
36+
"id": "credential_secret_key",
37+
"type": "object",
38+
"title": "Credential: Secret Key",
39+
"description": "A shared secret key",
40+
"required": [
41+
"secretKey"
42+
],
43+
"properties": {
44+
"secretKey": {
45+
"type": "string",
46+
"title": "Secret Key",
47+
"description": "The shared secret key",
48+
"format": "password",
49+
"displayType": "password"
50+
}
51+
}
52+
}
53+
}
54+
}
55+
""")
56+
57+
def __init__(self):
58+
super(self.__class__, self).__init__(self.schema)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# GENERATED BY INSIGHT-PLUGIN - DO NOT EDIT
2+
3+
from .monitor_siem_logs.task import MonitorSiemLogs
4+
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# GENERATED BY INSIGHT-PLUGIN - DO NOT EDIT
2+
from .task import MonitorSiemLogs

0 commit comments

Comments
 (0)