Skip to content

Commit 340b5a9

Browse files
authored
Merge pull request #92 from cybsecmaster/feature/doc-69
DOC-69 changes
2 parents 4aa818f + a503d46 commit 340b5a9

32 files changed

+287
-62
lines changed

docs/thehive/administration/email-intake-connector.md

Lines changed: 282 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -5,75 +5,294 @@ This documentation outlines the utilization of the Email Intake Connector for au
55
The Email Intake Connector facilitates the connection of mailboxes used to receive cybersecurity alerts. It automatically transforms new emails into alerts within TheHive platform. Presently, the primary function supported is the creation of alerts regardless of the received email content.
66

77

8-
![](../images/administration-guides/eic-1.png)
8+
![](/thehive/images/administration-guides/eic-1.png)
99

1010
---
1111

1212
## Configuration
1313

1414
### Global Configuration
1515

16-
The only parameter that requires adjustment is the ``refresh interval``.
17-
18-
![](../images/administration-guides/eic-2.png)
16+
The only parameter that requires adjustment is the `refresh interval`. By default, the connector polls mailboxes every *5* minutes. Adjust the frequency by increasing or decreasing the value.
1917

18+
![](/thehive/images/administration-guides/eic-2.png)
2019

2120
 
2221

2322
### Adding a Mailbox
2423

2524
Configuration options are available for Microsoft 365 (OAuth2) and Google Workspace (OAuth2). If you use another email provider service, configuration through IMAP is necessary.
2625

27-
![](../images/administration-guides/eic-3.png)
26+
![](/thehive/images/administration-guides/eic-3.png)
2827

2928
 
3029

31-
#### Microsoft Configuration
30+
=== "Microsoft MS365"
3231

33-
To configure Microsoft settings, the following values need completion:
32+
### Setting up Microsoft365 for TheHive
33+
34+
This section provides detailed instructions to configure Microsoft 365 to allow TheHive access to a shared mailbox. Please follow these steps to ensure proper integration.
3435

35-
- `Email address` of the mailbox
36-
- `clientId`
37-
- `tenantId`
38-
- `secret`
36+
 
3937

40-
Refer to Microsoft documentation for instructions on obtaining these values.
38+
#### Prerequisites
39+
- Administrator account on Microsoft 365.
40+
- PowerShell installed and configured.
41+
- A shared mailbox already created in Microsoft 365 (e.g., `test-shared-mailbox@strangebee.com`).
4142

42-
![](../images/administration-guides/eic-4.png)
43+
![](/thehive/images/administration-guides/ms-intake-1.png){ width="600" }
4344

44-
 
45+
 
4546

46-
#### Google Workspace Configuration
47+
#### Step-by-Step Configuration
4748

48-
For Google Workspace accounts, an authorization request is essential during the configuration process. Complete the following values:
49+
1. **Create a Mail-Enabled Security Group**
4950

50-
- `Email address` of the mailbox
51-
- `clientId`
52-
- `secret`
51+
- Create a security group that includes the shared mailbox. This group will be used to restrict access to the application for the shared mailbox only.
52+
- Navigate to **Admin > Exchange Admin Center**, and create a **Mail-Enabled Security Group**.
53+
- Add the shared mailbox as a member of the security group.
5354

54-
Refer to Google documentation for instructions on obtaining these values.
55+
![](/thehive/images/administration-guides/ms-intake-2.png)
5556

56-
![](../images/administration-guides/eic-5.png)
57+
2. **Register a New Application in Microsoft Entra**
5758

58-
 
59+
- As an administrator, navigate to **Microsoft Entra admin center**.
60+
- Go to **Admin > Identity > Applications > App registrations**.
5961

60-
#### IMAP Configuration
62+
![](/thehive/images/administration-guides/ms-intake-3.png)
63+
6164

62-
For IMAP configuration, you'll need to input the following information:
65+
- Gather the following information:
66+
- **Tenant ID**
67+
- **Client ID (App ID)**
68+
- **Object ID** of the enterprise application
6369

