Skip to content
This repository was archived by the owner on Feb 13, 2023. It is now read-only.

Commit 8ed9b6e

Browse files
committed
Adds the last blog post
1 parent 26d5c54 commit 8ed9b6e

File tree

4 files changed

+146
-0
lines changed

4 files changed

+146
-0
lines changed

blog/2023-02-13-open-sourcing.mdx

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
---
2+
slug: open-sourcing
3+
title: Open-sourcing All Repositories
4+
authors: mutablesecurity
5+
tags: [open-source, software-architecture, project-retirement]
6+
---
7+
8+
import Admonition from '@theme/Admonition';
9+
10+
More than two months ago, we argued the decision to close MutableSecurity. We described how MutableSecurity's journey looked like and highlighted the plans for the following period: open-sourcing the codebase and archiving/deleting MutableSecurity's assets on the Internet (repositories, packages, etc.).
11+
12+
As a follow-up, the purpose of this post is to describe the **software architecture** that we wanted to achieve for our commercial product. In addition, it will list the **steps executed for the project's retirement**, which could represent a model for other closed-source software initiatives that reached this stage.
13+
14+
## Desired Software Architecture
15+
16+
The outcome of our commercial product was to deliver a way to remotely manage and monitor the security solutions installed on the organization's hosts. The following sections will describe each element of the architecture.
17+
18+
![Desired Architecture](/images/blog/2023-02-13-open-sourcing/c4.png)
19+
20+
### Cybersecurity Solutions' Automation with Target Agents
21+
22+
The **target agents** are Python 3 **wrappers for the open-source package**, [`mutablesecurity`](https://github.com/MutableSecurity/mutablesecurity). To give visibility and control to the web dashboard, the administrator installs agents on each server that needs to be managed by MutableSecurity.
23+
24+
The functionality consists of the following steps:
25+
26+
1. Parses the configuration file that contains information such as:
27+
- API key to authenticate to the orchestration agent;
28+
- The address and port of the orchestration agent; and
29+
- The reporting period, in seconds.
30+
2. Connects to the orchestration agent and authenticates itself using the provided API key.
31+
3. Sets a ticker depending on the reporting period and execute, at each tick, the following operations:
32+
1. Deduces what cybersecurity solutions are installed on the server.
33+
2. For each solution, extracts the specific **information** and executes the **tests**.
34+
3. Combines the resulting information into a single data structure.
35+
4. Sends the generated data to the orchestration agent via HTTPS.
36+
37+
<Admonition type="info" icon="🔗" title="Open-source Reference">
38+
The source code of this component is available <a href="https://github.com/MutableSecurity/target-agent">here</a>.
39+
</Admonition>
40+
41+
### Data Aggregation with Orchestration Agents
42+
43+
The **orchestration agent** is the **aggregation service**, built with Python 3. All target agents in the current network will connect to this type of agent. In this manner, it will be the single point in the reporting infrastructure with an Internet connection.
44+
45+
The operations that it executes are:
46+
47+
1. Parses the configuration file that contains information such as:
48+
- Bind address and port, where it will listen; and
49+
- Credentials to authenticate to Firebase.
50+
2. Processes a host file, which contains, for each target agent which is allowed a connection, the following information:
51+
- An API key that needs to be presented by the agent on each connection;
52+
- A unique identifier; and
53+
- A description of the agent.
54+
3. Authenticates to Firebase using the credentials from the configuration.
55+
4. Sets up an HTTPS server to let the target agents connect.
56+
5. Whenever a legitimate agent connects, store the reported information in the user-specific section of the database.
57+
58+
The host files mentioned above could be modified either manually or with a standalone script.
59+
60+
<Admonition type="info" icon="🔗" title="Open-source Reference">
61+
The source code of this component is available <a href="https://github.com/MutableSecurity/orchestration-agent">here</a>.
62+
</Admonition>
63+
64+
### Storage with Firebase
65+
66+
**Firebase** is used to store the reported data in a **resilient cloud environment**. Its non-structural aspect provides a malleability that is not present for structural (for example, SQL-backed) ones. This approach avoids issues imposed by fixed structures, but comes with an additional responsibility to ensure data's correctness.
67+
68+
In addition, we created access control lists in Firebase such that a user can write only to its allocated partition.
69+
70+
### Data Visualization with Dash
71+
72+
The visualization element in the distributed architecture is a **web dashboard**. **Dash** is built with React.js and Chakra UI. In the first iteration, it queries data from Firebase to:
73+
- Show overview statistics about the security architecture;
74+
- List the installed agents;
75+
- List the automated solutions; and
76+
- Monitor the details (configuration, metrics, and tests) of the automated solutions.
77+
78+
<div class="youtube-container">
79+
<iframe
80+
src="https://www.youtube.com/embed/ZEihPZa1-to"
81+
title="YouTube video player"
82+
frameborder="0"
83+
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
84+
allowfullscreen
85+
></iframe>
86+
</div>
87+
88+
<br/>
89+
90+
<Admonition type="info" icon="🔗" title="Open-source Reference">
91+
The source code of this component is available <a href="https://github.com/MutableSecurity/dash">here</a>.
92+
</Admonition>
93+
94+
### Alerting with Google Cloud Functions
95+
96+
Another functional requirement of the architecture was **alerting** the administrators when certain events occur:
97+
- **Failed tests**: Consider a scenario in which we've used MutableSecurity to install Suricata in the IDS mode. If the test checking the Suricata process fails, then the IDS no longer processes traffic and generates security alerts. This issue permits attackers to benefit from the lack of network analysis and visibility. Thereby, the administrator should be alerted as he needs to manually analyze why this happened and restore its functioning.
98+
- **Configuration change**: In the same scenario, an attacker with access to the IDS may disable the automatic updates. Although the community feeds will publish IOCs (hashes, IP addresses, etc.) describing the attacker's behavior, the IDS will not be able to retrieve them. Thereby, the administrator should be noticed of any configuration change of the security solutions, despite the cases in which he makes the changes.
99+
100+
![Failed Test Email](/images/blog/2023-02-13-open-sourcing/failed-test-email.png)
101+
102+
![Configuration Change Email](/images/blog/2023-02-13-open-sourcing/config-change-email.png)
103+
104+
The alerting infrastructure consists of a **Google Cloud function** that is executed every time data is reported by an agent. If failed tests or configuration changes are detected, then an email is sent via **SendGrid**, having the above dynamic templates.
105+
106+
<Admonition type="info" icon="🔗" title="Open-source Reference">
107+
The source code of this component is available <a href="https://github.com/MutableSecurity/cloud-functions/tree/main/alert_generation">here</a>.
108+
</Admonition>
109+
110+
### Periodically Deleting Data with Google Cloud Functions
111+
112+
The last element of the architecture is a Google Cloud function, whose sole purpose is to periodically delete old data from Firebase. The configuration provides the retention period.
113+
114+
<Admonition type="info" icon="🔗" title="Open-source Reference">
115+
The source code of this component is available <a href="https://github.com/MutableSecurity/cloud-functions/tree/main/dash_data_retention">here</a>.
116+
</Admonition>
117+
118+
## Retirement Checklist
119+
120+
- [x] Closing the issues and pull requests
121+
- [x] Deleting the accounts related to the project
122+
- [x] Revoking the access of third-party apps to the organization
123+
- [x] Checking the repositories with [Gitleaks](https://github.com/zricethezav/gitleaks) such that no active API key is disclosed
124+
- [x] Adding `LICENSE.md` and `README.md` files to all repositories
125+
- [x] Archiving all repositories
126+
- [x] Adding a banner to the website to mark the project as discontinued
127+
128+
### Account Deletion
129+
130+
The second step in the previous checklist involved, in our case, the deletion of:
131+
- PyPi;
132+
- DeepSource;
133+
- Google Cloud Platform, including Firebase; and
134+
- SendGrid accounts.
135+
136+
This automatically ensures that:
137+
- The **API keys** will be destroyed. Even though they will become public in the open-source code, they cannot be used anymore.
138+
- The **packages** cannot be downloaded anymore with `pip install mutablesecurity`.
139+
140+
## Conclusion
141+
142+
This wrap-up blog post described, from a technical perspective, how the retirement process looked like for MutableSecurity. This involved the publishing in the open-source of multiple repositories that were previously accessible only by the team members.
143+
144+
With this information in mind, the blog post is the last one in MutableSecurity's lifespan. With the [previous thanks](/blog/coming-to-an-end#lastly) in mind, we want to end by hoping the information presented in this post and blog was helpful.
145+
146+
See you next time!
Loading
Loading
Loading

0 commit comments

Comments
 (0)