Skip to content

Commit 214a667

Browse files
committed
More 4.3
1 parent 2ef7ed7 commit 214a667

File tree

776 files changed

+16310
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

776 files changed

+16310
-0
lines changed
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
+++
2+
title = "Creating Enrichments"
3+
description = "Enrich entity data using SCOT with Airflow"
4+
weight = 3
5+
+++
6+
7+
## SCOT enrichments
8+
SCOT entity enrichments provide the capability to incorporate data enrichment or other actions on flaired entities. These actions occur automatically when an entity is flaired. Actions can be anything from gathering data associated with the entity for display within the entity's flair pane in SCOT, or other types of action that can be taken outside of SCOT. SCOT works with the open-source workflow management platform, **Apache Airflow**, to launch actions based on the entity's type.
9+
10+
## The enrichment workflow
11+
- In the SCOT API configuration file, specify the following required fields:
12+
- enrichmentApiJobEndpoint (must be in this format WITH PLACEHOLDER INCLUDED): "/api/v1/dags/scot_entity_[ENTITY_TYPE_PLACEHOLDER]_enrichment/dagRuns"
13+
- enrichmentHost (your deployed airflow instance url): "https://airflow.example.com"
14+
- enrichmentUsername: "scot4-enrichment-account-name"
15+
- enrichmentPassword: "scot4-enrichment-account-password"
16+
- enrichmentTypes (semicolon-delimited list of entity types): "ipaddr;domain;email;etc"
17+
- In Airflow, jobs are defined as Python scripts called a DAG. Each DAG you create corresponds to the workflow of enrichment(s) you want performed on a given entity type.
18+
- when an entity is newly created and flaired, SCOT automatically checks the entity type and, if it matches any of the types specified in the enrichment configuration, it will send a request to your Airflow server with the entity information and a callback URL to capture results
19+
- Airflow uses the endpoint specified in the request (scot4_entity_[ENTITY]_enrichment) to match against the names of the DAGs you've created (NOTE: the name you give your created DAGs must match this same scheme) and will trigger the DAG.
20+
- Once the DAG completes, Airflow will make a POST request back to SCOT's /entity/enrichment endpoint, including any collected data as directed by the DAG (exmaple below).
21+
- SCOT will add the enrichment data to the entity.
22+
- In SCOT, you can click on the flaired entity to open the flair pane. In the flair pane, you will see the enrichment name(s) appear as tabs. Click on each enrichment tab to see the latest enrichment data for this entity. From this view you can also view previous enrichment data results, and now send a new enrichment request for potentially updated data.
23+
24+
## Deploying Apache Airflow
25+
Directions for deploying an Airflow instance can be found at https://airflow.apache.org/
26+
27+
## Creating a new DAG in Airflow
28+
You can review the docs for making DAG workflows at https://airflow.apache.org/docs/apache-airflow/stable/index.html.
29+
SCOT enrichments are designed such that one DAG corresponds to one entity type. Within that one DAG, you can have one or more tasks (python functions with an @Task decorator) defined for that enrichment type, for example:
30+
31+
A DAG to enrich an IPv4 entity can have:
32+
1. A task to collect enrichment data from an external 3rd party source
33+
2. A task to collect enrichment data from an internal source
34+
3. A task to add the IP to an internal blocklist if the enrichment data meets certain criteria
35+
4. A task that returns new entity class IDs to the /entity/{entity_id}/entity_class endpoint in SCOT based on enrichment data
36+
37+
You are limited only by what you can do programmatically in python and using APIs
38+
39+
## Sample DAG
40+
Below is a simple DAG workflow you can use as a starting place. It's made for enrichment of an IPv4 address (but could be modified for any entity type). Based on how you set up your Airflow instance and define your DAG endpoints, you should name this script to match the endpoint. In this case, where we define the endpoint (see workflow above) as `/api/v1/dags/scot_entity_[ENTITY_TYPE_PLACEHOLDER]_enrichment/dagRuns`, and assuming you have an entity type named `ipaddr`, your DAG should be named: `scot_entity_ipaddr_enrichment`
41+
42+
```
43+
import os
44+
import json
45+
import pendulum
46+
47+
from airflow.utils.task_group import TaskGroup
48+
from airflow.decorators import task, dag, task_group
49+
from airflow.models import Variable
50+
from airflow.operators.bash import BashOperator
51+
from airflow.operators.python import get_current_context
52+
from airflow.models.log import Log
53+
from airflow.utils.db import create_session
54+
from airflow.models import Variable
55+
56+
@dag(
57+
schedule_interval=None,
58+
start_date=pendulum.datetime(2021, 1, 1, tz="UTC"),
59+
catchup=False,
60+
tags=['author:user', 'scot4_enrichment'],
61+
doc_md=open(f"{os.path.dirname(os.path.realpath(__file__))}/README.md").read(),
62+
params={'entity_id': None, 'entity_value': '192.168.1.1', 'callback_url':None}
63+
)
64+
def scot4_entity_ipaddr_enrichment():
65+
@task
66+
def task1_enrichment():
67+
import pandas as pd
68+
# get the IP address from the Airflow context
69+
context = get_current_context()
70+
ip_addr = context['params'].get('entity_value')
71+
# query enrichment data for IP from 3rd party API service
72+
enr_data = get_data_from_api(ip_addr)
73+
# convert any results to markdown so SCOT can parse it
74+
markdown = pd.DataFrame.from_records([enr_data]).T.to_markdown()
75+
# use this schema for SCOT parsing (title value = tab name in the flair pane)
76+
enrichment_data = { 'title': 'Data Enrichment Summary',
77+
'enrichment_class': 'markdown',
78+
'description': 'Summary from API being used',
79+
'data': {'markdown': markdown,}
80+
}
81+
return {'entity_class_ids': entity_class_ids, 'enrichment_data': [enrichment_data]}
82+
83+
84+
@task
85+
def add_enrichment_to_scot(results):
86+
import requests
87+
88+
context = get_current_context()
89+
callback_url = context['params'].get('callback_url')
90+
api_key = Variable.get('scot4-instance-api-key')
91+
92+
if callback_url is not None and results.get('enrichment_data') is not None and len(results['enrichment_data']) > 0:
93+
for enrichment_data in results['enrichment_data']:
94+
context = get_current_context()
95+
entity_id = context['params'].get('entity_id')
96+
url = f"{callback_url}/entity/{entity_id}/enrichment"
97+
res = requests.post(url, data=json.dumps(enrichment_data), headers=
98+
'Content-Type':'application/json',
99+
'Authorization': f'apikey {api_key}',
100+
})
101+
if not res.ok:
102+
raise Exception(f"Request to {url} failed: {res.status_code} {res.reason}: {res.text}")
103+
104+
105+
task1_results = task1_enrichment()
106+
add_enrichment_to_scot(task1_results)
107+
108+
dag = scot4_entity_ipaddr_enrichment()
109+
```