64-
- Host: `host`
65-
- Port: `port` (default: 993)
70+
![](/thehive/images/administration-guides/ms-intake-4.png)
6671

67-
Additionally, provide your mailbox credentials. We recommend enabling SSL Check Certificate Authority.
72+
3. **Create a Secret for the Application**
6873

69-
![](../images/administration-guides/eic-6.png)
70-
 
74+
- In the registered application page, go to **Certificates & Secrets**.
75+
- Create a new secret, which will be used as an OAuth2 input to authenticate the service.
76+
- Save the secret value securely for later use.
77+
78+
![](/thehive/images/administration-guides/ms-intake-5.png)
79+
80+
4. **Assign API Permissions**
81+
82+
- In the registered application page, go to **API Permissions**.
83+
- Ensure the application has the following permissions:
84+
- **Office 365 Exchange Online / IMAP.AccessAsApp**
85+
86+
![](/thehive/images/administration-guides/ms-intake-6.png)
87+
88+
5. **Configure PowerShell Access**
89+
90+
- Define the necessary values for the configuration:
91+
92+
```powershell
93+
$AppID = '{ClientID}'
94+
$TenantID = '{TenantID}'
95+
$ObjectID = '{ObjectID}'
96+
$SecurityGroup = '{SecurityGroup}' # The mail-enabled security group
97+
$MailBox = '{MailBox}' # The shared mailbox
98+
```
99+
100+
- Run the following PowerShell commands to configure access:
101+
102+
- **Define App Permissions:**
103+
104+
```powershell
105+
New-ServicePrincipal -AppId $AppID -ServiceId $ObjectID
106+
```
107+
108+
- **Grant Security Group Full Access to the Mailbox:**
109+
110+
```powershell
111+
Add-MailboxPermission -Identity $MailBox -User $SecurityGroup -AccessRights FullAccess
112+
```
113+
114+
- **Restrict Access to Members of the Security Group Only:**
115+
116+
```powershell
117+
New-ApplicationAccessPolicy -AppId $AppID -PolicyScopeGroupId $SecurityGroup -AccessRight RestrictAccess -Description "Restrict this app to members of distribution group {$SecurityGroup}"
118+
```
119+
120+
6. **Test the Configuration**
121+
122+
- Run the following command to test if the application access policy is properly configured:
123+
124+
```powershell
125+
Test-ApplicationAccessPolicy -AppId $AppID -Identity $MailBox
126+
```
127+
128+
- The expected output should be similar to:
129+
130+
```
131+
AppId : 9367xxxx
132+
Mailbox : test-shared-mailbox20231107190659
133+
AccessCheckResult : Granted
134+
```
135+
136+
- Running the command with a different mailbox should return `AccessCheckResult: Denied`.
137+
138+
7. **Configure Intake Connector Settings in TheHive**
139+
140+
To integrate TheHive with Microsoft 365, you will need the following information:
141+
142+
- **Mailbox address**
143+
- **Tenant ID**
144+
- **Client ID**
145+
- **Secret Value**
146+
- **Authority:** `https://login.microsoftonline.com`
147+
- **Scope:** `https://outlook.office365.com/.default`
148+
149+
![](/thehive/images/administration-guides/ms-intake-7.png)
150+
151+
---
152+
153+
=== "Google Workspace"
154+
155+
### Setting up Google Workspace for TheHive
156+
157+
This section describes the necessary steps to configure Google Workspace to allow TheHive access to a mailbox. Please follow these steps to ensure proper integration.
158+
159+
 
160+
161+
#### Prerequisites
162+
- Access to the Google Cloud Admin Console.
163+
- Proper permissions to create projects and configure OAuth credentials.
164+
165+
 
