Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
54cdfd03cd | ||
|
|
449bd96cc7 | ||
|
|
59ef0671c6 | ||
|
|
662cb658b7 | ||
|
|
78b9bf997a | ||
|
|
d4c43c527d | ||
|
|
4418eef8d9 | ||
|
|
0cdce73c04 | ||
|
|
c137fdc101 | ||
|
|
cd4fdd8e44 | ||
|
|
cb0ff4216a | ||
|
|
6bcd5f359b | ||
|
|
e090140120 | ||
|
|
bf27b55bb2 | ||
|
|
f2f90a426c | ||
|
|
731e36b879 | ||
|
|
fc9b287f6b | ||
|
|
49b7387eb4 | ||
|
|
8be216c0e6 | ||
|
|
d98c80a688 | ||
|
|
85f2a3a38b | ||
|
|
09dc4d09f8 | ||
|
|
098755041b | ||
|
|
980432dc43 | ||
|
|
71b538bdb7 | ||
|
|
c6b5295aca | ||
|
|
e655a71db3 | ||
|
|
d289abaa4b | ||
|
|
b83227e39d |
@@ -13,6 +13,7 @@ stages:
|
||||
|
||||
include:
|
||||
- template: Code-Quality.gitlab-ci.yml
|
||||
- template: Security/SAST.gitlab-ci.yml
|
||||
|
||||
docker_build:
|
||||
stage: test
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Mistborn
|
||||
A secure platform for easily standing up and managing your own cloud services: including firewall, ad-blocking, and multi-factor Wireguard VPN access
|
||||
A secure platform for easily standing up and managing your own cloud services: including firewall, ad-blocking, and multi-factor WireGuard VPN access
|
||||
|
||||
*Wireguard Management in Mistborn*
|
||||
*WireGuard Management in Mistborn*
|
||||
|
||||
As featured in [Linux Magazine](https://www.linux-magazine.com/Issues/2020/240/Mistborn/(language)/eng-US) (Linux Pro Magazine in North America) in November 2020
|
||||
|
||||
@@ -13,13 +13,15 @@ As featured in [Linux Magazine](https://www.linux-magazine.com/Issues/2020/240/M
|
||||
# What is Mistborn
|
||||
The term [Mistborn](http://www.brandonsanderson.com/the-mistborn-saga-the-original-trilogy) is inspired by a type of powerful Allomancer in Brandon Sanderson's Cosmere.
|
||||
|
||||
Mistborn started as a passion project for a husband and father protecting his family. Certain family members insisted on connecting their devices to free public WiFi networks. We needed a way to secure all family devices with a solid VPN (Wireguard). Once we had that we wanted to control DNS to block ads to all devices and block malicious websites across all family devices. Then we wanted chat, file-sharing, and webchat services that we could use for ourselves without entrusting our data to some big tech company. And then... home automation. I know I'll be adding more services so I made that easy to do.
|
||||
Mistborn started as a passion project for a husband and father protecting his family. Certain family members insisted on connecting their devices to free public WiFi networks. We needed a way to secure all family devices with a solid VPN (WireGuard). Once we had that we wanted to control DNS to block ads to all devices and block malicious websites across all family devices. Then we wanted chat, file-sharing, and webchat services that we could use for ourselves without entrusting our data to some big tech company. And then... home automation. I know I'll be adding more services so I made that easy to do.
|
||||
|
||||
As a [Certified Information Systems Security Professional (CISSP)](https://www.credly.com/badges/ebcb76f2-1e82-4079-9ea3-b507ffbd1d15/public_url) and an [Offensive Security Certified Professional (OSCP)](https://www.credly.com/badges/b93c44ec-3af5-48e8-9a33-b64365b70c61/public_url), I designed Mistborn thinking about how it would be attacked by both external and internal threats. In making design trade-off decisions I tend to the paranoid. See [Technical and Security Insights](#technical-and-security-insights).
|
||||
|
||||
Ideal for teams who:
|
||||
- hate internet ads
|
||||
- need to be protected from malicious internet domains
|
||||
- need to collaborate securely
|
||||
- need multi-factor authentication for Wireguard
|
||||
- need multi-factor authentication for WireGuard
|
||||
- want to retain sole ownership of their data
|
||||
- want to easily grant and revoke access to people and devices via a simple web interface
|
||||
- want secure internet access wherever they are
|
||||
@@ -30,7 +32,7 @@ See the [Mistborn Network Security](https://gitlab.com/cyber5k/mistborn/-/wikis/
|
||||
|
||||
Mistborn depends on these core open source technologies:
|
||||
- [Docker](https://www.docker.com/why-docker): containerization
|
||||
- [Wireguard](https://www.wireguard.com): secure VPN access
|
||||
- [WireGuard](https://www.wireguard.com): secure VPN access
|
||||
- [SSH](https://www.openssh.com): secure remote management
|
||||
|
||||
These tools are not vital to Mistborn itself but are integrated to enhance security, ease, and features:
|
||||
@@ -39,7 +41,10 @@ These tools are not vital to Mistborn itself but are integrated to enhance secur
|
||||
- [Pi-hole](https://pi-hole.net): A DNS server for network-wide ad blocking, etc
|
||||
- [DNScrypt](https://www.dnscrypt.org): prevents DNS spoofing via cryptographic signatures to verify that responses originate from the chosen DNS resolver and haven't been tampered
|
||||
- [Traefik](https://docs.traefik.io): A modern, efficient reverse-proxy
|
||||
|
||||
These tools can be turned on from the Mistborn Security Operations Center:
|
||||
- [Wazuh](https://wazuh.com/): Wazuh is a free, open source and enterprise-ready security monitoring solution for threat detection, integrity monitoring, incident response and compliance.
|
||||
- [Suricata](https://suricata-ids.org/): Suricata is a free and open source, mature, fast and robust network threat detection engine. The Suricata engine is capable of real time intrusion detection (IDS), inline intrusion prevention (IPS), network security monitoring (NSM) and offline pcap processing. Suricata inspects the network traffic using a powerful and extensive rules and signature language, and has powerful Lua scripting support for detection of complex threats.
|
||||
|
||||
Within Mistborn is a panel to enable and manage these free extra services (off by default), locally hosted in Docker containers:
|
||||
- [Home Assistant](https://www.home-assistant.io): Open source home automation that puts local control and privacy first
|
||||
@@ -57,9 +62,9 @@ Within Mistborn is a panel to enable and manage these free extra services (off b
|
||||
# Quickstart
|
||||
Tested Operating Systems (in order of thoroughness):
|
||||
- Ubuntu 20.04 LTS
|
||||
- Ubuntu 18.04 LTS
|
||||
- Debian 10 (Buster)
|
||||
- Debian 11 (Bullseye)
|
||||
- Raspberry Pi OS (formerly Raspbian) Buster
|
||||
- Formerly tested and may still work: Ubuntu 18.04 LTS, Debian 10 (Buster)
|
||||
|
||||
**Note:** Install operating system updates and restart. Raspberry Pi OS particularly needs to be restarted after kernel updates (kernel modules for the currently running kernel may be missing).
|
||||
|
||||
@@ -79,7 +84,7 @@ Recommended System Specifications:
|
||||
|
||||
| Use Case | Description | RAM | Hard Disk |
|
||||
|------------------------|-------------------------------------------------------------------------------|-------|-----------|
|
||||
| Bare bones | Wireguard, Pihole (no Cockpit, no extra services) | 2 GB | 15 GB |
|
||||
| Bare bones | WireGuard, Pihole (no Cockpit, no extra services) | 2 GB | 15 GB |
|
||||
| Default | Bare bones + Cockpit | 2 GB+ | 15 GB |
|
||||
| Low-resource services | Default + Bitwarden, Tor, Syncthing | 4 GB | 20 GB |
|
||||
| High-resource services | Default + Jitsi, Nextcloud, Jellyfin, Rocket.Chat, Home Assistant, OnlyOffice | 6 GB+ | 25 GB+ |
|
||||
@@ -91,31 +96,38 @@ git clone https://gitlab.com/cyber5k/mistborn.git
|
||||
sudo -E bash ./mistborn/scripts/install.sh
|
||||
```
|
||||
|
||||
Get default admin Wireguard profile
|
||||
Get default admin WireGuard profile
|
||||
*wait 1 minute after "Mistborn Installed" message*
|
||||
```
|
||||
sudo mistborn-cli getconf
|
||||
```
|
||||
|
||||
Connect via Wireguard then visit `http://home.mistborn`
|
||||
Connect via WireGuard then visit `http://home.mistborn`
|
||||
|
||||
For more information, see the `Installation` section below.
|
||||
For more information, see the [Installation](#installation) section below.
|
||||
|
||||
# Network Diagram
|
||||

|
||||
|
||||
Mistborn protects your data in a variety of ways:
|
||||
- All of your devices are protected wherever they go with the Wireguard VPN protocol
|
||||
- All of your devices are protected wherever they go with the WireGuard VPN protocol
|
||||
- The Mistborn firewall blocks unsolicited incoming internet packets
|
||||
- Pi-hole running on Mistborn blocks outgoing internet requests to configurable blocked domains (ads, malicious/phishing domains, etc.)
|
||||
|
||||
See the [Mistborn Network Security](https://gitlab.com/cyber5k/mistborn/-/wikis/Mistborn-Network-Security) wiki page to see more network diagrams and the network scan results for Mistborn.
|
||||
|
||||
# Status
|
||||

|
||||
|
||||
The home page receives WireGuard status updates from the server via WebSocket connections. Superusers receive detailed updates about all connections and profiles. Regular users see details about their own devices.
|
||||
|
||||
# Security Information & Event Management (SIEM)
|
||||
|
||||

|
||||
|
||||
The Mistborn Security Operations Center provides SIEM services with Wazuh. The Wazuh Manager requires an Open Distro for Elasticsearch backend. When the Mistborn host has >8 GB RAM the provided Elasticsearch backend can be used. Just click "Start Wazuh" on the `Security Center` page and enjoy your Enterprise-grade SIEM. Wazuh agents can be installed on just about any OS and all Wazuh agent traffic is communicated over the Wireguard connections. Instructions for adding endpoint agents can be found within Wazuh itself.
|
||||
The Mistborn Security Operations Center provides SIEM services with Wazuh. The Wazuh Manager requires an Open Distro for Elasticsearch backend. When the Mistborn host has >8 GB RAM the provided Elasticsearch backend can be used. Just click "Start Wazuh" on the `Security Center` page and enjoy your Enterprise-grade SIEM. Wazuh agents can be installed on just about any OS and all Wazuh agent traffic is communicated over the WireGuard connections. Instructions for adding endpoint agents can be found within Wazuh itself.
|
||||
|
||||
Mistborn's Wazuh installs and integrates with Suricata running on Mistborn with logs ingested into Wazuh.
|
||||
|
||||

|
||||
|
||||
@@ -137,7 +149,7 @@ We were getting frustrated at being forced to choose between being connected to
|
||||
|
||||
*Netflix blocking my connections that it sees coming from a DigitalOcean droplet*
|
||||
|
||||
In Mistborn, Gateways are upstream from the VPN server so connections to third-party services (e.g. Netflix, Hulu, etc.) will appear to be coming from the public IP address of the Gateway. I setup a Gateway at home (Raspberry Pi with `wireguard` and `openresolv` installed) and with our Mistborn on DigitalOcean, all Wireguard profiles created with this Gateway will appear to be coming from my house and are not blocked. No port-forwarding required (assuming Mistborn is publicly accessible).
|
||||
In Mistborn, Gateways are upstream from the VPN server so connections to third-party services (e.g. Netflix, Hulu, etc.) will appear to be coming from the public IP address of the Gateway. I setup a Gateway at home (Raspberry Pi with `wireguard` and `openresolv` installed) and with our Mistborn on DigitalOcean, all WireGuard profiles created with this Gateway will appear to be coming from my house and are not blocked. No port-forwarding required (assuming Mistborn is publicly accessible).
|
||||
|
||||

|
||||
|
||||
@@ -150,7 +162,7 @@ Mistborn enables remote desktop access via the Apache Guacamole extra service, w
|
||||
|
||||

|
||||
|
||||
Guacamole implements its own users and groups access controls to manage access to individual desktops. All Mistborn users must be authenticated with Mistborn (via Wireguard only or MFA) to access the Guacamole interface.
|
||||
Guacamole implements its own users and groups access controls to manage access to individual desktops. All Mistborn users must be authenticated with Mistborn (via WireGuard only or MFA) to access the Guacamole interface.
|
||||
|
||||
# Client to client communication
|
||||
By default direct communication between network clients is blocked. Mistborn clients can all talk to Mistborn and communicate via shared services (Jitsi, Nextcloud, etc). Direct client to client communication can be enabled via the "client-to-client" toggle.
|
||||
@@ -158,7 +170,7 @@ By default direct communication between network clients is blocked. Mistborn cli
|
||||

|
||||
|
||||
# Installation
|
||||
Mistborn is regularly tested on Ubuntu 20.04 LTS (DigitalOcean droplet with 2 GB RAM). It has also been successfully used on Debian Buster and Raspbian Buster systems (though not regularly tested). Make sure to install OS updates and restart before installing Mistborn (Wireguard installs differently on recent kernels).
|
||||
Mistborn is regularly tested on Ubuntu 20.04 LTS (DigitalOcean droplet with 2 GB RAM). It has also been successfully used on Debian Buster and Raspbian Buster systems (though not regularly tested). Make sure to install OS updates and restart before installing Mistborn (WireGuard installs differently on recent kernels).
|
||||
|
||||
Clone the git repository and run the install script:
|
||||
```
|
||||
@@ -173,7 +185,7 @@ Running `install.sh` will do the following:
|
||||
- install iptables-persistent
|
||||
- install Docker
|
||||
- install OpenSSH
|
||||
- install Wireguard
|
||||
- install WireGuard
|
||||
- install Cockpit (optional)
|
||||
- create a `cockpit` system user (if Cockpit is installed)
|
||||
- configure unattended-upgrades
|
||||
@@ -201,23 +213,23 @@ sudo -E bash -c "source ./mistborn/scripts/noninteractive/.install_barebones &&
|
||||
```
|
||||
|
||||
# Post-Installation
|
||||
When Mistborn-base starts up it will create volumes, initialize the PostgreSQL database, start pihole, run Django migrations and then check to see if a Mistborn superuser named `admin` exists yet. If not, it will create the superuser `admin` along with an accompanying default Wireguard configuration file and start the Wireguard service. You can watch all of this happen with:
|
||||
When Mistborn-base starts up it will create volumes, initialize the PostgreSQL database, start pihole, run Django migrations and then check to see if a Mistborn superuser named `admin` exists yet. If not, it will create the superuser `admin` along with an accompanying default WireGuard configuration file and start the WireGuard service. You can watch all of this happen with:
|
||||
```
|
||||
sudo journalctl -xfu Mistborn-base
|
||||
```
|
||||
|
||||
The default Wireguard configuration file for `admin` may be obtained via:
|
||||
The default WireGuard configuration file for `admin` may be obtained via:
|
||||
```
|
||||
sudo mistborn-cli getconf
|
||||
```
|
||||
Please notice that the following lines are **NOT** part of the Wireguard config:
|
||||
Please notice that the following lines are **NOT** part of the WireGuard config:
|
||||
```
|
||||
Starting mistborn_production_postgres ... done
|
||||
Starting mistborn_production_redis ... done
|
||||
PostgreSQL is available
|
||||
```
|
||||
|
||||
The Wireguard config will look like this:
|
||||
The WireGuard config will look like this:
|
||||
```
|
||||
# "10.15.91.2" - WireGuard Client Profile
|
||||
[Interface]
|
||||
@@ -239,18 +251,18 @@ AllowedIPs = 0.0.0.0/0,::/0
|
||||
Endpoint = <Mistborn public IP address>:39207
|
||||
```
|
||||
|
||||
## Login via Wireguard
|
||||
[Install wireguard](https://www.wireguard.com/install/) on your computer. If you get a `resolvconf: command not found` error when starting Wireguard then install openresolv: `sudo apt-get install -y openresolv`
|
||||
- Copy the text of the default admin Wireguard config to `/etc/wireguard/wg_admin.conf` on your computer
|
||||
## Login via WireGuard
|
||||
[Install wireguard](https://www.wireguard.com/install/) on your computer. If you get a `resolvconf: command not found` error when starting WireGuard then install openresolv: `sudo apt-get install -y openresolv`
|
||||
- Copy the text of the default admin WireGuard config to `/etc/wireguard/wg_admin.conf` on your computer
|
||||
- Run `sudo systemctl start wg-quick@wg_admin`
|
||||
- Run `sudo systemctl enable wg-quick@wg_admin`
|
||||
- Open your browser and go to "http://home.mistborn"
|
||||
- Browse your Mistborn system!
|
||||
**Note:** The home.mistborn server takes a minute to come up after Mistborn is up (collectstatic on all that frontend JavaScript and CSS)
|
||||
|
||||
## Wireguard Management
|
||||
Mistborn users can be added (non-privileged or superuser) and removed by superusers. Multiple Wireguard profiles can be created for each user. A non-privileged user can create profiles for themselves.
|
||||
*Wireguard Management in Mistborn*
|
||||
## WireGuard Management
|
||||
Mistborn users can be added (non-privileged or superuser) and removed by superusers. Multiple WireGuard profiles can be created for each user. A non-privileged user can create profiles for themselves.
|
||||
*WireGuard Management in Mistborn*
|
||||
|
||||
## Extra Services
|
||||
Mistborn makes extra services available.
|
||||
@@ -265,11 +277,11 @@ There are multiple ways to authenticate and use the system.
|
||||
|
||||
*Mistborn Multi Factor Authentication - Authenticator App Setup*
|
||||
|
||||
## Profile: Wireguard Authentication
|
||||
Mistborn always authenticates with Wireguard. You must have a valid Wireguard configuration file associated with the correct internal IP address. A classic Mistborn profile (Wireguard Only) will allow you to access the internet and all services hosted by Mistborn once you have connected via Wireguard. Note: individual services may require passwords or additional authentication.
|
||||
## Profile: WireGuard Authentication
|
||||
Mistborn always authenticates with WireGuard. You must have a valid WireGuard configuration file associated with the correct internal IP address. A classic Mistborn profile (WireGuard Only) will allow you to access the internet and all services hosted by Mistborn once you have connected via WireGuard. Note: individual services may require passwords or additional authentication.
|
||||
|
||||
## Profile: Multi Factor Authentication (MFA)
|
||||
In addition to Wireguard, you may create a Mistborn profile enabling multi-factor authentication (MFA). You must first connect to Mistborn via Wireguard. Then all internet traffic will route you to the Mistborn webserver where you must first setup and thereafter authenticate with an app (Google Authenticator, Authy, etc.). You must go to [http://home.mistborn](http://home.mistborn) to complete the authentication process.
|
||||
In addition to WireGuard, you may create a Mistborn profile enabling multi-factor authentication (MFA). You must first connect to Mistborn via WireGuard. Then all internet traffic will route you to the Mistborn webserver where you must first setup and thereafter authenticate with an app (Google Authenticator, Authy, etc.). You must go to [http://home.mistborn](http://home.mistborn) to complete the authentication process.
|
||||
|
||||
*Mistborn Multi Factor Authentication Prompt*
|
||||
|
||||
@@ -287,7 +299,7 @@ Mistborn service access is blocked via traefik until Mistborn authentication is
|
||||
- **Sessions**: Traefik checks the authenticated sessions on the server side to determine whether to allow access to the Mistborn service web pages. If an open session exists for your Mistborn IP address then access will be granted. You may close all sessions by clicking "Sign Out" on the Mistborn home page. Expired sessions are regularly cleaned by the Mistborn system (celery periodic task).
|
||||
|
||||
# Mistborn Subdomains
|
||||
Mistborn uses the following domains (that can be reached by all Wireguard clients):
|
||||
Mistborn uses the following domains (that can be reached by all WireGuard clients):
|
||||
|
||||
| Service | Domain | Default Status |
|
||||
| ------- | ------ | -------------- |
|
||||
@@ -321,14 +333,14 @@ These are the default credentials to use in the services you choose to use:
|
||||
You can find the credentials sent to the Docker containers in: `/opt/mistborn/.envs/.production/`
|
||||
|
||||
# Gateway Setup
|
||||
Mistborn will generate the Wireguard configuration script for the Gateway. From a base Ubuntu/Debian/Raspbian operating system the following packages are recommended to be installed beforehand:
|
||||
Mistborn will generate the WireGuard configuration script for the Gateway. From a base Ubuntu/Debian/Raspbian operating system the following packages are recommended to be installed beforehand:
|
||||
|
||||
## Gateway Requirements
|
||||
- Wireguard (you can consult the Mistborn Wireguard installer: `mistborn/scripts/subinstallers/wireguard.sh`)
|
||||
- Openresolv (a Wireguard dependency that is also installed via the Mistborn Wireguard installer)
|
||||
- WireGuard (you can consult the Mistborn WireGuard installer: `mistborn/scripts/subinstallers/wireguard.sh`)
|
||||
- Openresolv (a WireGuard dependency that is also installed via the Mistborn WireGuard installer)
|
||||
- Fail2ban
|
||||
|
||||
## Install Gateway Wireguard config file
|
||||
## Install Gateway WireGuard config file
|
||||
On Mistborn:
|
||||
- Click `View Config` on the Gateways tab in Mistborn
|
||||
- Highlight the config
|
||||
@@ -340,15 +352,15 @@ On Gateway:
|
||||
- Run `sudo systemctl enable wg-quick@gateway`
|
||||
|
||||
# Phones and Mobile Devices
|
||||
All your devices can be connected to Mistborn as Wireguard clients.
|
||||
All your devices can be connected to Mistborn as WireGuard clients.
|
||||
|
||||
First steps:
|
||||
1. Device: Download the Wireguard app on your device. Links: [Android](https://play.google.com/store/apps/details?id=com.wireguard.android) [Apple](https://apps.apple.com/us/app/wireguard/id1441195209)
|
||||
1. Mistborn: Create a Wireguard profile for the device.
|
||||
1. Device: Scan Wireguard client QR code in Wireguard app.
|
||||
1. Device: Enable Wireguard connection.
|
||||
1. Device: Download the WireGuard app on your device. Links: [Android](https://play.google.com/store/apps/details?id=com.wireguard.android) [Apple](https://apps.apple.com/us/app/wireguard/id1441195209)
|
||||
1. Mistborn: Create a WireGuard profile for the device.
|
||||
1. Device: Scan WireGuard client QR code in WireGuard app.
|
||||
1. Device: Enable WireGuard connection.
|
||||
|
||||
All of you device network traffic is now being routed through Wireguard. Ads and malicious sites are blocked by pihole. DNS queries are verified via DNScrypt.
|
||||
All of you device network traffic is now being routed through WireGuard. Ads and malicious sites are blocked by pihole. DNS queries are verified via DNScrypt.
|
||||
|
||||
But wait, there's more! You can:
|
||||
- visit the [Mistborn web interface](http://home.mistborn) through your phone's browser.
|
||||
@@ -367,7 +379,7 @@ But wait, there's more! You can:
|
||||
| Rocket.Chat | [Rocket.Chat](https://play.google.com/store/apps/details?id=chat.rocket.android) | [Rocket.Chat](https://apps.apple.com/us/app/rocket-chat/id1148741252) |
|
||||
|
||||
## TLS Certificate
|
||||
Some apps require TLS (HTTPS). All traffic to Mistborn domains already occurs over Wireguard but to keep apps running, a TLS certificate exists for Mistborn and can be imported into your device's trusted credentials in the security settings. This certificate is checked every day and will be re-generated when expiration is less than 30 days away.
|
||||
Some apps require TLS (HTTPS). All traffic to Mistborn domains already occurs over WireGuard but to keep apps running, a TLS certificate exists for Mistborn and can be imported into your device's trusted credentials in the security settings. This certificate is checked every day and will be re-generated when expiration is less than 30 days away.
|
||||
|
||||
The TLS certificate can be found here:
|
||||
```
|
||||
@@ -377,7 +389,7 @@ The TLS certificate can be found here:
|
||||
# FAQ
|
||||
Frequently Asked Questions
|
||||
|
||||
## Where is My Data?
|
||||
## Where is my data?
|
||||
|
||||
The Docker services mount volumes located in:
|
||||
```
|
||||
@@ -394,11 +406,11 @@ Your data from Nextcloud, Syncthing, Bitwarden, etc. will be located there.
|
||||
## How do I SSH into Mistborn?
|
||||
If Mistborn is installed via SSH then an iptables rule is added allowing external SSH connections from the same source IP address only. If Mistborn was installed locally then no external SSH is permitted.
|
||||
|
||||
SSH is permitted from any device connected to Mistborn by Wireguard.
|
||||
SSH is permitted from any device connected to Mistborn by WireGuard.
|
||||
|
||||
Password authentication in enabled. Fail2ban blocks IPs with excessive failed login attempts.
|
||||
|
||||
You can SSH using the Mistborn domain when connected by Wireguard:
|
||||
You can SSH using the Mistborn domain when connected by WireGuard:
|
||||
```
|
||||
ssh user@home.mistborn
|
||||
```
|
||||
@@ -419,9 +431,38 @@ services:
|
||||
|
||||
The available options are here: https://download.dnscrypt.info/dnscrypt-resolvers/v2/public-resolvers.md
|
||||
|
||||
## How do I purge an extra service/start fresh?
|
||||
|
||||
This is a manual process for the foreseeable future because it is destructive and cannot be undone. In order to purge an extra service do the following:
|
||||
|
||||
- Stop and disable the service
|
||||
|
||||
This can be done from the Mistborn GUI or:
|
||||
|
||||
```
|
||||
sudo systemctl stop Mistborn-<service name>
|
||||
sudo systemctl disable Mistborn-<service name>
|
||||
```
|
||||
|
||||
- Remove the data folder
|
||||
|
||||
Locate the correct folder: `sudo ls -ahl /opt/mistborn_volumes/extra/`
|
||||
|
||||
**Be careful:**
|
||||
Now remove the folder: `sudo rm -r /opt/mistborn_volumes/extra/<service name>`
|
||||
|
||||
- Remove the variables file
|
||||
|
||||
Locate the file: `sudo ls -ahl /opt/mistborn/.envs/.production/`
|
||||
|
||||
**Be careful:**
|
||||
Now remove the file: `sudo rm /opt/mistborn/.envs/.production/.<service name>`
|
||||
|
||||
Now you can restart the service from the GUI or manually and it should be a first run experience.
|
||||
|
||||
# Troubleshooting
|
||||
|
||||
Once you're connected to Wireguard you should see .mistborn domains and the internet should work as expected. Be sure to use http (http://home.mistborn). Wireguard is the encrypted channel so there's usually no need to bother with TLS certs (WebRTC functionality and some mobile apps require TLS so it is available). Here are some things to check if you have issues:
|
||||
Once you're connected to WireGuard you should see .mistborn domains and the internet should work as expected. Be sure to use http (http://home.mistborn). WireGuard is the encrypted channel so there's usually no need to bother with TLS certs (WebRTC functionality and some mobile apps require TLS so it is available). Here are some things to check if you have issues:
|
||||
|
||||
Check if you can ping an external IP address:
|
||||
```
|
||||
@@ -453,18 +494,18 @@ Mistborn-base is a systemd process and at any time restarting it should get you
|
||||
sudo systemctl restart Mistborn-base
|
||||
```
|
||||
|
||||
The Wireguard processes run independently of Mistborn and will still be up if Mistborn is down. You can check running Wireguard interfaces with:
|
||||
The WireGuard processes run independently of Mistborn and will still be up if Mistborn is down. You can check running WireGuard interfaces with:
|
||||
```
|
||||
sudo wg show
|
||||
```
|
||||
Note the Mistborn naming convention for Wireguard interfaces on the server is wg<listening port>. So if the particular Wireguard process is listening on UDP port 56392 then the interface will be named wg56392 and the config will be in `/etc/wireguard/wg56392.conf`
|
||||
Note the Mistborn naming convention for WireGuard interfaces on the server is wg<listening port>. So if the particular WireGuard process is listening on UDP port 56392 then the interface will be named wg56392 and the config will be in `/etc/wireguard/wg56392.conf`
|
||||
|
||||
The `dev/` folder contains a script for completing a hard reset: destroying and rebuilding the system from the original backup:
|
||||
```
|
||||
sudo ./dev/rebuild.sh
|
||||
```
|
||||
|
||||
## Troubleshooting Wireguard
|
||||
## Troubleshooting WireGuard
|
||||
Ensure that your public IP address in your client profile (e.g. `Endpoint = <Mistborn public IP address>:<random port>`) is actually publicly available (not in 10.0.0.0/8, 172.16.0.0/12, or 192.168.0.0/16) if you are attempting to access Mistborn across the internet.
|
||||
|
||||
## Troubleshooting Extra Services
|
||||
@@ -498,13 +539,13 @@ sudo systemctl restart docker
|
||||
## Troubleshooting Upgrade from Ubuntu 18.04 to 20.04
|
||||
New installations of 18.04 and 20.04 after 25 April 2020 don't seem to be having issues. If you installed Mistborn on Ubuntu 18.04 prior to 25 April 2020 and then upgrade to 20.04 you may have one minor issue described below.
|
||||
|
||||
Owing to changes in docker NAT rules and container DNS resolution, some Wireguard client configurations generated with Mistborn before 25 April 2020 (be sure to update Mistborn) may experience issues after upgrading to Ubuntu 20.04 LTS. Symptoms: can ping but can't resolve DNS.
|
||||
Owing to changes in docker NAT rules and container DNS resolution, some WireGuard client configurations generated with Mistborn before 25 April 2020 (be sure to update Mistborn) may experience issues after upgrading to Ubuntu 20.04 LTS. Symptoms: can ping but can't resolve DNS.
|
||||
|
||||
Solution: Edit the Wireguard client config and set the DNS directive as follows:
|
||||
Solution: Edit the WireGuard client config and set the DNS directive as follows:
|
||||
```
|
||||
DNS = 10.2.3.1
|
||||
```
|
||||
Close the config and restart the client Wireguard process.
|
||||
Close the config and restart the client WireGuard process.
|
||||
|
||||
## Troubleshooting Raspberry Pi OS (Raspbian)
|
||||
Be sure to always reboot after updating the kernel. When the kernel is updated the kernel modules are deleted (for the currently running kernel) and you will have issues with any function requiring kernel modules (e.g. `iptables` or `wireguard`).
|
||||
@@ -512,7 +553,7 @@ Be sure to always reboot after updating the kernel. When the kernel is updated t
|
||||
**Note**: The Raspberry Pi OS 64-bit BETA (versions from May 2020 and prior) have a bug where the os-release info indicates that it is Debian. Mistborn proceeds to install as though it were Debian. Since it's not Debian there are errors.
|
||||
|
||||
## Troubleshooting Debian 10
|
||||
Run updates and restart before installing Mistborn (`sudo apt-get update && sudo apt-get -y dist-upgrade && sudo shutdown -r now`). Some older Linux kernels will prevent newer Wireguard versions from installing.
|
||||
Run updates and restart before installing Mistborn (`sudo apt-get update && sudo apt-get -y dist-upgrade && sudo shutdown -r now`). Some older Linux kernels will prevent newer WireGuard versions from installing.
|
||||
|
||||
# Technical and Security Insights
|
||||
These are some notes regarding the technical design and implementations of Mistborn. Feel free to contact me for additional details.
|
||||
@@ -521,15 +562,15 @@ These are some notes regarding the technical design and implementations of Mistb
|
||||
|
||||
See the [Mistborn Network Security](https://gitlab.com/cyber5k/mistborn/-/wikis/Mistborn-Network-Security) wiki entry.
|
||||
|
||||
- **Wireguard**: Wireguard is the only way in to Mistborn. When new Wireguard profiles are generated they are attached to a random UDP port. Wireguard does not respond to unauthenticated traffic. External probes on the active Wireguard listening ports are not logged and do not appear on the Metrics page.
|
||||
- **SSH**: If Mistborn is installed over SSH (most common) then an iptables rule is added allowing future SSH connections from the same source IP address. All other external SSH is blocked. Internal SSH (over the Wireguard tunnels) is allowed. Password authentication is allowed. The SSH key for the `mistborn` user is only accepted from internal source IP addresses. Fail2ban is also installed.
|
||||
- **Traefik**: Iptables closes web ports (TCP 80 and 443) from external access and additonally all web interfaces are behind the Traefik reverse-proxy. All web requests (e.g. home.mistborn) must be resolved by Mistborn DNS (Pihole/dnsmasq) and originate from a Wireguard tunnel.
|
||||
- **WireGuard**: WireGuard is the only way in to Mistborn. When new WireGuard profiles are generated they are attached to a random UDP port. WireGuard does not respond to unauthenticated traffic. External probes on the active WireGuard listening ports are not logged and do not appear on the Metrics page.
|
||||
- **SSH**: If Mistborn is installed over SSH (most common) then an iptables rule is added allowing future SSH connections from the same source IP address. All other external SSH is blocked. Internal SSH (over the WireGuard tunnels) is allowed. Password authentication is allowed. The SSH key for the `mistborn` user is only accepted from internal source IP addresses. Fail2ban is also installed.
|
||||
- **Traefik**: Iptables closes web ports (TCP 80 and 443) from external access and additonally all web interfaces are behind the Traefik reverse-proxy. All web requests (e.g. home.mistborn) must be resolved by Mistborn DNS (Pihole/dnsmasq) and originate from a WireGuard tunnel.
|
||||
- **Docker**: When Docker exposes a port it creates a PREROUTING rule in the NAT table to catch eligible network requests. This means that even if your INPUT chain policy is DROP, your docker containers with exposed ports can receive and respond to traffic. Whenever Mistborn brings up a docker container with an exposed port it creates an iptables rule to block external traffic to that service.
|
||||
|
||||
## Firewall
|
||||
- **IPtables**: Iptables rules and chains are manipulated directly. If UFW is present it is disabled. IPtables-persistent is used to save a simple set of secure default rules (most importantly setting the INPUT and FORWARD policies to DROP and allowing ESTABLISHED and RELATED traffic) that will be effective immediately upon system startup. Additional rules and chains are created by Docker on startup. Mistborn also creates some iptables chains during installation that are saved in the persistent rules. Mistborn iptables chains and rules are designed to work with Docker's with logic that is easy to follow. A power cycle will always result in a working state.
|
||||
- **PostUp/PostDown**: Wireguard configuration files on Mistborn include PostUp and PostDown directives that set routes and iptables rules for each Wireguard client individually.
|
||||
- **Wireguard**: There is a one-to-one mapping between each Wireguard client and server instance listening on Mistborn. By default Wireguard clients cannot talk directly to each other but can use shared services and resources on Mistborn (e.g. Syncthing, Nextcloud, Jitisi, etc). Toggling the "client-to-client" option will enable direct client-to-client communication.
|
||||
- **PostUp/PostDown**: WireGuard configuration files on Mistborn include PostUp and PostDown directives that set routes and iptables rules for each WireGuard client individually.
|
||||
- **WireGuard**: There is a one-to-one mapping between each WireGuard client and server instance listening on Mistborn. By default WireGuard clients cannot talk directly to each other but can use shared services and resources on Mistborn (e.g. Syncthing, Nextcloud, Jitisi, etc). Toggling the "client-to-client" option will enable direct client-to-client communication.
|
||||
- **Metrics**: In addition to the iptables INPUT policy set to DROP, an iptables chain exists that logs the packet meta data before dropping it. Mistborn redirects packets that will be dropped to this chain instead. A summary of the data about these dropped packets (unsolicited network traffic) can be found on the Metrics page.
|
||||
- **Coppercloud**: Coppercloud works by populating ipsets with the ipset module in iptables to DROP (blacklist) or ACCEPT (whitelist) a given set of IP addresses. Upon system startup a celery task will compile the IP addresses, create the ipsets, and iptables rules.
|
||||
|
||||
@@ -552,7 +593,8 @@ Many features and refinements are in the works at various stages including:
|
||||
# Featured In
|
||||
|
||||
- [Linux Magazine](https://www.linux-magazine.com/Issues/2020/240/Mistborn/(language)/eng-US) November 2020 (featuring Mistborn version from early May 2020)
|
||||
- [Awesome Open Source](https://www.youtube.com/watch?v=hekP0_crotw) July 2020 (featuring Mistborn version from early July 2020)
|
||||
- [Awesome Open Source](https://www.youtube.com/watch?v=hekP0_crotw) July 2020
|
||||
- [DB Tech](https://www.youtube.com/watch?v=UE_OuAOgoZI) May 2021
|
||||
|
||||
# Follow
|
||||
You can find recent bugfixes, functional additions, some extra documentation and more at the Cyber5K Patreon page: [https://www.patreon.com/cyber5k](https://www.patreon.com/cyber5k)
|
||||
@@ -564,6 +606,7 @@ Contact me at [steven@cyber5k.com](mailto:steven@cyber5k.com)
|
||||
# Support Mistborn
|
||||
|
||||
Please consider supporting the project via:
|
||||
- [Patreon](https://www.patreon.com/cyber5k)
|
||||
- [Paypal.me](https://paypal.me/cyber5k)
|
||||
- [Buy me a drink](https://www.buymeacoffee.com/cyber5k)
|
||||
- [Patreon](https://www.patreon.com/cyber5k)
|
||||
- Bitcoin: `3Lqxc1vpndN3TGi9cipNHg1RgXxGxVDdZo`
|
||||
|
||||
@@ -13,7 +13,7 @@ services:
|
||||
- postgres
|
||||
- redis
|
||||
ports:
|
||||
- "10.2.3.1:5000:5000/tcp" # auth access
|
||||
- "${MISTBORN_DNS_BIND_IP}:5000:5000/tcp" # auth access
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.django-http.rule=Host(`home.mistborn`)"
|
||||
@@ -51,7 +51,7 @@ services:
|
||||
# context: .
|
||||
# dockerfile: ./compose/production/traefik/Dockerfile
|
||||
#image: mistborn_production_traefik
|
||||
image: traefik:v2.2
|
||||
image: traefik:v2.4.9
|
||||
container_name: mistborn_production_traefik
|
||||
depends_on:
|
||||
- django
|
||||
@@ -84,6 +84,40 @@ services:
|
||||
#- --serversTransport.insecureSkipVerify=true
|
||||
restart: unless-stopped
|
||||
|
||||
portal:
|
||||
build:
|
||||
context: ./compose/production/portal/
|
||||
dockerfile: Dockerfile
|
||||
image: mistborn_production_portal
|
||||
container_name: mistborn_production_portal
|
||||
ports:
|
||||
- "${MISTBORN_DNS_BIND_IP}:5001:80"
|
||||
environment:
|
||||
- SERVER_REDIRECT=home.mistborn
|
||||
# optionally define path to redirect all requests
|
||||
# if not set nginx var $request_uri is used
|
||||
- SERVER_REDIRECT_PATH=/
|
||||
# optionally define schema to redirect all requests
|
||||
# if not set but X-Forwarded-Proto is send as request header with value 'https' this will be used.
|
||||
# In all other cases nginx var `$scheme` is used
|
||||
#- SERVER_REDIRECT_SCHEME=https
|
||||
# optionally define the http code to use for redirection
|
||||
# allowed Codes are: 301, 302, 303, 307, 308, default is 301
|
||||
#- SERVER_REDIRECT_CODE=301
|
||||
# optionally define the http code to redirect POST requests
|
||||
# if not set or not in allowed Codes, SERVER_REDIRECT_CODE will be used
|
||||
#- SERVER_REDIRECT_POST_CODE=
|
||||
# optionally define the http code to redirect PUT, PATCH and DELETE requests
|
||||
# if not set or not in allowed Codes, SERVER_REDIRECT_CODE will be used
|
||||
#- SERVER_REDIRECT_PUT_PATCH_DELETE_CODE=
|
||||
# optionally define the location for the nginx access log
|
||||
# if not set /dev/stdout is used
|
||||
#- SERVER_ACCESS_LOG=/dev/null
|
||||
# optionally define the location for the nginx error log
|
||||
# if not set /dev/stderr is used
|
||||
#- SERVER_ERROR_LOG=/dev/null
|
||||
restart: unless-stopped
|
||||
|
||||
redis:
|
||||
image: redis:5.0
|
||||
container_name: mistborn_production_redis
|
||||
@@ -96,6 +130,7 @@ services:
|
||||
- /home/mistborn/.ssh:/ssh
|
||||
- ../mistborn_volumes/base/media:/mistborn-media
|
||||
- ../mistborn_volumes/base/private_media:/mistborn-private-media
|
||||
- ./.envs/.production/.global:/.global
|
||||
env_file:
|
||||
- ./.envs/.production/.django
|
||||
- ./.envs/.production/.postgres
|
||||
@@ -119,6 +154,7 @@ services:
|
||||
- /home/mistborn/.ssh:/ssh
|
||||
- ../mistborn_volumes/base/media:/mistborn-media
|
||||
- ../mistborn_volumes/base/private_media:/mistborn-private-media
|
||||
- ./.envs/.production/.global:/.global
|
||||
env_file:
|
||||
- ./.envs/.production/.django
|
||||
- ./.envs/.production/.postgres
|
||||
@@ -158,7 +194,7 @@ services:
|
||||
|
||||
pihole:
|
||||
container_name: mistborn_production_pihole
|
||||
image: pihole/pihole:v5.7
|
||||
image: pihole/pihole:v5.8
|
||||
env_file:
|
||||
- ./.envs/.production/.pihole
|
||||
ports:
|
||||
@@ -177,8 +213,9 @@ services:
|
||||
- "traefik.http.services.pihole-service.loadbalancer.server.port=80"
|
||||
environment:
|
||||
- ServerIP=10.2.0.3
|
||||
- DNS1='10.2.0.2#5054' # docs say port 5054, was 54; use network_mode: host to see which port is used
|
||||
- DNS2=''
|
||||
- PIHOLE_DNS_=10.2.0.2#5054
|
||||
#- DNS1='10.2.0.2#5054' # docs say port 5054, was 54; use network_mode: host to see which port is used
|
||||
#- DNS2=''
|
||||
- IPv6='false'
|
||||
- DNSMASQ_LISTENING=all
|
||||
# TZ: 'America/New York'
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
FROM nginx:1.21.1-alpine
|
||||
|
||||
ADD run.sh /run.sh
|
||||
ADD default.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
RUN chmod +x /run.sh
|
||||
|
||||
CMD ["/run.sh"]
|
||||
@@ -0,0 +1,29 @@
|
||||
map $http_x_forwarded_proto $redirect_scheme {
|
||||
default $scheme;
|
||||
https https;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name ${SERVER_NAME};
|
||||
|
||||
# cherry picked from https://github.com/schmunk42/docker-nginx-redirect/pull/8
|
||||
if ($request_method = POST) {
|
||||
return ${SERVER_REDIRECT_POST_CODE} ${SERVER_REDIRECT_SCHEME}://${SERVER_REDIRECT}${SERVER_REDIRECT_PATH};
|
||||
}
|
||||
|
||||
if ($request_method ~ PUT|PATCH|DELETE) {
|
||||
return ${SERVER_REDIRECT_PUT_PATCH_DELETE_CODE} ${SERVER_REDIRECT_SCHEME}://${SERVER_REDIRECT}${SERVER_REDIRECT_PATH};
|
||||
}
|
||||
|
||||
return ${SERVER_REDIRECT_CODE} ${SERVER_REDIRECT_SCHEME}://${SERVER_REDIRECT}${SERVER_REDIRECT_PATH};
|
||||
|
||||
# redirect server error pages to the static page /50x.html
|
||||
#
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
if [ ! -n "$SERVER_REDIRECT" ] ; then
|
||||
echo "Environment variable SERVER_REDIRECT is not set, exiting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# set server name from optional ENV var
|
||||
if [ ! -n "$SERVER_NAME" ] ; then
|
||||
SERVER_NAME='localhost'
|
||||
fi
|
||||
|
||||
# set redirect code from optional ENV var
|
||||
# allowed Status Codes are: 301, 302, 303, 307, 308
|
||||
expr match "$SERVER_REDIRECT_CODE" '30[12378]$' > /dev/null || SERVER_REDIRECT_CODE='301'
|
||||
|
||||
# set redirect code from optional ENV var for POST requests
|
||||
expr match "$SERVER_REDIRECT_POST_CODE" '30[12378]$' > /dev/null || SERVER_REDIRECT_POST_CODE=$SERVER_REDIRECT_CODE
|
||||
|
||||
# set redirect code from optional ENV var for PUT, PATCH and DELETE requests
|
||||
expr match "$SERVER_REDIRECT_PUT_PATCH_DELETE_CODE" '30[12378]$' > /dev/null || SERVER_REDIRECT_PUT_PATCH_DELETE_CODE=$SERVER_REDIRECT_CODE
|
||||
|
||||
# set redirect path from optional ENV var
|
||||
if [ ! -n "$SERVER_REDIRECT_PATH" ] ; then
|
||||
SERVER_REDIRECT_PATH='$request_uri'
|
||||
fi
|
||||
|
||||
# set redirect scheme from optional ENV var
|
||||
if [ ! -n "$SERVER_REDIRECT_SCHEME" ] ; then
|
||||
SERVER_REDIRECT_SCHEME='$redirect_scheme'
|
||||
fi
|
||||
|
||||
# set access log location from optional ENV var
|
||||
if [ ! -n "$SERVER_ACCESS_LOG" ] ; then
|
||||
SERVER_ACCESS_LOG='/dev/stdout'
|
||||
fi
|
||||
|
||||
# set error log location from optional ENV var
|
||||
if [ ! -n "$SERVER_ERROR_LOG" ] ; then
|
||||
SERVER_ERROR_LOG='/dev/stderr'
|
||||
fi
|
||||
|
||||
sed -i "s|\${SERVER_REDIRECT}|${SERVER_REDIRECT}|" /etc/nginx/conf.d/default.conf
|
||||
sed -i "s|\${SERVER_NAME}|${SERVER_NAME}|" /etc/nginx/conf.d/default.conf
|
||||
sed -i "s|\${SERVER_REDIRECT_CODE}|${SERVER_REDIRECT_CODE}|" /etc/nginx/conf.d/default.conf
|
||||
sed -i "s|\${SERVER_REDIRECT_POST_CODE}|${SERVER_REDIRECT_POST_CODE}|" /etc/nginx/conf.d/default.conf
|
||||
sed -i "s|\${SERVER_REDIRECT_PUT_PATCH_DELETE_CODE}|${SERVER_REDIRECT_PUT_PATCH_DELETE_CODE}|" /etc/nginx/conf.d/default.conf
|
||||
sed -i "s|\${SERVER_REDIRECT_PATH}|${SERVER_REDIRECT_PATH}|" /etc/nginx/conf.d/default.conf
|
||||
sed -i "s|\${SERVER_REDIRECT_SCHEME}|${SERVER_REDIRECT_SCHEME}|" /etc/nginx/conf.d/default.conf
|
||||
|
||||
ln -sfT "$SERVER_ACCESS_LOG" /var/log/nginx/access.log
|
||||
ln -sfT "$SERVER_ERROR_LOG" /var/log/nginx/error.log
|
||||
|
||||
exec nginx -g 'daemon off;'
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM alpine:latest
|
||||
FROM alpine:3.14.0
|
||||
|
||||
RUN apk update \
|
||||
&& apk upgrade \
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM traefik:v2.2
|
||||
FROM traefik:v2.4.9
|
||||
RUN mkdir -p /etc/traefik/acme
|
||||
RUN touch /etc/traefik/acme/acme.json
|
||||
RUN chmod 600 /etc/traefik/acme/acme.json
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
scirius:
|
||||
container_name: mistborn_production_scirius
|
||||
image: "cyber5k/scirius:${MISTBORN_TAG}"
|
||||
#environment:
|
||||
# - SECRET_KEY: <SECRET KEY>
|
||||
env_file:
|
||||
- ../.envs/.production/.wazuh
|
||||
- ../.envs/.production/.scirius
|
||||
volumes:
|
||||
- /var/log/suricata:/logs
|
||||
- /etc/suricata/rules:/etc/suricata/rules
|
||||
- ../../mistborn_volumes/extra/scirius/static:/static
|
||||
- ../../mistborn_volumes/extra/scirius/data:/data
|
||||
- /var/run:/var/run:ro
|
||||
- /var/run/suricata/suricata-command.socket:/var/run/suricata/suricata-command.socket:ro
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.scirius-http.rule=Host(`scirius.mistborn`)"
|
||||
- "traefik.http.routers.scirius-http.entrypoints=web"
|
||||
- "traefik.http.routers.scirius-http.middlewares=mistborn_auth@file"
|
||||
- "traefik.http.routers.scirius-https.rule=Host(`scirius.mistborn`)"
|
||||
- "traefik.http.routers.scirius-https.entrypoints=websecure"
|
||||
- "traefik.http.routers.scirius-https.middlewares=mistborn_auth@file"
|
||||
- "traefik.http.routers.scirius-https.tls.certresolver=basic"
|
||||
- "traefik.http.services.scirius-service.loadbalancer.server.port=8000"
|
||||
restart: unless-stopped
|
||||
|
||||
# filebeat:
|
||||
# image: docker.elastic.co/beats/filebeat:${ELASTIC_VERSION:-7.9.1}
|
||||
# # https://github.com/docker/swarmkit/issues/1951
|
||||
# hostname: "{{.Node.Hostname}}-filebeat"
|
||||
# # Need to override user so we can access the log files, and docker.sock
|
||||
# user: root
|
||||
# configs:
|
||||
# - source: fb_config
|
||||
# target: /usr/share/filebeat/filebeat.yml
|
||||
# volumes:
|
||||
# - filebeat:/usr/share/filebeat/data
|
||||
# - /var/run/docker.sock:/var/run/docker.sock
|
||||
# # This is needed for filebeat to load container log path as specified in filebeat.yml
|
||||
# - /var/lib/docker/containers/:/var/lib/docker/containers/:ro
|
||||
|
||||
# # # This is needed for filebeat to load jenkins build log path as specified in filebeat.yml
|
||||
# # - /var/lib/docker/volumes/jenkins_home/_data/jobs/:/var/lib/docker/volumes/jenkins_home/_data/jobs/:ro
|
||||
|
||||
# # This is needed for filebeat to load logs for system and auth modules
|
||||
# - /var/log/:/var/log/:ro
|
||||
# # This is needed for filebeat to load logs for auditd module. you might have to install audit system
|
||||
# # on ubuntu first (sudo apt-get install -y auditd audispd-plugins)
|
||||
# - /var/log/audit/:/var/log/audit/:ro
|
||||
# environment:
|
||||
# - ELASTICSEARCH_HOST=${ELASTICSEARCH_HOST}
|
||||
# - KIBANA_HOST=${KIBANA_HOST}
|
||||
# - ELASTICSEARCH_USERNAME=${ELASTICSEARCH_USERNAME}
|
||||
# - ELASTICSEARCH_PASSWORD=${ELASTICSEARCH_PASSWORD}
|
||||
# # disable strict permission checks
|
||||
# command: ["--strict.perms=false"]
|
||||
|
||||
# volumes:
|
||||
# filebeat:
|
||||
|
||||
networks:
|
||||
default:
|
||||
external:
|
||||
name: mistborn_default
|
||||
|
||||
# configs:
|
||||
# fb_config:
|
||||
# file: /opt/mistborn_volumes/scirius/init/filebeat.docker.yml
|
||||
@@ -2,7 +2,7 @@ version: '3'
|
||||
|
||||
services:
|
||||
bitwarden:
|
||||
image: bitwardenrs/server:latest
|
||||
image: vaultwarden/server:latest
|
||||
container_name: mistborn_production_bitwarden
|
||||
env_file:
|
||||
- ../.envs/.production/.bitwarden
|
||||
|
After Width: | Height: | Size: 23 KiB |
@@ -0,0 +1,9 @@
|
||||
[DEFAULT]
|
||||
name = bitwarden
|
||||
subdomain = bitwarden
|
||||
desc = Bitwarden is a free and open-source password management service that stores sensitive information such as website credentials in an encrypted vault. The Bitwarden platform offers a variety of client applications including a web interface, desktop applications, browser extensions, mobile apps, and a CLI.
|
||||
img = img/bitwarden.png
|
||||
compose = compose/docker-compose.yml
|
||||
service = service/plugin.service
|
||||
environment = environment/environment.sh
|
||||
|
||||
@@ -3,7 +3,7 @@ version: '3.7'
|
||||
services:
|
||||
|
||||
elasticsearch:
|
||||
image: amazon/opendistro-for-elasticsearch:1.12.0
|
||||
image: amazon/opendistro-for-elasticsearch:1.13.2
|
||||
hostname: elasticsearch
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
@@ -0,0 +1,8 @@
|
||||
[DEFAULT]
|
||||
name = elasticsearch
|
||||
subdomain = elasticsearch
|
||||
compose = compose/docker-compose.yml
|
||||
service = service/plugin.service
|
||||
environment = environment/environment.sh
|
||||
resources = resources
|
||||
|
||||
@@ -11,6 +11,11 @@ mkdir -p /opt/mistborn_volumes/extra/elasticsearch/init/ >/dev/null 2>&1
|
||||
chmod -R +x /opt/mistborn_volumes/extra/elasticsearch/init/
|
||||
cp /opt/mistborn/scripts/services/elasticsearch/files/internal_users.yml /opt/mistborn_volumes/extra/elasticsearch/init/
|
||||
|
||||
ELASTICSEARCH_MISTBORN_HASHED=$(docker run --rm amazon/opendistro-for-elasticsearch:1.12.0 bash /usr/share/elasticsearch/plugins/opendistro_security/tools/hash.sh -p ${MISTBORN_DEFAULT_PASSWORD} | tr -d '\n')
|
||||
ELASTICSEARCH_MISTBORN_HASHED="$(docker run --rm amazon/opendistro-for-elasticsearch:1.12.0 bash /usr/share/elasticsearch/plugins/opendistro_security/tools/hash.sh -p ${MISTBORN_DEFAULT_PASSWORD} | tr -d '\n')"
|
||||
|
||||
if [[ -z "${ELASTICSEARCH_MISTBORN_HASHED}" ]]; then
|
||||
echo "Elasticsearch password hash not generated properly"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
sed -i "s|__MISTBORN_HASH__|${ELASTICSEARCH_MISTBORN_HASHED}|" /opt/mistborn_volumes/extra/elasticsearch/init/internal_users.yml
|
||||
@@ -5,7 +5,7 @@ services:
|
||||
# guacd
|
||||
guacd:
|
||||
container_name: mistborn_production_guacd
|
||||
image: guacamole/guacd
|
||||
image: guacamole/guacd:1.3.0
|
||||
networks:
|
||||
guacnetwork:
|
||||
restart: unless-stopped
|
||||
@@ -53,7 +53,7 @@ services:
|
||||
#GUACAMOLE_HOME: /config
|
||||
env_file:
|
||||
- ../.envs/.production/.guacamole
|
||||
image: guacamole/guacamole
|
||||
image: guacamole/guacamole:1.3.0
|
||||
links:
|
||||
- guacd
|
||||
networks:
|
||||
|
After Width: | Height: | Size: 36 KiB |
@@ -0,0 +1,10 @@
|
||||
[DEFAULT]
|
||||
name = guacamole
|
||||
subdomain = guacamole
|
||||
desc = Apache Guacamole is a clientless remote desktop gateway. It supports standard protocols like VNC, RDP, and SSH.
|
||||
img = img/guacamole.png
|
||||
compose = compose/docker-compose.yml
|
||||
service = service/plugin.service
|
||||
environment = environment/environment.sh
|
||||
resources = resources
|
||||
|
||||
|
After Width: | Height: | Size: 56 KiB |
@@ -0,0 +1,9 @@
|
||||
[DEFAULT]
|
||||
name = homeassistant
|
||||
subdomain = homeassistant
|
||||
desc = Home Assistant is an Open source home automation software that puts local control and privacy first.
|
||||
img = img/homeassistant.png
|
||||
compose = compose/docker-compose.yml
|
||||
service = service/plugin.service
|
||||
resources = resources
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
#!/bin/bash
|
||||
|
||||
HASS_CONFIG="/opt/mistborn_volumes/extra/homeassistant/config/configuration.yaml"
|
||||
|
||||
if [[ -f "$HASS_CONFIG" ]]; then
|
||||
# configuration.yaml exists
|
||||
|
||||
if [[ ! -z $(grep "use_x_forwarded_for: true" "$HASS_CONFIG") ]]; then
|
||||
# FOUND
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
# add the proxy config
|
||||
# write the trusted proxies config
|
||||
cat >> ${HASS_CONFIG}<< EOF
|
||||
|
||||
http:
|
||||
use_x_forwarded_for: true
|
||||
trusted_proxies:
|
||||
- 172.16.0.0/12
|
||||
|
||||
EOF
|
||||
|
||||
exit 0;
|
||||
|
||||
fi
|
||||
|
||||
# create parent directory if needed
|
||||
PARENTDIR="$(dirname $HASS_CONFIG)"
|
||||
if [[ ! -d "$PARENTDIR" ]]; then
|
||||
mkdir -p $PARENTDIR
|
||||
fi
|
||||
|
||||
# write the trusted proxies config
|
||||
cat >> ${HASS_CONFIG}<< EOF
|
||||
|
||||
# Configure a default setup of Home Assistant (frontend, api, etc)
|
||||
default_config:
|
||||
|
||||
# Text to speech
|
||||
#tts:
|
||||
# - platform: google_translate
|
||||
|
||||
#group: !include groups.yaml
|
||||
#automation: !include automations.yaml
|
||||
#script: !include scripts.yaml
|
||||
#scene: !include scenes.yaml
|
||||
|
||||
http:
|
||||
use_x_forwarded_for: true
|
||||
trusted_proxies:
|
||||
- 172.16.0.0/12
|
||||
|
||||
EOF
|
||||
|
After Width: | Height: | Size: 24 KiB |
@@ -0,0 +1,8 @@
|
||||
[DEFAULT]
|
||||
name = jellyfin
|
||||
subdomain = jellyfin
|
||||
desc = The Free Software Media System. Jellyfin is the volunteer-built media solution that puts you in control of your media. Stream to any device from your own server, with no strings attached.
|
||||
img = img/jellyfin.png
|
||||
compose = compose/docker-compose.yml
|
||||
service = service/plugin.service
|
||||
|
||||
|
After Width: | Height: | Size: 20 KiB |
@@ -0,0 +1,10 @@
|
||||
[DEFAULT]
|
||||
name = jitsi
|
||||
subdomain = jitsi
|
||||
desc = Jitsi is a collection of free and open-source multiplatform voice, videoconferencing and instant messaging applications for the web platform, Windows, Linux, Mac OS X and Android.
|
||||
img = img/jitsi.png
|
||||
compose = compose/docker-compose.yml
|
||||
service = service/plugin.service
|
||||
environment = environment/environment.sh
|
||||
resources = resources
|
||||
|
||||
|
After Width: | Height: | Size: 18 KiB |
@@ -0,0 +1,9 @@
|
||||
[DEFAULT]
|
||||
name = nextcloud
|
||||
subdomain = nextcloud
|
||||
desc = Nextcloud is a suite of client-server software for creating and using file hosting services. Nextcloud application functionally is similar to Dropbox.
|
||||
img = img/nextcloud.png
|
||||
compose = compose/docker-compose.yml
|
||||
service = service/plugin.service
|
||||
environment = environment/environment.sh
|
||||
|
||||
|
After Width: | Height: | Size: 8.5 KiB |
@@ -0,0 +1,9 @@
|
||||
[DEFAULT]
|
||||
name = onlyoffice
|
||||
subdomain = onlyoffice
|
||||
desc = An open source office suite featuring online document editors, platform for document management, corporate communication, mail and project management tools.
|
||||
img = img/onlyoffice.jpg
|
||||
compose = compose/docker-compose.yml
|
||||
service = service/plugin.service
|
||||
environment = environment/environment.sh
|
||||
|
||||
|
After Width: | Height: | Size: 122 KiB |
@@ -0,0 +1,9 @@
|
||||
[DEFAULT]
|
||||
name = raspap
|
||||
subdomain = raspap
|
||||
desc = The easiest, full-featured wireless router setup for Debian-based devices. Period. (Mistborn integration in alpha testing)
|
||||
img = img/raspap.png
|
||||
compose = compose/docker-compose.yml
|
||||
service = service/plugin.service
|
||||
environment = environment/environment.sh
|
||||
|
||||
|
After Width: | Height: | Size: 13 KiB |
@@ -0,0 +1,9 @@
|
||||
[DEFAULT]
|
||||
name = rocketchat
|
||||
subdomain = rocketchat
|
||||
desc = Rocket.Chat is the leading open source team chat software solution.
|
||||
img = img/rocketchat.png
|
||||
compose = compose/docker-compose.yml
|
||||
service = service/plugin.service
|
||||
environment = environment/environment.sh
|
||||
|
||||
@@ -2,7 +2,7 @@ version: '3'
|
||||
|
||||
services:
|
||||
syncthing:
|
||||
image: linuxserver/syncthing
|
||||
image: linuxserver/syncthing:latest
|
||||
container_name: mistborn_production_syncthing
|
||||
environment:
|
||||
- PUID=1000
|
||||
|
After Width: | Height: | Size: 48 KiB |
@@ -0,0 +1,8 @@
|
||||
[DEFAULT]
|
||||
name = syncthing
|
||||
subdomain = syncthing
|
||||
desc = Syncthing is a free, open-source peer-to-peer file synchronization application available for Windows, Mac, Linux, Android, Solaris, Darwin, and BSD. It can sync files between devices on a local network, or between remote devices over the Internet. Data security and data safety are built into the design of the software.
|
||||
img = img/syncthing.png
|
||||
compose = compose/docker-compose.yml
|
||||
service = service/plugin.service
|
||||
|
||||
|
After Width: | Height: | Size: 25 KiB |
@@ -0,0 +1,8 @@
|
||||
[DEFAULT]
|
||||
name = tor
|
||||
subdomain = tor
|
||||
desc = Tor is free and open-source software for enabling anonymous communication.
|
||||
img = img/tor.png
|
||||
compose = compose/docker-compose.yml
|
||||
service = service/plugin.service
|
||||
|
||||
@@ -3,7 +3,7 @@ version: '3.7'
|
||||
|
||||
services:
|
||||
wazuh:
|
||||
image: wazuh/wazuh-odfe:4.1.2
|
||||
image: wazuh/wazuh-odfe:4.1.5
|
||||
hostname: wazuh-manager
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
@@ -29,7 +29,7 @@ services:
|
||||
- filebeat_var:/var/lib/filebeat
|
||||
|
||||
wazuh-kibana:
|
||||
image: wazuh/wazuh-kibana-odfe:4.1.2
|
||||
image: wazuh/wazuh-kibana-odfe:4.1.5
|
||||
hostname: wazuh-kibana
|
||||
restart: unless-stopped
|
||||
labels:
|
||||
@@ -0,0 +1,8 @@
|
||||
[DEFAULT]
|
||||
name = wazuh
|
||||
subdomain = wazuh
|
||||
compose = compose/docker-compose.yml
|
||||
service = service/plugin.service
|
||||
environment = environment/environment.sh
|
||||
resources = resources
|
||||
|
||||
@@ -13,7 +13,7 @@ source /opt/mistborn/scripts/subinstallers/platform.sh
|
||||
# minimal dependencies
|
||||
sudo -E apt-get -y install libpcre3 libpcre3-dbg libpcre3-dev build-essential libpcap-dev \
|
||||
libyaml-0-2 libyaml-dev pkg-config zlib1g zlib1g-dev \
|
||||
make libmagic-dev libjansson-dev
|
||||
make libmagic-dev libjansson-dev jq wget
|
||||
|
||||
## recommended dependencies
|
||||
#sudo -E apt-get -y install libpcre3 libpcre3-dbg libpcre3-dev build-essential libpcap-dev \
|
||||
@@ -55,11 +55,24 @@ fi
|
||||
# sudo chown root:root /etc/rsyslog.d/20-suricata.conf
|
||||
# sudo systemctl restart rsyslog
|
||||
|
||||
# rules
|
||||
pushd .
|
||||
cd /tmp
|
||||
wget https://rules.emergingthreats.net/open/suricata-4.0/emerging.rules.tar.gz
|
||||
tar zxvf emerging.rules.tar.gz
|
||||
sudo -E rm /etc/suricata/rules/* -f
|
||||
sudo -E mv rules/*.rules /etc/suricata/rules/
|
||||
popd
|
||||
|
||||
# suricata yaml
|
||||
sudo -E rm -f /etc/suricata/suricata.yaml
|
||||
sudo -E wget -O /etc/suricata/suricata.yaml http://www.branchnetconsulting.com/wazuh/suricata.yaml
|
||||
|
||||
IFACE=$(ip -o -4 route show to default | awk 'NR==1{print $5}')
|
||||
sudo sed -i "s/eth0/${IFACE}/g" /etc/suricata/suricata.yaml
|
||||
sudo sed -i "s/eth0/${IFACE}/g" /etc/default/suricata
|
||||
|
||||
systemctl restart suricata
|
||||
#systemctl restart suricata
|
||||
|
||||
# wait for service to be listening
|
||||
while ! nc -z 10.2.3.1 55000; do
|
||||
@@ -73,14 +86,14 @@ pushd .
|
||||
cd /opt/mistborn
|
||||
|
||||
# ensure group exists
|
||||
sudo docker-compose -f extra/wazuh.yml exec -T wazuh /var/ossec/bin/agent_groups -a -g suricata -q 2>/dev/null
|
||||
sudo docker-compose --env-file /opt/mistborn/.env -f extra/wazuh.yml exec -T wazuh /var/ossec/bin/agent_groups -a -g suricata -q 2>/dev/null
|
||||
|
||||
# add this host to group
|
||||
WAZUH_ID=$(sudo docker-compose -f extra/wazuh.yml exec -T wazuh /var/ossec/bin/manage_agents -l | egrep ^\ *ID | grep $(hostname) | awk '{print $2}' | tr -d ',')
|
||||
sudo docker-compose -f extra/wazuh.yml exec -T wazuh /var/ossec/bin/agent_groups -a -i ${WAZUH_ID} -g suricata -q
|
||||
WAZUH_ID=$(sudo docker-compose --env-file /opt/mistborn/.env -f extra/wazuh.yml exec -T wazuh /var/ossec/bin/manage_agents -l | egrep ^\ *ID | grep $(hostname) | awk '{print $2}' | tr -d ',')
|
||||
sudo docker-compose --env-file /opt/mistborn/.env -f extra/wazuh.yml exec -T wazuh /var/ossec/bin/agent_groups -a -i ${WAZUH_ID} -g suricata -q
|
||||
|
||||
# write agent.conf
|
||||
sudo docker-compose -f extra/wazuh.yml exec -T wazuh bash -c "cat > /var/ossec/etc/shared/suricata/agent.conf << EOF
|
||||
sudo docker-compose --env-file /opt/mistborn/.env -f extra/wazuh.yml exec -T wazuh bash -c "cat > /var/ossec/etc/shared/suricata/agent.conf << EOF
|
||||
<agent_config>
|
||||
<localfile>
|
||||
<log_format>json</log_format>
|
||||
@@ -91,11 +104,26 @@ EOF
|
||||
"
|
||||
|
||||
# restart manager
|
||||
sudo docker-compose -f extra/wazuh.yml restart wazuh
|
||||
sudo docker-compose --env-file /opt/mistborn/.env -f extra/wazuh.yml restart wazuh
|
||||
|
||||
popd
|
||||
|
||||
# suricata-update
|
||||
sudo -E apt install python3-pip
|
||||
sudo -E pip3 install pyyaml
|
||||
sudo -E pip3 install https://github.com/OISF/suricata-update/archive/master.zip
|
||||
|
||||
mkdir -p /opt/mistborn_volumes/extra/scirius/init/ >/dev/null 2>&1
|
||||
chmod -R +x /opt/mistborn_volumes/extra/scirius/init/
|
||||
cp /opt/mistborn/scripts/services/scirius/files/filebeat.docker.yml /opt/mistborn_volumes/extra/scirius/init/
|
||||
sudo -E pip3 install --pre --upgrade suricata-update
|
||||
|
||||
# sudo -E suricata-update enable-source oisf/trafficid
|
||||
# sudo -E suricata-update enable-source etnetera/aggressive
|
||||
# sudo -E suricata-update enable-source sslbl/ssl-fp-blacklist
|
||||
# sudo -E suricata-update enable-source et/open
|
||||
# sudo -E suricata-update enable-source tgreen/hunting
|
||||
# sudo -E suricata-update enable-source sslbl/ja3-fingerprints
|
||||
# sudo -E suricata-update enable-source ptresearch/attackdetection
|
||||
|
||||
sudo -E suricata-update
|
||||
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl restart suricata
|
||||
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
systemctl start suricata
|
||||
systemctl enable suricata
|
||||
|
||||
#apt-get install -y python-pyinotify
|
||||
#python /opt/mistborn/scripts/services/scirius/suri_reloader -p /etc/suricata/rules &
|
||||
@@ -3,4 +3,4 @@
|
||||
systemctl stop suricata
|
||||
systemctl disable suricata
|
||||
|
||||
kill $(pgrep -f suri_reloader) 2>/dev/null
|
||||
#kill $(pgrep -f suri_reloader) 2>/dev/null
|
||||
@@ -7,6 +7,7 @@ PartOf=Mistborn-base.service
|
||||
[Service]
|
||||
Restart=always
|
||||
RestartSec=15
|
||||
TimeoutStartSec=600
|
||||
User=root
|
||||
Group=docker
|
||||
PermissionsStartOnly=true
|
||||
@@ -17,8 +18,12 @@ ExecStart=/opt/mistborn/scripts/wrappers/mistborn_docker.sh wazuh docker-compose
|
||||
# Agent install
|
||||
ExecStartPost=/opt/mistborn/scripts/wrappers/mistborn_docker.sh wazuh /opt/mistborn/scripts/services/wazuh/agent.sh
|
||||
ExecStartPost=-/opt/mistborn/scripts/wrappers/mistborn_docker.sh wazuh /opt/mistborn/scripts/services/wazuh/agent_start.sh
|
||||
# Suricata
|
||||
ExecStartPost=-/opt/mistborn/scripts/wrappers/mistborn_docker.sh wazuh /opt/mistborn/scripts/services/wazuh/suricata/suricata_init.sh
|
||||
ExecStartPost=-/opt/mistborn/scripts/wrappers/mistborn_docker.sh wazuh /opt/mistborn/scripts/services/wazuh/suricata/suricata_start.sh
|
||||
# Stop container when unit is stopped
|
||||
ExecStop=/opt/mistborn/scripts/wrappers/mistborn_docker.sh wazuh docker-compose -f /opt/mistborn/extra/wazuh.yml down
|
||||
ExecStopPost=-/opt/mistborn/scripts/wrappers/mistborn_docker.sh wazuh /opt/mistborn/scripts/services/wazuh/suricata/suricata_stop.sh
|
||||
ExecStopPost=-/opt/mistborn/scripts/wrappers/mistborn_docker.sh wazuh /opt/mistborn/scripts/services/wazuh/agent_stop.sh
|
||||
|
||||
[Install]
|
||||
@@ -28,9 +28,9 @@ echo "MISTBORN_BIND_IP=10.2.3.1" | sudo tee -a ${VAR_FILE}
|
||||
|
||||
# MISTBORN_TAG
|
||||
|
||||
GIT_BRANCH=$(git -C /opt/mistborn symbolic-ref --short HEAD || echo "master")
|
||||
MISTBORN_TAG="latest"
|
||||
if [ "$GIT_BRANCH" != "master" ]; then
|
||||
GIT_BRANCH=$(git -C /opt/mistborn symbolic-ref --short HEAD || echo "v1-1")
|
||||
MISTBORN_TAG="v1"
|
||||
if [ "$GIT_BRANCH" != "v1-1" ]; then
|
||||
MISTBORN_TAG="test"
|
||||
fi
|
||||
|
||||
|
||||
@@ -105,13 +105,39 @@ source ./scripts/subinstallers/platform.sh
|
||||
|
||||
# iptables
|
||||
echo "Setting up firewall (iptables)"
|
||||
if [ ! -f "/etc/iptables/rules.v4" ]; then
|
||||
echo "Setting iptables rules..."
|
||||
./scripts/subinstallers/iptables.sh
|
||||
else
|
||||
echo "iptables rules exist. Leaving alone."
|
||||
if [ -f "/etc/iptables/rules.v4" ]; then
|
||||
echo "Caution: iptables rules exist."
|
||||
|
||||
read -p "Would you like to Clear (C) existing iptables rules or Add (A) to existing rules (this may cause problems)? [c/a] " MISTBORN_IPTABLES_ACTION
|
||||
echo
|
||||
|
||||
if [[ "${MISTBORN_IPTABLES_ACTION}" =~ ^([cC])$ ]]; then
|
||||
# clear
|
||||
echo "Clearing existing iptables rules..."
|
||||
sudo rm -rf /etc/iptables/rules.v4
|
||||
sudo iptables -F
|
||||
sudo iptables -t nat -F
|
||||
sudo iptables -P INPUT ACCEPT
|
||||
sudo iptables -P FORWARD ACCEPT
|
||||
sudo rm -rf /etc/iptables/rules.v6 || true
|
||||
sudo ip6tables -F || true
|
||||
sudo ip6tables -t nat -F || true
|
||||
sudo ip6tables -P INPUT ACCEPT || true
|
||||
sudo ip6tables -P FORWARD ACCEPT || true
|
||||
|
||||
elif [[ "${MISTBORN_IPTABLES_ACTION}" =~ ^([aA])$ ]]; then
|
||||
# do nothing
|
||||
echo "Proceeding..."
|
||||
|
||||
else
|
||||
echo "Unrecognized action: stopping"
|
||||
exit 1;
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Setting iptables rules..."
|
||||
source ./scripts/subinstallers/iptables.sh
|
||||
|
||||
# SSH Server
|
||||
sudo -E apt-get install -y openssh-server
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
[Unit]
|
||||
Description=Mistborn Scirius Service
|
||||
Requires=Mistborn-wazuh.service
|
||||
After=Mistborn-wazuh.service
|
||||
PartOf=Mistborn-base.service
|
||||
|
||||
[Service]
|
||||
Restart=always
|
||||
RestartSec=15
|
||||
User=root
|
||||
Group=docker
|
||||
PermissionsStartOnly=true
|
||||
# Shutdown container (if running) when unit is stopped
|
||||
ExecStartPre=/opt/mistborn/scripts/wrappers/mistborn_docker.sh wazuh,scirius docker-compose -f /opt/mistborn/extra/scirius.yml down
|
||||
|
||||
# Start container when unit is started
|
||||
ExecStart=/opt/mistborn/scripts/wrappers/mistborn_docker.sh wazuh,scirius docker-compose -f /opt/mistborn/extra/scirius.yml up --build
|
||||
# Suricata
|
||||
ExecStartPost=/opt/mistborn/scripts/wrappers/mistborn_docker.sh wazuh,scirius /opt/mistborn/scripts/services/scirius/suricata_start.sh
|
||||
|
||||
# Stop container when unit is stopped
|
||||
ExecStop=/opt/mistborn/scripts/wrappers/mistborn_docker.sh wazuh,scirius docker-compose -f /opt/mistborn/extra/scirius.yml down
|
||||
# Post stop
|
||||
ExecStopPost=-/opt/mistborn/scripts/wrappers/mistborn_docker.sh wazuh,scirius /opt/mistborn/scripts/services/scirius/suricata_stop.sh
|
||||
|
||||
[Install]
|
||||
WantedBy=Mistborn-base.service
|
||||
@@ -1,6 +0,0 @@
|
||||
<agent_config>
|
||||
<localfile>
|
||||
<log_format>json</log_format>
|
||||
<location>/var/log/suricata/eve.json</location>
|
||||
</localfile>
|
||||
</agent_config>
|
||||
@@ -1,62 +0,0 @@
|
||||
filebeat.modules:
|
||||
- module: suricata
|
||||
eve:
|
||||
enabled: true
|
||||
var.paths: ["/var/log/suricata/eve.json"]
|
||||
# - module: system
|
||||
# syslog:
|
||||
# enabled: true
|
||||
# auth:
|
||||
# enabled: true
|
||||
# - module: auditd
|
||||
# log:
|
||||
# # - Does not look like Auditd is supported in Alpine linux: https://github.com/linuxkit/linuxkit/issues/52
|
||||
# # - CentOS does not need us to install the audit system, it ships as standard. If you are using Ubuntu, though,
|
||||
# # this is probably something you would want to install. (sudo apt-get install -y auditd audispd-plugins)
|
||||
# enabled: true
|
||||
|
||||
#filebeat.inputs:
|
||||
#- type: container
|
||||
# enabled: true
|
||||
# paths:
|
||||
# -/var/lib/docker/containers/*/*.log
|
||||
# stream: all # can be all, stdout or stderr
|
||||
|
||||
#========================== Filebeat autodiscover ==============================
|
||||
# See this URL on how to run Apache2 Filebeat module: # https://www.elastic.co/guide/en/beats/filebeat/current/running-on-docker.html
|
||||
filebeat.autodiscover:
|
||||
providers:
|
||||
- type: docker
|
||||
# https://www.elastic.co/guide/en/beats/filebeat/current/configuration-autodiscover-hints.html
|
||||
# This URL alos contains instructions on multi-line logs
|
||||
hints.enabled: true
|
||||
|
||||
#================================ Processors ===================================
|
||||
processors:
|
||||
#- add_cloud_metadata: ~
|
||||
- add_docker_metadata: ~
|
||||
- add_locale:
|
||||
format: offset
|
||||
- add_host_metadata:
|
||||
netinfo.enabled: true
|
||||
|
||||
#========================== Elasticsearch output ===============================
|
||||
output.elasticsearch:
|
||||
hosts: ["${ELASTICSEARCH_HOST}:9200"]
|
||||
username: ${ELASTICSEARCH_USERNAME}
|
||||
password: ${ELASTICSEARCH_PASSWORD}
|
||||
|
||||
#============================== Dashboards =====================================
|
||||
setup.dashboards:
|
||||
enabled: true
|
||||
|
||||
#============================== Kibana =========================================
|
||||
setup.kibana:
|
||||
host: "${KIBANA_HOST}:80"
|
||||
username: ${ELASTICSEARCH_USERNAME}
|
||||
password: ${ELASTICSEARCH_PASSWORD}
|
||||
|
||||
#============================== Xpack Monitoring ===============================
|
||||
xpack.monitoring:
|
||||
enabled: true
|
||||
elasticsearch:
|
||||
@@ -1,117 +0,0 @@
|
||||
#!/usr/bin/python3
|
||||
"""
|
||||
Copyright(C) 2014-2020, Stamus Networks
|
||||
Written by Eric Leblond <eleblond@stamus-networks.com>
|
||||
|
||||
This file is part of Scirius.
|
||||
|
||||
Scirius is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Scirius is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Scirius. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""
|
||||
|
||||
import pyinotify
|
||||
import argparse
|
||||
import subprocess
|
||||
import logging
|
||||
import os
|
||||
|
||||
have_daemon = True
|
||||
try:
|
||||
import daemon
|
||||
import daemon.pidfile as pidlockfile
|
||||
except:
|
||||
logging.warning("No daemon support available, install python-daemon if feature is needed")
|
||||
have_daemon = False
|
||||
|
||||
RELOAD_FILE = "scirius.reload"
|
||||
|
||||
parser = argparse.ArgumentParser(description='Suricata reloader')
|
||||
parser.add_argument('-r', '--reload', default=False, action="store_true", help="If set reload Suricata instead of restarting")
|
||||
parser.add_argument('-p', '--path', default='/etc/suricata/rules', help='Directory to monitor for scirius.reload file')
|
||||
parser.add_argument('-l', '--log', default=None, help='File to log output to (default to stdout)')
|
||||
parser.add_argument('-v', '--verbose', default=False, action="count", help="Show verbose output, use multiple times increase verbosity")
|
||||
if have_daemon:
|
||||
parser.add_argument('-D', '--daemon', default=False, action="store_true", help="Run as unix daemon")
|
||||
parser.add_argument('-P', '--pidfile', default='/var/run/suri-reloader.pid', help='PID file for suri-reloader')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.verbose >= 3:
|
||||
loglevel=logging.DEBUG
|
||||
elif args.verbose >= 2:
|
||||
loglevel=logging.INFO
|
||||
elif args.verbose >= 1:
|
||||
loglevel=logging.WARNING
|
||||
else:
|
||||
loglevel=logging.ERROR
|
||||
|
||||
def SuriReload(reload = False):
|
||||
if reload:
|
||||
if subprocess.call(['service', 'suricata', 'reload']):
|
||||
logging.error("Unable to reload suricata")
|
||||
else:
|
||||
logging.info("Reloaded suricata")
|
||||
else:
|
||||
if subprocess.call(['service', 'suricata', 'restart']):
|
||||
logging.error("Unable to restart suricata")
|
||||
else:
|
||||
logging.info("Restarted suricata")
|
||||
|
||||
class EventHandler(pyinotify.ProcessEvent):
|
||||
def process_IN_CLOSE_WRITE(self, event):
|
||||
if not RELOAD_FILE in event.pathname:
|
||||
return
|
||||
SuriReload(self.reload)
|
||||
os.unlink(event.pathname)
|
||||
|
||||
def set_mode(self, mode):
|
||||
if mode == "reload":
|
||||
self.reload = True
|
||||
else:
|
||||
self.reload = False
|
||||
|
||||
def setup_logging(args):
|
||||
if args.log:
|
||||
logging.basicConfig(filename=args.log,
|
||||
format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
|
||||
level=loglevel)
|
||||
else:
|
||||
logging.basicConfig(level=loglevel)
|
||||
|
||||
def main_task(args):
|
||||
setup_logging(args)
|
||||
|
||||
reload_file = os.path.join(args.path, RELOAD_FILE)
|
||||
if os.path.isfile(reload_file):
|
||||
SuriReload(args.reload)
|
||||
os.unlink(reload_file)
|
||||
|
||||
handler = EventHandler()
|
||||
if args.reload:
|
||||
handler.set_mode("reload")
|
||||
else:
|
||||
handler.set_mode("restart")
|
||||
|
||||
wm = pyinotify.WatchManager() # Watch Manager
|
||||
mask = pyinotify.IN_CLOSE_WRITE
|
||||
notifier = pyinotify.Notifier(wm, handler)
|
||||
wdd = wm.add_watch(args.path, mask, rec=True)
|
||||
logging.info("Starting filesystem monitoring")
|
||||
notifier.loop()
|
||||
|
||||
if have_daemon and args.daemon:
|
||||
pidfile = pidlockfile.TimeoutPIDLockFile(args.pidfile)
|
||||
with daemon.DaemonContext(pidfile=pidfile):
|
||||
main_task(args)
|
||||
else:
|
||||
main_task(args)
|
||||
@@ -1,7 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
systemctl start suricata
|
||||
systemctl enable suricata
|
||||
|
||||
apt-get install -y python-pyinotify
|
||||
python /opt/mistborn/scripts/services/scirius/suri_reloader -p /etc/suricata/rules &
|
||||
@@ -6,7 +6,18 @@ figlet "Mistborn: Installing Docker"
|
||||
sudo apt update
|
||||
sudo -E apt install -y python python3-pip python3-setuptools libffi-dev python3-dev libssl-dev
|
||||
|
||||
if [ "$DISTRO" == "ubuntu" ] && [ "$VERSION_ID" == "20.04" ]; then
|
||||
# Ubuntu version >= 20.04
|
||||
|
||||
set +e
|
||||
vercomp "$VERSION_ID" "19.10"
|
||||
case $? in
|
||||
0) op='=';;
|
||||
1) op='>';;
|
||||
2) op='<';;
|
||||
esac
|
||||
set -e
|
||||
|
||||
if [ "$DISTRO" == "ubuntu" ] && [ "$op" == ">" ]; then
|
||||
echo "Automated Docker install"
|
||||
sudo -E apt-get install -y docker-compose
|
||||
else
|
||||
|
||||
@@ -67,3 +67,8 @@ echo "Installing Docker Compose"
|
||||
sudo pip3 install cryptography==3.3.2 docker-compose
|
||||
#fi
|
||||
|
||||
|
||||
# check raspbian fixes
|
||||
if [ "$DISTRO" == "raspbian" ] || [ "$DISTRO" == "raspios" ]; then
|
||||
source ./scripts/subinstallers/docker_raspbian.sh
|
||||
fi
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
|
||||
set +e
|
||||
|
||||
compare_version() {
|
||||
local versionOne="${1}"
|
||||
local comparision="${2}"
|
||||
local versionTwo="${3}"
|
||||
local result=
|
||||
local sortOpt=
|
||||
local returncode=1
|
||||
|
||||
if [[ "${versionOne}" == "${versionTwo}" ]] ; then
|
||||
return 3
|
||||
fi
|
||||
|
||||
case ${comparision} in
|
||||
lower|smaller|older|lt|"<" ) sortOpt= ;;
|
||||
higher|bigger|newer|bt|">" ) sortOpt='r' ;;
|
||||
* ) return 2 ;;
|
||||
esac
|
||||
|
||||
result=($(printf "%s\n" "${versionOne}" "${versionTwo}" | sort -${sortOpt}V ))
|
||||
if [[ "${versionOne}" == "${result[0]}" ]] ; then
|
||||
returncode=0
|
||||
fi
|
||||
|
||||
return ${returncode}
|
||||
} # end of function compare_version
|
||||
|
||||
# libseccomp2
|
||||
LIBSECCOMP2_VERSION=$(sudo -E apt-cache policy libseccomp2 | egrep ^\ *Inst | awk '{print $2}')
|
||||
|
||||
compare_version $LIBSECCOMP2_VERSION '<' '2.5.1-1'
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
# this is dumb but the raspbian repo managers aren't impressive
|
||||
echo "Installing newer libseccomp2"
|
||||
pushd .
|
||||
cd /tmp
|
||||
wget http://ftp.us.debian.org/debian/pool/main/libs/libseccomp/libseccomp2_2.5.1-1_$(dpkg --print-architecture).deb
|
||||
sudo dpkg -i libseccomp2_2.5.1-1_$(dpkg --print-architecture).deb
|
||||
popd
|
||||
fi
|
||||
|
||||
set -e
|
||||
@@ -1,16 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Scirius
|
||||
SCIRIUS_PROD_FILE="$1"
|
||||
SCIRIUS_SECRET_KEY=$(python3 -c "import secrets; import string; print(f''.join([secrets.choice(string.ascii_letters+string.digits) for x in range(50)]))")
|
||||
echo "SECRET_KEY=$SCIRIUS_SECRET_KEY" > $SCIRIUS_PROD_FILE
|
||||
echo "ALLOWED_HOSTS=scirius.mistborn" >> $SCIRIUS_PROD_FILE
|
||||
echo "DJANGO_SUPERUSER_USERNAME=mistborn" >> $SCIRIUS_PROD_FILE
|
||||
echo "DJANGO_SUPERUSER_EMAIL=mistborn@email.mistborn" >> $SCIRIUS_PROD_FILE
|
||||
|
||||
echo "ELASTICSEARCH_HOST=10.2.3.1" >> $SCIRIUS_PROD_FILE
|
||||
echo "KIBANA_HOST=wazuh.mistborn" >> $SCIRIUS_PROD_FILE
|
||||
|
||||
echo "MISTBORN_DEFAULT_PASSWORD=$MISTBORN_DEFAULT_PASSWORD" >> $SCIRIUS_PROD_FILE
|
||||
|
||||
chmod 600 $SCIRIUS_PROD_FILE
|
||||
@@ -21,8 +21,8 @@ echo "#MAILGUN_API_KEY=" >> $DJANGO_PROD_FILE
|
||||
echo "#MAILGUN_API_URL=" >> $DJANGO_PROD_FILE
|
||||
echo "#SENTRY_DNS=" >> $DJANGO_PROD_FILE
|
||||
echo "MISTBORN_INSTALL_COCKPIT=$MISTBORN_INSTALL_COCKPIT" >> $DJANGO_PROD_FILE
|
||||
echo "MISTBORN_PORTAL_IP=10.2.3.1" >> $DJANGO_PROD_FILE
|
||||
echo "MISTBORN_PORTAL_PORT=5000" >> $DJANGO_PROD_FILE
|
||||
#echo "MISTBORN_PORTAL_IP=10.2.3.1" >> $DJANGO_PROD_FILE
|
||||
echo "MISTBORN_PORTAL_REDIRECT_PORT=5001" >> $DJANGO_PROD_FILE
|
||||
chmod 600 $DJANGO_PROD_FILE
|
||||
|
||||
# generate production .env file for postgresql
|
||||
@@ -43,3 +43,8 @@ WEBPASSWORD="$1"
|
||||
echo "TZ=\"America/New York\"" > $PIHOLE_PROD_FILE
|
||||
echo "WEBPASSWORD=$WEBPASSWORD" >> $PIHOLE_PROD_FILE
|
||||
chmod 600 $PIHOLE_PROD_FILE
|
||||
|
||||
|
||||
GLOBAL_SERVICES_FILE="./.envs/.production/.global"
|
||||
echo "[DEFAULT]" > $GLOBAL_SERVICES_FILE
|
||||
chmod 600 $GLOBAL_SERVICES_FILE
|
||||
|
||||
@@ -11,6 +11,9 @@ if [ "$DISTRO" == "ubuntu" ]; then
|
||||
sudo systemctl disable ufw || true
|
||||
fi
|
||||
|
||||
# make sure user land binaries installed
|
||||
sudo apt-get install -y iptables
|
||||
|
||||
# default interface
|
||||
iface=$(ip -o -4 route show to default | egrep -o 'dev [^ ]*' | awk 'NR==1{print $2}')
|
||||
|
||||
|
||||
@@ -15,3 +15,39 @@ fi
|
||||
figlet "UNAME: $UNAME"
|
||||
figlet "DISTRO: $DISTRO"
|
||||
figlet "VERSION: $VERSION_ID"
|
||||
|
||||
|
||||
vercomp () {
|
||||
# case $? in
|
||||
# 0) op='=';;
|
||||
# 1) op='>';;
|
||||
# 2) op='<';;
|
||||
if [[ $1 == $2 ]]
|
||||
then
|
||||
return 0
|
||||
fi
|
||||
local IFS=.
|
||||
local i ver1=($1) ver2=($2)
|
||||
# fill empty fields in ver1 with zeros
|
||||
for ((i=${#ver1[@]}; i<${#ver2[@]}; i++))
|
||||
do
|
||||
ver1[i]=0
|
||||
done
|
||||
for ((i=0; i<${#ver1[@]}; i++))
|
||||
do
|
||||
if [[ -z ${ver2[i]} ]]
|
||||
then
|
||||
# fill empty fields in ver2 with zeros
|
||||
ver2[i]=0
|
||||
fi
|
||||
if ((10#${ver1[i]} > 10#${ver2[i]}))
|
||||
then
|
||||
return 1
|
||||
fi
|
||||
if ((10#${ver1[i]} < 10#${ver2[i]}))
|
||||
then
|
||||
return 2
|
||||
fi
|
||||
done
|
||||
return 0
|
||||
}
|
||||
@@ -1,16 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
figlet "Mistborn: Installing Wireguard"
|
||||
figlet "Mistborn: Installing WireGuard"
|
||||
|
||||
# if wireguard not in current repositories
|
||||
if ! $(sudo apt-cache show wireguard > /dev/null 2>&1) ; then
|
||||
# install PPAs
|
||||
|
||||
echo "Adding Wireguard PPAs"
|
||||
echo "Adding WireGuard PPAs"
|
||||
|
||||
# Wireguard
|
||||
if [ "$DISTRO" == "raspbian" ] || [ "$DISTRO" == "raspios" ]; then
|
||||
echo "Adding Wireguard repo keys"
|
||||
echo "Adding WireGuard repo keys"
|
||||
sudo -E apt-get install -y dirmngr
|
||||
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 8B48AD6246925553
|
||||
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 7638D0442B90D010
|
||||
@@ -28,6 +28,6 @@ if ! $(sudo apt-cache show wireguard > /dev/null 2>&1) ; then
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Installing Wireguard"
|
||||
echo "Installing WireGuard"
|
||||
sudo apt-get update
|
||||
sudo -E apt-get install -y openresolv wireguard
|
||||
|
||||
@@ -37,6 +37,12 @@ for SERVICE in "${SERVICES_ARRAY[@]}"; do
|
||||
fi
|
||||
done
|
||||
|
||||
# check that netcat exists
|
||||
if ! [ -x "$(command -v nc)" ]; then
|
||||
echo "Installing netcat"
|
||||
sudo apt-get install -y netcat
|
||||
fi
|
||||
|
||||
# ensure base is up and listening
|
||||
echo "Checking that Mistborn-base has finished starting up..."
|
||||
|
||||
|
||||