content/releases/4.2.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
+++
2+
title = "4.2.1 Release"
3+
description = "4.2.1 Release Notes"
4+
weight = 2
5+
+++
6+
7+
## Features
8+
9+
* Vulnerability Section added to track incoming vulnerability reports.
10+
11+
12+
## Fixes
13+
14+
* re-added ability to source images (and only images) via a base64 data url
15+
* cleaned up several things for open source
16+
* improved search indexing performance
17+
* fixed process for adding user-defined flair entities
18+
* re-added ability to source images (and only images) via a base64 data url
19+
* cleaned up several things for open source
20+
* improved search indexing performance
21+
* fixed process for adding user-defined flair entities
22+
* multi-row sparklines now support by flair engine
23+
* Minion job control protected by auth
24+
* fixed errors in multi-word user defined flair
25+
* fixed error in user defined flair creation
26+
* fixed checks on permitted sender in inbox processor
27+
* helm chart clean up and refinement
28+
29+
30+

content/releases/4.3.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
+++
2+
title = "4.3.0 Release"
3+
description = "4.3.0 Release Notes"
4+
weight = 3
5+
+++
6+
7+
## Features
8+
9+
* Notification System
10+
11+
Administrators can now send messages to all users.
12+
Users can also mark items to be notified when changes occur to them.
13+
14+
* Favorites
15+
16+
Users can now favorite items within SCOT which acts like a bookmark and allows for easy navigation back to favorited items.
17+
18+
* Popularity
19+
20+
Users can now upvote/downvote items in SCOT. This is currently an optional feature that can be hidden by the user.
21+
22+
* Entity Pane Enhancements
23+
24+
In the Entity Pane, users can now select multiple Entities for copy or bulk addition of class and tag attributes. Users can also view GeoIP locations on a map.
25+
26+
* Internal References
27+
28+
Users can now create an interal link to other sections of SCOT within Entries. By entering the phrase "SCOT-Event-123" into an entry, the flair engine will create an internal link to Event 123. This will work with Alertgroups, Events, Incidents, Dispatches, Intels, Reports, etc. Flair will also detect the URL https://yourhostname/#/intel/987 and rewrite that to a link to SCOT-Intel-987.
29+
30+
* Core Entities Documented
31+
32+
SCOT now has documentation on the Core Entities. If you create a regex that would be a useful additions to this set, let us know and we will add it.
33+
34+
35+
## Fixes
36+
37+
* Matomo removed
38+
* Creating an alertgroup with tags via the API now works as expected
39+
* Bug in associating new entity classes with existing entities fixed
40+
* Flair engine can now replace images in Alertgroups with local copies
41+
* Dockerfile improvements for container creation
42+
* Improvements to local password lockout and recovery
43+
* Alertgroups with underscores in the subject now link to signatures/guides correctly
44+
* Fixed ordering of items in flair appearances pane
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
+++
2+
title = "Favorites and Popularity"
3+
description = "Bookmarking and Voting"
4+
weight = 8
5+
+++
6+
7+
SCOT allows you to flag items (Events, Incidents, Dispatches, Intel, Reports, Entries, and Guides) as a "favorite." This acts like a bookmark, allowing you to quickly find and return to flagged items.
8+
9+
To mark an item, click on the "heart" icon.
10+
11+
![Unselected Favorite Heart](/images/heart-unselected.png)
12+
13+
Selected as a Favorite:
14+
15+
![Selected Favorite heart](/images/heart-selected.png)
16+
17+
To view all items you have flagged as favorites, go to the User menu in far upper right, click and then select "Favorites/Subscriptions".
18+
19+
![Subscription Menu](/images/SubscriptionMenu.png)
20+
21+
You will then be presented with a pop-up like this:
22+
23+
![Favorite Popup](/images/favoritePopup.png)
24+
25+
that allows you to hyperlink to an item. To remove an item from your favorites, click the heart icon again and it will be removed.
26+
27+
## Popularity
28+
29+
Users can toggle the popularity view and controls by selecting to "Dispaly Popularity" in the Settings menu accessed by clicking on the Gear Icon in the upper right.
30+
31+
![Popularity Toggle](/images/popularityToggle.png)
32+
33+
Turning on the popularity features will present upvote and downvote buttons on most items. User then can upvote or downvote as they wish. The number in the middel of the control represents the number of upvotes minus the number of downvotes.
34+
35+
![Popularity Control](/images/popularityControl.png)