166+
167+
#### Step-by-Step Configuration
168+
169+
1. **Access Google Cloud Admin Console**
170+
Navigate to the Google Cloud Admin Console at [https://console.cloud.google.com/welcome](https://console.cloud.google.com/welcome).
171+
172+
173+
2. **Create a New Project**
174+
175+
- Click on **API & Services**.
176+
177+
![](/thehive/images/administration-guides/intake-1.png)
178+
179+
- Select **Create a Project**.
180+
181+
![](/thehive/images/administration-guides/intake-2.png)
182+
183+
- Provide a meaningful name for the project and click **Create**.
184+
185+
![](/thehive/images/administration-guides/intake-3.png)
186+
187+
3. **Configure OAuth Consent Screen**
188+
189+
- In the left-hand menu, select **OAuth consent screen**.
190+
191+
![](/thehive/images/administration-guides/intake-4.png)
192+
193+
- Choose **User Type** as **Internal** and click **Create**.
194+
195+
![](/thehive/images/administration-guides/intake-5.png)
196+
197+
- Assign a name to the app and specify a mailbox for support contact.
198+
199+
![](/thehive/images/administration-guides/intake-6.png)
200+
201+
- Provide a developer contact email address, then click **Save and Continue**.
202+
203+
![](/thehive/images/administration-guides/intake-7.png)
204+
205+
4. **Add Gmail API Scope**
206+
207+
- In **Step 2**, click on **Add or Remove Scopes**.
208+
209+
![](/thehive/images/administration-guides/intake-8.png)
210+
211+
- In the search bar, type the following scope: `https://mail.google.com/`.
212+
213+
![](/thehive/images/administration-guides/intake-9.png)
214+
215+
- Click **Add to Table** to add the scope.
216+
217+
![](/thehive/images/administration-guides/intake-10.png)
218+
219+
- Ensure that the new scope is checked, then click **Update**.
220+
221+
![](/thehive/images/administration-guides/intake-11.png)
222+
223+
- Scroll down to verify that the Gmail scope exists, and click **Save and Continue**.
224+
225+
![](/thehive/images/administration-guides/intake-12.png)
226+
227+
5. **Return to Dashboard**
228+
229+
- On the summary page, click **Back to Dashboard** to complete the OAuth consent configuration.
230+
231+
![](/thehive/images/administration-guides/intake-13.png)
232+
233+
6. **Create OAuth Credentials**
234+
235+
- In the left-hand menu, select **Credentials**.
236+
237+
![](/thehive/images/administration-guides/intake-14.png)
238+
239+
- Click on **Create Credentials** and choose **OAuth Client ID**.
240+
241+
![](/thehive/images/administration-guides/intake-15.png)
242+
243+
- Set the application type as **Web application**.
244+
245+
![](/thehive/images/administration-guides/intake-16.png)
246+
247+
- Provide a name for the OAuth client ID.
248+
249+
- Under **Authorized JavaScript origins**, add the appropriate URI.
250+
251+
![](/thehive/images/administration-guides/intake-17.png)
252+
253+
- Under **Authorized redirect URIs**, add the necessary URIs and click **Create**.
254+
255+
![](/thehive/images/administration-guides/intake-18.png)
256+
257+
7. **Obtain Client ID and Secret**
258+
259+
* A dialog will appear with the **Client ID** and **Client Secret**.
260+
261+
* Copy these values or download the JSON file for future reference.
262+
263+
![](/thehive/images/administration-guides/intake-19.png)
264+
265+
8. **Configure Intake Connector Settings in TheHive**
266+
267+
Set up the intake settings in TheHive by filling in the following values:
268+
269+
* `Email`
270+
* `clientId`
271+
* `secret`
272+
273+
![](/thehive/images/administration-guides/eic-5.png)
274+
275+
276+
277+
=== "IMAP Mailbox"
278+
279+
For IMAP configuration, you'll need to input the following information:
280+
281+
- Host: `host`
282+
- Port: `port` (default: 993)
283+
284+
Additionally, provide your mailbox credentials. We recommend enabling SSL Check Certificate Authority.
285+
286+
![](/thehive/images/administration-guides/eic-6.png)
287+
288+
71289

72290
### Settings
73291

74292
After testing your mailbox configuration, select the organization to connect, determining where alerts will be created. Define the mailbox folder to monitor (typically INBOX). Finally, specify the action to take on incoming emails: ``archive``, ``mark as read``, or ``no action``.
75293

76-
![](../images/administration-guides/eic-7.png)
294+
![](/thehive/images/administration-guides/eic-7.png)
295+
77296
---
78297

79298
## Generated Alerts and Observables
@@ -84,37 +303,42 @@ Following configuration, alerts and observables are generated in the selected or
84303

85304
Each alert will contain the following details:
86305

87-
- `alert.type`: "email-intake"
88-
- `alert.source`: The configuration name is formatted as "Google Workspace @strangebee.com" => "googleworkspace-strangebee"
89-
- `alert.sourceRef`: "{message-id}" or "{lastUidValidity}.{uidEmail}" if the message-id is inaccessible
90-
- `alert.title`: The email subject or "no subject"
91-
- `alert.severity`: "low"
92-
- `alert.description`: The content of the email
93-
- `alert.lastSyncDate`: The date the email was received
94-
- `alert.tlp`: "amber"
95-
- `alert.pap`: "amber"
96-
- `alert.follow`: false
97-
- `alert.tags`: ["email-intake", {source}, {Provider Name}, {Inbox Folder Name}]
98-
- `alert.status`: "new"
99-
- `alert.externalLink`: [Link to External Source]
100-
- `alert.summary`: [Summary of Alert]
101-
- `alert.customFields`: [Custom Fields]
306+
!!! Info "Mapping of email data in the Alert"
307+
308+
* **Title**: The email subject or "no subject"
309+
* **Type**: *email-intake*
310+
* **Source**: The configuration name is formatted as `Google Workspace @strangebee.com` => `googleworkspace-strangebee`
311+
* **Source reference**: `{message-id}` or `{lastUidValidity}.{uidEmail}` if the message-id is inaccessible
312+
* **Last sync date**: The date the email was received
313+
* **Severity**: *low*
314+
* **TLP**: *amber*
315+
* **PAP**: *amber*
316+
* **Follow**: *False*
317+
* **Tags**: [*email-intake*, {source}, {Provider Name}, {Inbox Folder Name}]
318+
* **Status**: *new*
319+
* **Description**: The content of the email
320+
* **Summary**: [Summary of Alert]
321+
* **Custom Fields**: [Custom Fields]
322+
* **Eternal link**: [Link to External Source]
102323

103-
 
324+
325+
---
104326

105327
### Observables
106328

107-
The email itself is included as a .eml file, along with its sender and all attached files, which are added to the alert as observables, with the following parameters:
108-
109-
- `observable.message`: The pre-formatted message
110-
- `observable.tlp`: {alert.tlp}
111-
- `observable.pap`: {alert.pap}
112-
- `observable.ioc`: false
113-
- `observable.sighted`: false
114-
- `observable.sightedAt`: [Timestamp]
115-
- `observable.ignoreSimilarity`: false
116-
- `observable.dataType`: "file" if it's an attachment; otherwise, "mail" for the .eml file
117-
- `observable.tags`: {alert.tags}
118-
- `observable.attachmentId`: {attachment.id}
329+
The email itself is included as a `.eml` file, along with its sender and all attached files, which are added to the alert as observables, with the following parameters:
330+
331+
!!! Info "Observables metadata added with the email data"
332+
333+
- **Message**: The pre-formatted message
334+
- **TLP**: {alert.tlp}
335+
- **PAP**: {alert.pap}
336+
- **IOC**: false
337+
- **Sighted**: false
338+
- **Sighted at**: [Timestamp]
339+
- **Ignore similarity**: false
340+
- **dataType**: *file* if it's an attachment; otherwise, *mail* for the `.eml` file
341+
- **Tags**: {alert.tags}
342+
- **attachment Id**: {attachment.id}
119343

120344
 
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)