Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3267aaf3de | ||
|
|
86c2526512 | ||
|
|
bfd44f504f | ||
|
|
906205aa8e | ||
|
|
7a1dab435f | ||
|
|
980432dc43 | ||
|
|
71b538bdb7 | ||
|
|
c6b5295aca | ||
|
|
e655a71db3 | ||
|
|
d289abaa4b | ||
|
|
b83227e39d | ||
|
|
5f825ff831 | ||
|
|
75da49eeab | ||
|
|
97d25bbce4 | ||
|
|
5b9e07fb24 | ||
|
|
1ca2a80da3 | ||
|
|
b9b0eebf1e | ||
|
|
6fe1abc57f | ||
|
|
10568bc684 | ||
|
|
7bce97479f | ||
|
|
8de1dafcad | ||
|
|
ae1461abba | ||
|
|
42bd766346 | ||
|
|
ed37b142ba | ||
|
|
3675e3d0d2 | ||
|
|
e935b95285 | ||
|
|
9e7f85b6f9 | ||
|
|
72ba1769aa | ||
|
|
d65e5434a0 | ||
|
|
445cf2678e | ||
|
|
ce5dfb10fa |
@@ -15,6 +15,8 @@ The term [Mistborn](http://www.brandonsanderson.com/the-mistborn-saga-the-origin
|
||||
|
||||
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 an [Offensive Security Certified Professional (OSCP)](https://resources.infosecinstitute.com/certification/the-oscp-certification-and-exam/), 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
|
||||
@@ -40,6 +42,10 @@ These tools are not vital to Mistborn itself but are integrated to enhance secur
|
||||
- [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
|
||||
- [Nextcloud](https://nextcloud.com): Nextcloud offers the industry-leading, on-premises content collaboration platform. It combines the convenience and ease of use of consumer-grade solutions like Dropbox and Google Drive with the security, privacy and control business needs.
|
||||
@@ -51,6 +57,7 @@ Within Mistborn is a panel to enable and manage these free extra services (off b
|
||||
- [Tor](https://www.torproject.org): The Onion Router. One tool in the arsenal of online security and privacy.
|
||||
- [Jitsi](https://jitsi.org): Multi-platform open-source video conferencing
|
||||
- [Guacamole](https://guacamole.apache.org): A clientless remote desktop gateway that supports standard protocols like VNC, RDP, and SSH.
|
||||
- [RaspAP](https://raspap.com/): The easiest, full-featured wireless router setup for Debian-based devices. Period. (Mistborn integration in alpha testing).
|
||||
|
||||
# Quickstart
|
||||
Tested Operating Systems (in order of thoroughness):
|
||||
@@ -81,6 +88,7 @@ Recommended System Specifications:
|
||||
| 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+ |
|
||||
| SIEM | Default + Wazuh + Extras | 16 GB+ | 100 GB+ |
|
||||
|
||||
Starting from base installation
|
||||
```
|
||||
@@ -96,7 +104,7 @@ sudo mistborn-cli getconf
|
||||
|
||||
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
|
||||

|
||||
@@ -108,6 +116,20 @@ Mistborn protects your data in a variety of ways:
|
||||
|
||||
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.
|
||||
|
||||
# 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.
|
||||
|
||||
Mistborn's Wazuh installs and integrates with Suricata running on Mistborn with logs ingested into Wazuh.
|
||||
|
||||

|
||||
|
||||
The Wazuh Kibana plugin leverages the power of Elasticsearch:
|
||||
|
||||

|
||||
|
||||
# Coppercloud
|
||||
Pihole provides a way to block outgoing DNS requests for given lists of blocked domains. Coppercloud provides a way to block outgoing network calls of all types to given lists of IP addresses (IPv4 only for now). This is especially useful for blocking outgoing telemetry (data and state sharing) to owners of software running on all of your devices.
|
||||
|
||||
@@ -288,6 +310,8 @@ Mistborn uses the following domains (that can be reached by all Wireguard client
|
||||
| OnlyOffice | onlyoffice.mistborn | Off |
|
||||
| Jitsi | jitsi.mistborn | Off |
|
||||
| Guacamole | guac.mistborn | Off |
|
||||
| RaspAP | raspap.mistborn | Off |
|
||||
| Wazuh | wazuh.mistborn | Off |
|
||||
|
||||
# Default Credentials
|
||||
These are the default credentials to use in the services you choose to use:
|
||||
@@ -296,8 +320,10 @@ These are the default credentials to use in the services you choose to use:
|
||||
| ------- | -------- | -------- |
|
||||
| Pihole | | {{default mistborn password}} |
|
||||
| Cockpit | cockpit | {{default mistborn password}} |
|
||||
| Wazuh | mistborn | {{default mistborn password}} |
|
||||
| Nextcloud | mistborn | {{default mistborn password}} |
|
||||
| Guacamole | mistborn | {{default mistborn password }} |
|
||||
| RaspAP | mistborn | {{default mistborn password}} |
|
||||
|
||||
You can find the credentials sent to the Docker containers in: `/opt/mistborn/.envs/.production/`
|
||||
|
||||
@@ -461,6 +487,8 @@ sudo journalctl -xfu Mistborn-guacamole
|
||||
sudo journalctl -xfu Mistborn-rocketchat
|
||||
sudo journalctl -xfu Mistborn-onlyoffice
|
||||
sudo journalctl -xfu Mistborn-tor
|
||||
sudo journalctl -xfu Mistborn-raspap
|
||||
sudo journalctl -xfu Mistborn-wazuh
|
||||
```
|
||||
|
||||
## Troubleshooting Docker
|
||||
@@ -526,14 +554,13 @@ Many features and refinements are in the works at various stages including:
|
||||
- Plugins for Extra Services (enabling third-party development)
|
||||
- Plugin repository
|
||||
- IPv6 support
|
||||
- Integration with RaspAP to enable managing an Access Point for local network connections
|
||||
- Internal network scan tool and feedback
|
||||
- Anomaly detection in network traffic
|
||||
|
||||
# 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)
|
||||
|
||||
@@ -53,6 +53,13 @@ services:
|
||||
#image: mistborn_production_traefik
|
||||
image: traefik:v2.2
|
||||
container_name: mistborn_production_traefik
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.api.rule=Host(`traefik.mistborn`)"
|
||||
- "traefik.http.routers.api.service=api@internal"
|
||||
- "traefik.http.routers.api.middlewares=mistborn_headers@file"
|
||||
- "traefik.http.routers.api.entrypoints=web"
|
||||
#- "traefik.http.services.internal.loadbalancer.server.port=5000"
|
||||
depends_on:
|
||||
- django
|
||||
volumes:
|
||||
@@ -67,11 +74,11 @@ services:
|
||||
# #- "0.0.0.0:8080:8080/tcp" # dashboard
|
||||
command:
|
||||
## API settings
|
||||
#- --api.insecure=true
|
||||
#- --api.dashboard=true
|
||||
#- --api.debug=true
|
||||
- --api.insecure=true
|
||||
- --api.dashboard=true
|
||||
- --api.debug=true
|
||||
## Logs
|
||||
- --log.level=ERROR
|
||||
- --log.level=INFO
|
||||
## Providers
|
||||
- --providers.docker=true
|
||||
- --providers.docker.exposedbydefault=false
|
||||
@@ -158,7 +165,7 @@ services:
|
||||
|
||||
pihole:
|
||||
container_name: mistborn_production_pihole
|
||||
image: pihole/pihole:latest
|
||||
image: pihole/pihole:v5.7
|
||||
env_file:
|
||||
- ./.envs/.production/.pihole
|
||||
ports:
|
||||
@@ -168,13 +175,16 @@ services:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.pihole-http.rule=Host(`pihole.mistborn`)"
|
||||
- "traefik.http.routers.pihole-http.entrypoints=web"
|
||||
- "traefik.http.routers.pihole-http.middlewares=mistborn_auth@file,add-pihole-admin"
|
||||
- "traefik.http.routers.pihole-http.middlewares=mistborn_auth,add-pihole-admin"
|
||||
- "traefik.http.routers.pihole-https.rule=Host(`pihole.mistborn`)"
|
||||
- "traefik.http.routers.pihole-https.entrypoints=websecure"
|
||||
- "traefik.http.routers.pihole-https.middlewares=mistborn_auth@file,add-pihole-admin"
|
||||
- "traefik.http.routers.pihole-https.middlewares=mistborn_auth,add-pihole-admin"
|
||||
- "traefik.http.routers.pihole-https.tls.certresolver=basic"
|
||||
- "traefik.http.middlewares.add-pihole-admin.addPrefix.prefix=/admin"
|
||||
- "traefik.http.services.pihole-service.loadbalancer.server.port=80"
|
||||
- "traefik.http.middlewares.mistborn_auth.forwardAuth.address=http://${MISTBORN_BIND_IP}:5000/auth/"
|
||||
- "traefik.http.middlewares.mistborn_auth.forwardAuth.trustForwardHeader=true"
|
||||
- "traefik.http.middlewares.mistborn_auth.forwardAuth.tls.insecureSkipVerify=true"
|
||||
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
|
||||
|
||||
@@ -11,21 +11,15 @@
|
||||
[http.services]
|
||||
[http.services.cockpit.loadBalancer]
|
||||
[[http.services.cockpit.loadBalancer.servers]]
|
||||
url = "http://10.2.3.1:9090"
|
||||
url = "http://127.0.0.1:9090"
|
||||
|
||||
[http.routers]
|
||||
[http.routers.cockpit]
|
||||
rule = "Host(`cockpit.mistborn`)"
|
||||
service = "cockpit"
|
||||
entrypoints = ["web", "websecure"]
|
||||
middlewares = ["mistborn_auth"]
|
||||
middlewares = ["mistborn_auth@docker"]
|
||||
|
||||
[http.middlewares]
|
||||
[http.middlewares.mistborn_auth.forwardAuth]
|
||||
address = "http://10.2.3.1:5000/auth/"
|
||||
trustForwardHeader = true
|
||||
[http.middlewares.mistborn_auth.forwardAuth.tls]
|
||||
insecureSkipVerify = true
|
||||
|
||||
[http.middlewares.mistborn_headers.headers]
|
||||
hostsProxyHeaders = ['X-CSRFToken']
|
||||
+1
-1
@@ -19,7 +19,7 @@ services:
|
||||
- "traefik.http.routers.bitwarden-https.tls.certresolver=basic"
|
||||
- "traefik.http.services.bitwarden-service.loadbalancer.server.port=80"
|
||||
ports:
|
||||
- 3012:3012/tcp
|
||||
- "${MISTBORN_BIND_IP}:3012:3012/tcp"
|
||||
restart: unless-stopped
|
||||
|
||||
networks:
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
version: '3.7'
|
||||
|
||||
services:
|
||||
|
||||
elasticsearch:
|
||||
image: amazon/opendistro-for-elasticsearch:1.12.0
|
||||
hostname: elasticsearch
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "${MISTBORN_BIND_IP}:9200:9200"
|
||||
environment:
|
||||
- discovery.type=single-node
|
||||
- cluster.name=mistborn-cluster
|
||||
- network.host=0.0.0.0
|
||||
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
|
||||
- bootstrap.memory_lock=true
|
||||
volumes:
|
||||
- ../../mistborn_volumes/extra/elasticsearch/init/internal_users.yml:/usr/share/elasticsearch/plugins/opendistro_security/securityconfig/internal_users.yml
|
||||
ulimits:
|
||||
memlock:
|
||||
soft: -1
|
||||
hard: -1
|
||||
nofile:
|
||||
soft: 65536
|
||||
hard: 65536
|
||||
|
||||
networks:
|
||||
default:
|
||||
external:
|
||||
name: mistborn_default
|
||||
@@ -216,8 +216,8 @@ services:
|
||||
image: jitsi/jvb:latest
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- '${JVB_PORT}:${JVB_PORT}/udp'
|
||||
- '${JVB_TCP_PORT}:${JVB_TCP_PORT}'
|
||||
- "${MISTBORN_BIND_IP}:${JVB_PORT}:${JVB_PORT}/udp"
|
||||
- "${MISTBORN_BIND_IP}:${JVB_TCP_PORT}:${JVB_TCP_PORT}"
|
||||
volumes:
|
||||
- ${CONFIG}/jvb:/config:Z
|
||||
env_file:
|
||||
|
||||
+11
-8
@@ -2,12 +2,9 @@ version: '3'
|
||||
|
||||
services:
|
||||
raspap:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: ./compose/production/raspap/Dockerfile
|
||||
#user: root
|
||||
image: mistborn_production_raspap
|
||||
image: "cyber5k/raspap:${MISTBORN_TAG}"
|
||||
container_name: mistborn_production_raspap
|
||||
#network_mode: host
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.raspap-http.rule=Host(`raspap.mistborn`)"
|
||||
@@ -19,10 +16,16 @@ services:
|
||||
- "traefik.http.routers.raspap-https.tls.certresolver=basic"
|
||||
- "traefik.http.services.raspap-service.loadbalancer.server.port=80"
|
||||
env_file:
|
||||
- ../.envs/.production/.pihole
|
||||
command: /start
|
||||
- ../.envs/.production/.raspap
|
||||
cap_add:
|
||||
#- NET_ADMIN
|
||||
- SYS_ADMIN
|
||||
#- CAP_FOWNER
|
||||
privileged: true
|
||||
volumes:
|
||||
- ../../mistborn_volumes/extra/raspap/etc-raspap:/etc/raspap
|
||||
- /sys/fs/cgroup:/sys/fs/cgroup:ro
|
||||
#command: /start
|
||||
restart: unless-stopped
|
||||
|
||||
networks:
|
||||
default:
|
||||
|
||||
+2
-2
@@ -15,8 +15,8 @@ services:
|
||||
- ../../mistborn_volumes/extra/syncthing/data2:/data2
|
||||
ports:
|
||||
#- 8384:8384
|
||||
- 22000:22000/tcp # listening port
|
||||
- 21027:21027/udp # protocol discovery
|
||||
- "${MISTBORN_BIND_IP}:22000:22000/tcp" # listening port
|
||||
- "${MISTBORN_BIND_IP}:21027:21027/udp" # protocol discovery
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.syncthing-http.rule=Host(`syncthing.mistborn`)"
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ services:
|
||||
image: mistborn_production_tor
|
||||
container_name: mistborn_production_tor
|
||||
ports:
|
||||
- 9150:9150/tcp
|
||||
- "${MISTBORN_BIND_IP}:9150:9150/tcp"
|
||||
|
||||
networks:
|
||||
default:
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
# Wazuh App Copyright (C) 2021 Wazuh Inc. (License GPLv2)
|
||||
version: '3.7'
|
||||
|
||||
services:
|
||||
wazuh:
|
||||
image: wazuh/wazuh-odfe:4.1.2
|
||||
hostname: wazuh-manager
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "${MISTBORN_BIND_IP}:1514:1514"
|
||||
- "${MISTBORN_BIND_IP}:1515:1515"
|
||||
- "${MISTBORN_BIND_IP}:514:514/udp"
|
||||
- "${MISTBORN_BIND_IP}:55000:55000"
|
||||
environment:
|
||||
- FILEBEAT_SSL_VERIFICATION_MODE=none
|
||||
env_file:
|
||||
- ../.envs/.production/.wazuh
|
||||
volumes:
|
||||
- ossec_api_configuration:/var/ossec/api/configuration
|
||||
- ossec_etc:/var/ossec/etc
|
||||
- ossec_logs:/var/ossec/logs
|
||||
- ossec_queue:/var/ossec/queue
|
||||
- ossec_var_multigroups:/var/ossec/var/multigroups
|
||||
- ossec_integrations:/var/ossec/integrations
|
||||
- ossec_active_response:/var/ossec/active-response/bin
|
||||
- ossec_agentless:/var/ossec/agentless
|
||||
- ossec_wodles:/var/ossec/wodles
|
||||
- filebeat_etc:/etc/filebeat
|
||||
- filebeat_var:/var/lib/filebeat
|
||||
|
||||
wazuh-kibana:
|
||||
image: wazuh/wazuh-kibana-odfe:4.1.2
|
||||
hostname: wazuh-kibana
|
||||
restart: unless-stopped
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.wazuhk-http.rule=Host(`wazuh.mistborn`)"
|
||||
- "traefik.http.routers.wazuhk-http.entrypoints=web"
|
||||
- "traefik.http.routers.wazuhk-http.middlewares=mistborn_auth@file"
|
||||
- "traefik.http.routers.wazuhk-https.rule=Host(`wazuh.mistborn`)"
|
||||
- "traefik.http.routers.wazuhk-https.entrypoints=websecure"
|
||||
- "traefik.http.routers.wazuhk-https.middlewares=mistborn_auth@file"
|
||||
- "traefik.http.routers.wazuhk-https.tls.certresolver=basic"
|
||||
- "traefik.http.services.wazuhk-service.loadbalancer.server.port=5601"
|
||||
#ports:
|
||||
# - "${MISTBORN_BIND_IP}:5601:5601"
|
||||
environment:
|
||||
- SERVER_SSL_ENABLED=false
|
||||
- SERVER_SSL_CERTIFICATE=/usr/share/kibana/config/opendistroforelasticsearch.example.org.cert
|
||||
- SERVER_SSL_KEY=/usr/share/kibana/config/opendistroforelasticsearch.example.org.key
|
||||
env_file:
|
||||
- ../.envs/.production/.wazuh
|
||||
|
||||
volumes:
|
||||
ossec_api_configuration:
|
||||
ossec_etc:
|
||||
ossec_logs:
|
||||
ossec_queue:
|
||||
ossec_var_multigroups:
|
||||
ossec_integrations:
|
||||
ossec_active_response:
|
||||
ossec_agentless:
|
||||
ossec_wodles:
|
||||
filebeat_etc:
|
||||
filebeat_var:
|
||||
|
||||
networks:
|
||||
default:
|
||||
external:
|
||||
name: mistborn_default
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"shutdown-timeout": 60
|
||||
}
|
||||
Vendored
-15
@@ -1,15 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# must be run as mistborn
|
||||
if [[ $(whoami) != 'mistborn' ]]; then
|
||||
echo "This must be run as mistborn"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# input arguments
|
||||
export MISTBORN_DEFAULT_PASSWORD="$1"
|
||||
|
||||
# set paths
|
||||
export MISTBORN_HOME=/opt/mistborn
|
||||
export MISTBORN_ENV_SCRIPT=${MISTBORN_HOME}/scripts/subinstallers/gen_prod_env.sh
|
||||
|
||||
+17
-19
@@ -59,13 +59,22 @@ echo -e "| | | | \__ \ |_| |_) | (_) | | | | | |"
|
||||
echo -e "|_| |_|_|___/\__|_.__/ \___/|_| |_| |_|"
|
||||
echo -e ""
|
||||
|
||||
# INPUT default admin password
|
||||
if [ -z "${MISTBORN_DEFAULT_PASSWORD}" ]; then
|
||||
read -p "(Mistborn) Set default admin password: " -s MISTBORN_DEFAULT_PASSWORD
|
||||
echo
|
||||
else
|
||||
echo "MISTBORN_DEFAULT_PASSWORD is already set"
|
||||
fi
|
||||
sudo rm -rf /opt/mistborn 2>/dev/null || true
|
||||
|
||||
# clone to /opt and change directory
|
||||
echo "Cloning $GIT_BRANCH branch from mistborn repo"
|
||||
sudo git clone https://gitlab.com/cyber5k/mistborn.git -b $GIT_BRANCH /opt/mistborn
|
||||
sudo chown -R $USER:$USER /opt/mistborn
|
||||
pushd .
|
||||
cd /opt/mistborn
|
||||
git submodule update --init --recursive
|
||||
|
||||
# Check updates
|
||||
echo "Checking updates"
|
||||
source ./scripts/subinstallers/check_updates.sh
|
||||
|
||||
# MISTBORN_DEFAULT_PASSWORD
|
||||
source ./scripts/subinstallers/passwd.sh
|
||||
|
||||
# Install Cockpit?
|
||||
if [ -z "${MISTBORN_INSTALL_COCKPIT}" ]; then
|
||||
@@ -85,18 +94,7 @@ else
|
||||
echo "SSH key exists for $USER"
|
||||
fi
|
||||
|
||||
sudo rm -rf /opt/mistborn 2>/dev/null || true
|
||||
|
||||
# clone to /opt and change directory
|
||||
echo "Cloning $GIT_BRANCH branch from mistborn repo"
|
||||
sudo git clone https://gitlab.com/cyber5k/mistborn.git -b $GIT_BRANCH /opt/mistborn
|
||||
sudo chown -R $USER:$USER /opt/mistborn
|
||||
pushd .
|
||||
cd /opt/mistborn
|
||||
git submodule update --init --recursive
|
||||
|
||||
# initial load update package list
|
||||
sudo apt-get update
|
||||
# initial load update package list during check_updates.sh
|
||||
|
||||
# install figlet
|
||||
sudo -E apt-get install -y figlet
|
||||
|
||||
@@ -7,11 +7,17 @@ After=netfilter-persistent.service
|
||||
|
||||
[Service]
|
||||
Restart=always
|
||||
RestartSec=15
|
||||
User=root
|
||||
Group=docker
|
||||
PermissionsStartOnly=true
|
||||
# Shutdown container (if running) when unit is stopped
|
||||
EnvironmentFile=/opt/mistborn/.env
|
||||
|
||||
# stop all containers joined to mistborn_default network
|
||||
ExecStartPre=-/usr/bin/bash -c "docker container stop $(docker network inspect mistborn_default | grep Name | tail -n +2 | cut -d':' -f2 | tr -d ',\"') 2>/dev/null"
|
||||
|
||||
# bring down the base service
|
||||
ExecStartPre=/usr/local/bin/docker-compose -f /opt/mistborn/base.yml down
|
||||
|
||||
ExecStartPre=/usr/local/bin/docker-compose -f /opt/mistborn/base.yml build
|
||||
|
||||
@@ -6,6 +6,7 @@ PartOf=Mistborn-base.service
|
||||
|
||||
[Service]
|
||||
Restart=always
|
||||
RestartSec=15
|
||||
User=root
|
||||
Group=docker
|
||||
PermissionsStartOnly=true
|
||||
@@ -21,4 +22,4 @@ ExecStop=/opt/mistborn/scripts/wrappers/mistborn_docker.sh bitwarden docker-comp
|
||||
ExecStopPost=-/sbin/iptables -D DOCKER-USER -i DIFACE -p tcp --dport 3012 -j MISTBORN_LOG_DROP
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
WantedBy=Mistborn-base.service
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
[Unit]
|
||||
Description=Mistborn Elasticsearch Service
|
||||
Requires=Mistborn-base.service
|
||||
After=Mistborn-base.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=/usr/sbin/sysctl -w vm.max_map_count=262144
|
||||
ExecStartPre=/opt/mistborn/scripts/wrappers/mistborn_docker.sh elasticsearch docker-compose -f /opt/mistborn/extra/elasticsearch.yml down
|
||||
# Start container when unit is started
|
||||
ExecStart=/opt/mistborn/scripts/wrappers/mistborn_docker.sh elasticsearch docker-compose -f /opt/mistborn/extra/elasticsearch.yml up --build
|
||||
# Stop container when unit is stopped
|
||||
ExecStop=/opt/mistborn/scripts/wrappers/mistborn_docker.sh elasticsearch docker-compose -f /opt/mistborn/extra/elasticsearch.yml down
|
||||
|
||||
[Install]
|
||||
WantedBy=Mistborn-base.service
|
||||
@@ -6,6 +6,7 @@ PartOf=Mistborn-base.service
|
||||
|
||||
[Service]
|
||||
Restart=always
|
||||
RestartSec=15
|
||||
User=root
|
||||
Group=docker
|
||||
PermissionsStartOnly=true
|
||||
@@ -19,4 +20,4 @@ ExecStop=/opt/mistborn/scripts/wrappers/mistborn_docker.sh guacamole docker-comp
|
||||
# Post stop
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
WantedBy=Mistborn-base.service
|
||||
|
||||
@@ -6,6 +6,7 @@ PartOf=Mistborn-base.service
|
||||
|
||||
[Service]
|
||||
Restart=always
|
||||
RestartSec=15
|
||||
User=root
|
||||
Group=docker
|
||||
PermissionsStartOnly=true
|
||||
@@ -19,4 +20,4 @@ ExecStop=/opt/mistborn/scripts/wrappers/mistborn_docker.sh homeassistant docker-
|
||||
# Post stop
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
WantedBy=Mistborn-base.service
|
||||
|
||||
@@ -6,6 +6,7 @@ PartOf=Mistborn-base.service
|
||||
|
||||
[Service]
|
||||
Restart=always
|
||||
RestartSec=15
|
||||
User=root
|
||||
Group=docker
|
||||
PermissionsStartOnly=true
|
||||
@@ -19,4 +20,4 @@ ExecStop=/opt/mistborn/scripts/wrappers/mistborn_docker.sh jellyfin docker-compo
|
||||
# Post stop
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
WantedBy=Mistborn-base.service
|
||||
|
||||
@@ -6,6 +6,7 @@ PartOf=Mistborn-base.service
|
||||
|
||||
[Service]
|
||||
Restart=always
|
||||
RestartSec=15
|
||||
User=root
|
||||
Group=docker
|
||||
PermissionsStartOnly=true
|
||||
@@ -23,4 +24,4 @@ ExecStop=/opt/mistborn/scripts/wrappers/mistborn_docker.sh jitsi docker-compose
|
||||
ExecStopPost=-/opt/mistborn/scripts/wrappers/mistborn_docker.sh jitsi /opt/mistborn/scripts/services/jitsi/iptables_down.sh
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
WantedBy=Mistborn-base.service
|
||||
|
||||
@@ -6,6 +6,7 @@ PartOf=Mistborn-base.service
|
||||
|
||||
[Service]
|
||||
Restart=always
|
||||
RestartSec=15
|
||||
User=root
|
||||
Group=docker
|
||||
PermissionsStartOnly=true
|
||||
@@ -19,4 +20,4 @@ ExecStop=/opt/mistborn/scripts/wrappers/mistborn_docker.sh nextcloud docker-comp
|
||||
# Post stop
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
WantedBy=Mistborn-base.service
|
||||
|
||||
@@ -6,6 +6,7 @@ PartOf=Mistborn-base.service
|
||||
|
||||
[Service]
|
||||
Restart=always
|
||||
RestartSec=15
|
||||
User=root
|
||||
Group=docker
|
||||
PermissionsStartOnly=true
|
||||
@@ -19,4 +20,4 @@ ExecStop=/opt/mistborn/scripts/wrappers/mistborn_docker.sh onlyoffice docker-com
|
||||
# Post stop
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
WantedBy=Mistborn-base.service
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
[Unit]
|
||||
Description=Mistborn RaspAP Service
|
||||
Requires=Mistborn-base.service
|
||||
After=Mistborn-base.service
|
||||
|
||||
[Service]
|
||||
Restart=always
|
||||
RestartSec=15
|
||||
User=root
|
||||
Group=docker
|
||||
PermissionsStartOnly=true
|
||||
ExecStartPre=/sbin/iptables -I DOCKER-USER -i DIFACE -p tcp --dport 8095 -j MISTBORN_LOG_DROP
|
||||
#ExecStartPre=/bin/bash /opt/mistborn_volumes/extra/raspap/etc-raspap/hostapd/servicestart.sh --interface uap0 --seconds 3
|
||||
# Shutdown container (if running) when unit is stopped
|
||||
ExecStartPre=/opt/mistborn/scripts/wrappers/mistborn_docker.sh raspap docker-compose -f /opt/mistborn/extra/raspap.yml down
|
||||
|
||||
# Start container when unit is started
|
||||
ExecStart=/opt/mistborn/scripts/wrappers/mistborn_docker.sh raspap docker-compose -f /opt/mistborn/extra/raspap.yml up --build
|
||||
# Stop container when unit is stopped
|
||||
ExecStop=/opt/mistborn/scripts/wrappers/mistborn_docker.sh raspap docker-compose -f /opt/mistborn/extra/raspap.yml down
|
||||
ExecStopPost=-/sbin/iptables -D DOCKER-USER -i DIFACE -p tcp --dport 8095 -j MISTBORN_LOG_DROP
|
||||
# Post stop
|
||||
|
||||
[Install]
|
||||
WantedBy=Mistborn-base.service
|
||||
@@ -6,6 +6,7 @@ PartOf=Mistborn-base.service
|
||||
|
||||
[Service]
|
||||
Restart=always
|
||||
RestartSec=15
|
||||
User=root
|
||||
Group=docker
|
||||
PermissionsStartOnly=true
|
||||
@@ -21,4 +22,4 @@ ExecStop=/opt/mistborn/scripts/wrappers/mistborn_docker.sh rocketchat docker-com
|
||||
ExecStopPost=-/sbin/iptables -D DOCKER-USER -i DIFACE -p tcp --dport 3001 -j MISTBORN_LOG_DROP
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
WantedBy=Mistborn-base.service
|
||||
|
||||
@@ -6,6 +6,7 @@ PartOf=Mistborn-base.service
|
||||
|
||||
[Service]
|
||||
Restart=always
|
||||
RestartSec=15
|
||||
User=root
|
||||
Group=docker
|
||||
PermissionsStartOnly=true
|
||||
@@ -23,4 +24,4 @@ ExecStopPost=-/sbin/iptables -D DOCKER-USER -i DIFACE -p udp --dport 21027 -j MI
|
||||
ExecStopPost=-/sbin/iptables -D DOCKER-USER -i DIFACE -p tcp --dport 22000 -j MISTBORN_LOG_DROP
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
WantedBy=Mistborn-base.service
|
||||
|
||||
@@ -6,6 +6,7 @@ PartOf=Mistborn-base.service
|
||||
|
||||
[Service]
|
||||
Restart=always
|
||||
RestartSec=15
|
||||
User=root
|
||||
Group=docker
|
||||
PermissionsStartOnly=true
|
||||
@@ -21,4 +22,4 @@ ExecStop=/opt/mistborn/scripts/wrappers/mistborn_docker.sh tor docker-compose -f
|
||||
ExecStopPost=-/sbin/iptables -D DOCKER-USER -i DIFACE -p tcp --dport 9150 -j MISTBORN_LOG_DROP
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
WantedBy=Mistborn-base.service
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
[Unit]
|
||||
Description=Mistborn Wazuh Service
|
||||
Requires=Mistborn-elasticsearch.service
|
||||
After=Mistborn-elasticsearch.service
|
||||
PartOf=Mistborn-base.service
|
||||
|
||||
[Service]
|
||||
Restart=always
|
||||
RestartSec=15
|
||||
TimeoutStartSec=600
|
||||
User=root
|
||||
Group=docker
|
||||
PermissionsStartOnly=true
|
||||
# Shutdown container (if running) when unit is stopped
|
||||
ExecStartPre=/opt/mistborn/scripts/wrappers/mistborn_docker.sh wazuh docker-compose -f /opt/mistborn/extra/wazuh.yml down
|
||||
# Start container when unit is started
|
||||
ExecStart=/opt/mistborn/scripts/wrappers/mistborn_docker.sh wazuh docker-compose -f /opt/mistborn/extra/wazuh.yml up --build
|
||||
# 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]
|
||||
WantedBy=Mistborn-base.service
|
||||
@@ -0,0 +1,17 @@
|
||||
---
|
||||
# This is the internal user database
|
||||
# The hash value is a bcrypt hash and can be generated with plugin/tools/hash.sh
|
||||
|
||||
_meta:
|
||||
type: "internalusers"
|
||||
config_version: 2
|
||||
|
||||
# Define your internal users here
|
||||
|
||||
mistborn:
|
||||
hash: "__MISTBORN_HASH__"
|
||||
reserved: true
|
||||
backend_roles:
|
||||
- "admin"
|
||||
description: "Mistborn user"
|
||||
|
||||
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
if [[ -f "/opt/mistborn_volumes/extra/elasticsearch/init/internal_users.yml" ]]; then
|
||||
echo "internal_users.yml exists. Proceeding."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
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')
|
||||
|
||||
sed -i "s|__MISTBORN_HASH__|${ELASTICSEARCH_MISTBORN_HASHED}|" /opt/mistborn_volumes/extra/elasticsearch/init/internal_users.yml
|
||||
@@ -1,21 +0,0 @@
|
||||
[Unit]
|
||||
Description=Mistborn RaspAP Service
|
||||
Requires=Mistborn-base.service
|
||||
After=Mistborn-base.service
|
||||
|
||||
[Service]
|
||||
Restart=always
|
||||
User=root
|
||||
Group=docker
|
||||
PermissionsStartOnly=true
|
||||
# Shutdown container (if running) when unit is stopped
|
||||
ExecStartPre=/usr/local/bin/docker-compose -f /opt/mistborn/extra/raspap.yml down
|
||||
|
||||
# Start container when unit is started
|
||||
ExecStart=/usr/local/bin/docker-compose -f /opt/mistborn/extra/raspap.yml up --build
|
||||
# Stop container when unit is stopped
|
||||
ExecStop=/usr/local/bin/docker-compose -f /opt/mistborn/extra/raspap.yml down
|
||||
# Post stop
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# install on gateway
|
||||
sudo apt-get install -y hostapd vnstat
|
||||
Executable
+30
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
# detect if already installed
|
||||
if dpkg -s wazuh-agent &> /dev/null; then
|
||||
echo "Wazuh agent already installed"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# install curl
|
||||
echo "install curl"
|
||||
sudo -E apt-get install -y curl
|
||||
|
||||
# prepare repo
|
||||
echo "Adding Wazuh Repository"
|
||||
curl -s https://packages.wazuh.com/key/GPG-KEY-WAZUH | sudo -E apt-key add -
|
||||
echo "deb https://packages.wazuh.com/4.x/apt/ stable main" | sudo -E tee /etc/apt/sources.list.d/wazuh.list
|
||||
|
||||
apt-get update
|
||||
|
||||
# wait for service to be listening
|
||||
while ! nc -z 10.2.3.1 55000; do
|
||||
WAIT_TIME=10
|
||||
echo "Waiting ${WAIT_TIME} seconds for Wazuh API..."
|
||||
sleep ${WAIT_TIME}
|
||||
done
|
||||
|
||||
# install
|
||||
echo "Installing Wazuh agent"
|
||||
WAZUH_MANAGER="10.2.3.1" apt-get install wazuh-agent
|
||||
|
||||
Executable
+4
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
systemctl start wazuh-agent
|
||||
systemctl enable wazuh-agent
|
||||
Executable
+4
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
systemctl stop wazuh-agent
|
||||
systemctl disable wazuh-agent
|
||||
+129
@@ -0,0 +1,129 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# detect if suricata is installed
|
||||
if [[ $(dpkg-query -W -f='${Status}' suricata 2>/dev/null | grep -c "ok installed") -eq 1 ]]; then
|
||||
echo "Suricata Installed"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
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 jq wget
|
||||
|
||||
## recommended dependencies
|
||||
#sudo -E apt-get -y install libpcre3 libpcre3-dbg libpcre3-dev build-essential libpcap-dev \
|
||||
# libnet1-dev libyaml-0-2 libyaml-dev pkg-config zlib1g zlib1g-dev \
|
||||
# libcap-ng-dev libcap-ng0 make libmagic-dev \
|
||||
# libgeoip-dev liblua5.1-dev libhiredis-dev libevent-dev \
|
||||
# python-yaml rustc cargo
|
||||
|
||||
# iptables/nftables integration
|
||||
sudo -E apt-get -y install libnetfilter-queue-dev libnetfilter-queue1 \
|
||||
libnetfilter-log-dev libnetfilter-log1 \
|
||||
libnfnetlink-dev libnfnetlink0
|
||||
|
||||
|
||||
if [ "$DISTRO" == "ubuntu" ]; then
|
||||
echo "Installing Suricata Ubuntu PPA"
|
||||
sudo -E add-apt-repository -y ppa:oisf/suricata-stable
|
||||
sudo -E apt-get update
|
||||
sudo -E apt-get install -y suricata
|
||||
elif [ "$DISTRO" == "debian" ]; then
|
||||
# retrieve version codename
|
||||
source /etc/os-release
|
||||
echo "deb http://http.debian.net/debian $VERSION_CODENAME-backports main" | \
|
||||
sudo -E tee /etc/apt/sources.list.d/backports.list
|
||||
sudo -E apt-get update
|
||||
sudo -E apt-get install -y suricata -t ${VERSION_CODENAME}-backports
|
||||
else
|
||||
echo "Basic Suricata installation"
|
||||
sudo -E apt-get install -y suricata
|
||||
fi
|
||||
|
||||
# # iptables
|
||||
# sudo iptables -A INPUT -j NFQUEUE
|
||||
# sudo iptables -I FORWARD -j NFQUEUE
|
||||
# sudo iptables -I OUTPUT -j NFQUEUE
|
||||
|
||||
# # rsyslog to create /var/log/suricata.log
|
||||
# sudo cp ./scripts/conf/20-suricata.conf /etc/rsyslog.d/
|
||||
# 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
|
||||
|
||||
# wait for service to be listening
|
||||
while ! nc -z 10.2.3.1 55000; do
|
||||
WAIT_TIME=10
|
||||
echo "Waiting ${WAIT_TIME} seconds for Wazuh API..."
|
||||
sleep ${WAIT_TIME}
|
||||
done
|
||||
|
||||
# set working directory to mistborn for docker-compose
|
||||
pushd .
|
||||
cd /opt/mistborn
|
||||
|
||||
# ensure group exists
|
||||
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 --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 --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>
|
||||
<location>/var/log/suricata/eve.json</location>
|
||||
</localfile>
|
||||
</agent_config>
|
||||
EOF
|
||||
"
|
||||
|
||||
# restart manager
|
||||
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
|
||||
|
||||
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
|
||||
+7
@@ -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 &
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
systemctl stop suricata
|
||||
systemctl disable suricata
|
||||
|
||||
#kill $(pgrep -f suri_reloader) 2>/dev/null
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
sudo apt-get update
|
||||
|
||||
UPDATES=$(sudo apt-get dist-upgrade -s --quiet=2 | grep ^Inst | wc -l)
|
||||
|
||||
if [[ "$UPDATES" -ne "0" ]]; then
|
||||
echo "Please run updates and reboot before installing Mistborn: sudo apt-get update && sudo apt-get -y dist-upgrade"
|
||||
exit 1;
|
||||
fi
|
||||
@@ -18,3 +18,6 @@ fi
|
||||
if [ ! -f /usr/local/bin/docker-compose ]; then
|
||||
sudo -E ln -s $(which docker-compose) /usr/local/bin/docker-compose
|
||||
fi
|
||||
|
||||
# daemon.json
|
||||
#source ./scripts/subinstallers/docker_daemon.sh
|
||||
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# daemon.json
|
||||
if [ ! -f /etc/docker/daemon.json ]; then
|
||||
sudo -E cp ./scripts/conf/docker-daemon.json /etc/docker/daemon.json
|
||||
sudo -E systemctl restart docker
|
||||
fi
|
||||
@@ -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
|
||||
|
||||
Executable
+44
@@ -0,0 +1,44 @@
|
||||
#!/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
|
||||
@@ -4,3 +4,4 @@
|
||||
BITWARDEN_PROD_FILE="$1"
|
||||
echo "WEBSOCKET_ENABLED=true" > $BITWARDEN_PROD_FILE
|
||||
echo "SIGNUPS_ALLOWED=true" >> $BITWARDEN_PROD_FILE
|
||||
chmod 600 $BITWARDEN_PROD_FILE
|
||||
Executable
+6
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Elasticsearch
|
||||
ELASTICSEARCH_PROD_FILE="$1"
|
||||
echo "MISTBORN_DEFAULT_PASSWORD=$MISTBORN_DEFAULT_PASSWORD" >> $ELASTICSEARCH_PROD_FILE
|
||||
chmod 600 $ELASTICSEARCH_PROD_FILE
|
||||
@@ -10,4 +10,5 @@ echo "POSTGRES_DB=guacamole_db" >> $GUAC_PROD_FILE
|
||||
echo "POSTGRES_DATABASE=guacamole_db" >> $GUAC_PROD_FILE
|
||||
echo "POSTGRES_USER=guac_user" >> $GUAC_PROD_FILE
|
||||
echo "POSTGRES_PASSWORD=$GUAC_PASSWORD" >> $GUAC_PROD_FILE
|
||||
echo "MISTBORN_DEFAULT_PASSWORD=\"$MISTBORN_DEFAULT_PASSWORD\"" >> $GUAC_PROD_FILE
|
||||
echo "MISTBORN_DEFAULT_PASSWORD=$MISTBORN_DEFAULT_PASSWORD" >> $GUAC_PROD_FILE
|
||||
chmod 600 $GUAC_PROD_FILE
|
||||
@@ -10,3 +10,4 @@ sed -i "s/JVB_AUTH_PASSWORD.*/JVB_AUTH_PASSWORD=$(python3 -c "import secrets; im
|
||||
sed -i "s/JIGASI_XMPP_PASSWORD.*/JIGASI_XMPP_PASSWORD=$(python3 -c "import secrets; import string; print(f''.join([secrets.choice(string.ascii_letters+string.digits) for x in range(32)]))")/" "$JITSI_PROD_FILE"
|
||||
sed -i "s/JIBRI_RECORDER_PASSWORD.*/JIBRI_RECORDER_PASSWORD=$(python3 -c "import secrets; import string; print(f''.join([secrets.choice(string.ascii_letters+string.digits) for x in range(32)]))")/" "$JITSI_PROD_FILE"
|
||||
sed -i "s/JIBRI_XMPP_PASSWORD.*/JIBRI_XMPP_PASSWORD=$(python3 -c "import secrets; import string; print(f''.join([secrets.choice(string.ascii_letters+string.digits) for x in range(32)]))")/" "$JITSI_PROD_FILE"
|
||||
chmod 600 $JITSI_PROD_FILE
|
||||
@@ -5,5 +5,6 @@ NEXTCLOUD_PROD_FILE="$1"
|
||||
#NEXTCLOUD_PASSWORD=$(python3 -c "import secrets; import string; print(f''.join([secrets.choice(string.ascii_letters+string.digits) for x in range(32)]))")
|
||||
NEXTCLOUD_PASSWORD="${MISTBORN_DEFAULT_PASSWORD}"
|
||||
echo "NEXTCLOUD_ADMIN_USER=mistborn" > $NEXTCLOUD_PROD_FILE
|
||||
echo "NEXTCLOUD_ADMIN_PASSWORD=\"$NEXTCLOUD_PASSWORD\"" >> $NEXTCLOUD_PROD_FILE
|
||||
echo "NEXTCLOUD_ADMIN_PASSWORD=$NEXTCLOUD_PASSWORD" >> $NEXTCLOUD_PROD_FILE
|
||||
echo "NEXTCLOUD_TRUSTED_DOMAINS=nextcloud.mistborn" >> $NEXTCLOUD_PROD_FILE
|
||||
chmod 600 $NEXTCLOUD_PROD_FILE
|
||||
@@ -4,4 +4,5 @@
|
||||
ONLYOFFICE_PROD_FILE="$1"
|
||||
JWT_SECRET="${MISTBORN_DEFAULT_PASSWORD}"
|
||||
echo "JWT_ENABLED=true" > $ONLYOFFICE_PROD_FILE
|
||||
echo "JWT_SECRET=\"$JWT_SECRET\"" >> $ONLYOFFICE_PROD_FILE
|
||||
echo "JWT_SECRET=$JWT_SECRET" >> $ONLYOFFICE_PROD_FILE
|
||||
chmod 600 $ONLYOFFICE_PROD_FILE
|
||||
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# RaspAP
|
||||
RASPAP_PROD_FILE="$1"
|
||||
echo "MISTBORN_DEFAULT_PASSWORD=$MISTBORN_DEFAULT_PASSWORD" > $RASPAP_PROD_FILE
|
||||
chmod 600 $RASPAP_PROD_FILE
|
||||
@@ -7,7 +7,9 @@ ROCKETCHAT_PASSWORD="${MISTBORN_DEFAULT_PASSWORD}"
|
||||
echo "ROCKETCHAT_USER=bot" > $ROCKETCHAT_PROD_FILE
|
||||
echo "ROCKETCHAT_ROOM=GENERAL" >> $ROCKETCHAT_PROD_FILE
|
||||
echo "BOT_NAME=bot" >> $ROCKETCHAT_PROD_FILE
|
||||
echo "ROCKETCHAT_PASSWORD=\"$ROCKETCHAT_PASSWORD\"" >> $ROCKETCHAT_PROD_FILE
|
||||
echo "ROCKETCHAT_PASSWORD=$ROCKETCHAT_PASSWORD" >> $ROCKETCHAT_PROD_FILE
|
||||
|
||||
# docker environment
|
||||
echo "MISTBORN_BIND_IP=${MISTBORN_BIND_IP}" >> $ROCKETCHAT_PROD_FILE
|
||||
|
||||
chmod 600 $ROCKETCHAT_PROD_FILE
|
||||
Executable
+92
@@ -0,0 +1,92 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Wazuh
|
||||
WAZUH_PROD_FILE="$1"
|
||||
echo "ELASTIC_USERNAME=mistborn" > $WAZUH_PROD_FILE
|
||||
echo "ELASTIC_PASSWORD=$MISTBORN_DEFAULT_PASSWORD" >> $WAZUH_PROD_FILE
|
||||
|
||||
echo "ELASTICSEARCH_USERNAME=mistborn" >> $WAZUH_PROD_FILE
|
||||
echo "ELASTICSEARCH_PASSWORD=$MISTBORN_DEFAULT_PASSWORD" >> $WAZUH_PROD_FILE
|
||||
|
||||
# kibana odfe
|
||||
# kibana-odfe/config/wazuh_app_config.sh
|
||||
# https://wazuh
|
||||
echo "WAZUH_API_URL=https://10.2.3.1" >> $WAZUH_PROD_FILE
|
||||
echo "API_PORT=55000" >> $WAZUH_PROD_FILE
|
||||
echo "API_USERNAME=wazuh-wui" >> $WAZUH_PROD_FILE
|
||||
|
||||
#API_PASSWORD=$(python3 -c "import secrets; import string; print(f''.join([secrets.choice(string.ascii_letters+string.digits) for x in range(32)]))")
|
||||
|
||||
API_PASSWORD_PYTHON=$(cat << EOF
|
||||
|
||||
import secrets
|
||||
import random
|
||||
import string
|
||||
|
||||
random_pass = ([secrets.choice("@$!*?-"),
|
||||
secrets.choice(string.digits),
|
||||
secrets.choice(string.ascii_lowercase),
|
||||
secrets.choice(string.ascii_uppercase),
|
||||
]
|
||||
+ [secrets.choice(string.ascii_lowercase
|
||||
+ string.ascii_uppercase
|
||||
+ "@$!*?-"
|
||||
+ string.digits) for i in range(12)])
|
||||
|
||||
random.shuffle(random_pass)
|
||||
random_pass = ''.join(random_pass)
|
||||
print(random_pass)
|
||||
|
||||
EOF
|
||||
)
|
||||
|
||||
API_PASSWORD=$(python3 -c "${API_PASSWORD_PYTHON}")
|
||||
|
||||
echo "API_PASSWORD=${API_PASSWORD}" >> $WAZUH_PROD_FILE
|
||||
|
||||
# kibana-odfe/config/entrypoint.sh:
|
||||
# https://elasticsearch:9200
|
||||
echo "ELASTICSEARCH_URL=https://10.2.3.1:9200" >> $WAZUH_PROD_FILE
|
||||
|
||||
|
||||
cat >> ${WAZUH_PROD_FILE}<< EOF
|
||||
|
||||
PATTERN="wazuh-alerts-*"
|
||||
|
||||
CHECKS_PATTERN=true
|
||||
CHECKS_TEMPLATE=true
|
||||
CHECKS_API=true
|
||||
CHECKS_SETUP=true
|
||||
|
||||
EXTENSIONS_PCI=true
|
||||
EXTENSIONS_GDPR=true
|
||||
EXTENSIONS_HIPAA=true
|
||||
EXTENSIONS_NIST=true
|
||||
EXTENSIONS_TSC=true
|
||||
EXTENSIONS_AUDIT=true
|
||||
EXTENSIONS_OSCAP=false
|
||||
EXTENSIONS_CISCAT=false
|
||||
EXTENSIONS_AWS=false
|
||||
EXTENSIONS_GCP=false
|
||||
EXTENSIONS_VIRUSTOTAL=true
|
||||
EXTENSIONS_OSQUERY=true
|
||||
EXTENSIONS_DOCKER=true
|
||||
|
||||
APP_TIMEOUT=20000
|
||||
|
||||
API_SELECTOR=true
|
||||
IP_SELECTOR=true
|
||||
IP_IGNORE="[]"
|
||||
|
||||
WAZUH_MONITORING_ENABLED=true
|
||||
WAZUH_MONITORING_FREQUENCY=900
|
||||
WAZUH_MONITORING_SHARDS=2
|
||||
WAZUH_MONITORING_REPLICAS=0
|
||||
|
||||
ADMIN_PRIVILEGES=true
|
||||
|
||||
EOF
|
||||
|
||||
echo "MISTBORN_DEFAULT_PASSWORD=$MISTBORN_DEFAULT_PASSWORD" >> $WAZUH_PROD_FILE
|
||||
|
||||
chmod 600 $WAZUH_PROD_FILE
|
||||
@@ -15,8 +15,8 @@ echo "DJANGO_ADMIN_URL=admin/" >> $DJANGO_PROD_FILE
|
||||
echo "USE_DOCKER=yes" >> $DJANGO_PROD_FILE
|
||||
echo "REDIS_URL=redis://redis:6379/0" >> $DJANGO_PROD_FILE
|
||||
echo "CELERY_FLOWER_USER=prod" >> $DJANGO_PROD_FILE
|
||||
echo "CELERY_FLOWER_PASSWORD=\"$MISTBORN_DEFAULT_PASSWORD\"" >> $DJANGO_PROD_FILE
|
||||
echo "MISTBORN_DEFAULT_PASSWORD=\"$MISTBORN_DEFAULT_PASSWORD\"" >> $DJANGO_PROD_FILE
|
||||
echo "CELERY_FLOWER_PASSWORD=$MISTBORN_DEFAULT_PASSWORD" >> $DJANGO_PROD_FILE
|
||||
echo "MISTBORN_DEFAULT_PASSWORD=$MISTBORN_DEFAULT_PASSWORD" >> $DJANGO_PROD_FILE
|
||||
echo "#MAILGUN_API_KEY=" >> $DJANGO_PROD_FILE
|
||||
echo "#MAILGUN_API_URL=" >> $DJANGO_PROD_FILE
|
||||
echo "#SENTRY_DNS=" >> $DJANGO_PROD_FILE
|
||||
@@ -41,5 +41,5 @@ PIHOLE_PROD_FILE="./.envs/.production/.pihole"
|
||||
#WEBPASSWORD=$(python3 -c "import secrets; import string; print(f''.join([secrets.choice(string.ascii_letters+string.digits) for x in range(32)]))")
|
||||
WEBPASSWORD="$1"
|
||||
echo "TZ=\"America/New York\"" > $PIHOLE_PROD_FILE
|
||||
echo "WEBPASSWORD=\"$WEBPASSWORD\"" >> $PIHOLE_PROD_FILE
|
||||
echo "WEBPASSWORD=$WEBPASSWORD" >> $PIHOLE_PROD_FILE
|
||||
chmod 600 $PIHOLE_PROD_FILE
|
||||
|
||||
@@ -6,7 +6,7 @@ figlet "Mistborn: Configuring Firewall"
|
||||
|
||||
echo "stop iptables wrappers"
|
||||
if [ "$DISTRO" == "ubuntu" ]; then
|
||||
# Disable UFW
|
||||
echo "Disabling UFW"
|
||||
sudo systemctl stop ufw || true
|
||||
sudo systemctl disable ufw || true
|
||||
fi
|
||||
|
||||
Executable
+22
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
# INPUT default admin password
|
||||
while [ -z "${MISTBORN_DEFAULT_PASSWORD}" ]; do
|
||||
echo
|
||||
echo "(Mistborn) The default admin password may only container alphanumeric characters and _"
|
||||
read -p "(Mistborn) Set default admin password: " -s MISTBORN_DEFAULT_PASSWORD
|
||||
echo
|
||||
|
||||
if [[ ${MISTBORN_DEFAULT_PASSWORD} =~ ^[A-Za-z0-9_]+$ ]]; then
|
||||
# it matches
|
||||
echo "(Mistborn) Password is accepted"
|
||||
else
|
||||
unset MISTBORN_DEFAULT_PASSWORD
|
||||
echo "(Mistborn) Try again"
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
echo
|
||||
echo "MISTBORN_DEFAULT_PASSWORD is set"
|
||||
echo
|
||||
@@ -18,6 +18,13 @@ sudo mistborn-cli pullbuild
|
||||
sudo docker container prune -f
|
||||
sudo docker image prune -f
|
||||
|
||||
|
||||
# RESTART
|
||||
|
||||
sudo systemctl stop Mistborn-base
|
||||
|
||||
# docker daemon
|
||||
#source ./scripts/subinstallers/docker_daemon.sh
|
||||
|
||||
sudo systemctl restart Mistborn-setup
|
||||
sudo systemctl restart Mistborn-base
|
||||
|
||||
@@ -2,12 +2,16 @@
|
||||
|
||||
set -e
|
||||
|
||||
SERVICE="$1"
|
||||
MISTBORN_HOME="/opt/mistborn"
|
||||
|
||||
SERVICES="$1"
|
||||
shift
|
||||
|
||||
export MISTBORN_HOME="/opt/mistborn"
|
||||
export MISTBORN_SERVICE_FILE=${MISTBORN_HOME}/.envs/.production/.${SERVICE}
|
||||
export MISTBORN_SERVICE_INIT=${MISTBORN_HOME}/scripts/services/${SERVICE}/init.sh
|
||||
IFS=','
|
||||
read -ra SERVICES_ARRAY <<< "${SERVICES}"
|
||||
for SERVICE in "${SERVICES_ARRAY[@]}"; do
|
||||
MISTBORN_SERVICE_FILE=${MISTBORN_HOME}/.envs/.production/.${SERVICE}
|
||||
MISTBORN_SERVICE_INIT=${MISTBORN_HOME}/scripts/services/${SERVICE}/init.sh
|
||||
|
||||
# check and create file if needed
|
||||
${MISTBORN_HOME}/scripts/env/check_env_file.sh ${SERVICE}
|
||||
@@ -31,5 +35,23 @@ if [[ -f "${MISTBORN_SERVICE_INIT}" ]]; then
|
||||
else
|
||||
echo "No init script. Proceeding."
|
||||
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..."
|
||||
|
||||
while ! nc -z 10.2.3.1 5000; do
|
||||
WAIT_TIME=$((5 + $RANDOM % 15))
|
||||
echo "Waiting ${WAIT_TIME} seconds for Mistborn-base..."
|
||||
sleep ${WAIT_TIME}
|
||||
done
|
||||
|
||||
echo "Mistborn-base is running"
|
||||
|
||||
exec "$@"
|
||||
Reference in New Issue
Block a user