content/usage/Notifications.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
+++
2+
title = "Notifications"
3+
description = "Getting Up to date with Notifications"
4+
weight = 8
5+
+++
6+
7+
SCOT allows you to flag items (Events, Incidents, Dispatches, Intel, Reports, Entries, and Guides) so that you will receive notifications within SCOT when changes are made to that item.
8+
9+
To mark an item, click on the "bell" icon.
10+
11+
![Unselected Notificaton Bell](/images/bell-unselected.png)
12+
13+
Selected for Notifications
14+
15+
![Selected Notification Bell](/images/bell-selected.png)
16+
17+
To view all items you have flagged for notifications, go to the User menu in far upper right, click and then select "Favorites/Subscriptions".
18+
19+
![Subscription Menu](/images/SubscriptionMenu.png)
20+
21+
You will then be presented with a pop-up like this:
22+
23+
![Subscription Popup](/images/subscriptionPopup.png)
24+
25+
that allows you to hyperlink to an item or unflag it for notifications.
26+
27+
## Global Notifications
28+
29+
The SCOT administrator can send Global Announcements to all users. To send an global notification, select the User icon in the upper right and then select "Administration."
30+
31+
![Admin Pull Down](/images/administrationMenu.png)
32+
33+
You will then be presented with the following:
34+
35+
![Send Global Announcement](/images/sendGlobalNotificaton.png)
36+
37+
Fill out the form and press "Submit Announcement" to send notification.
38+
39+
## Receiving Notifications
40+
41+
Announcements will automatically pop up as small toasts in the upper right section of the browser window. Notifications typically have an expiration time and will auto clear at the end of that expiration. To view expired notices, click on the "Bell" icon on the upper right of the SCOT window and you will see a listing of past notifications:
42+
43+
![Announcement Example](/images/announcement.png)
44+
45+

0 commit comments

Comments
 (0)