1 Commits
Author SHA1 Message Date
Steven Foerster 7800935cf7 regen script 2021-03-06 09:30:18 -05:00
56 changed files with 137 additions and 769 deletions
+4 -31
View File
@@ -15,8 +15,6 @@ 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. 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: Ideal for teams who:
- hate internet ads - hate internet ads
- need to be protected from malicious internet domains - need to be protected from malicious internet domains
@@ -42,10 +40,6 @@ 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 - [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 - [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: 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 - [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. - [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.
@@ -57,7 +51,6 @@ 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. - [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 - [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. - [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 # Quickstart
Tested Operating Systems (in order of thoroughness): Tested Operating Systems (in order of thoroughness):
@@ -88,7 +81,6 @@ Recommended System Specifications:
| Default | Bare bones + Cockpit | 2 GB+ | 15 GB | | Default | Bare bones + Cockpit | 2 GB+ | 15 GB |
| Low-resource services | Default + Bitwarden, Tor, Syncthing | 4 GB | 20 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+ | | 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 Starting from base installation
``` ```
@@ -104,7 +96,7 @@ 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](#installation) section below. For more information, see the `Installation` section below.
# Network Diagram # Network Diagram
![Mistborn Network Diagram](https://gitlab.com/cyber5k/public/-/raw/master/graphics/mistborn_network.png) ![Mistborn Network Diagram](https://gitlab.com/cyber5k/public/-/raw/master/graphics/mistborn_network.png)
@@ -116,20 +108,6 @@ 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. 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)
![Mistborn Security Center](https://gitlab.com/cyber5k/public/-/raw/master/graphics/home.mistborn_soc.png)
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.
![Mistborn Security Center: Wazuh Modules](https://gitlab.com/cyber5k/public/-/raw/master/graphics/wazuh_modules.png)
The Wazuh Kibana plugin leverages the power of Elasticsearch:
![Mistborn Security Center: Wazuh Dashboard](https://gitlab.com/cyber5k/public/-/raw/master/graphics/wazuh_se_dashboard.png)
# Coppercloud # 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. 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.
@@ -310,8 +288,6 @@ Mistborn uses the following domains (that can be reached by all Wireguard client
| OnlyOffice | onlyoffice.mistborn | Off | | OnlyOffice | onlyoffice.mistborn | Off |
| Jitsi | jitsi.mistborn | Off | | Jitsi | jitsi.mistborn | Off |
| Guacamole | guac.mistborn | Off | | Guacamole | guac.mistborn | Off |
| RaspAP | raspap.mistborn | Off |
| Wazuh | wazuh.mistborn | Off |
# Default Credentials # Default Credentials
These are the default credentials to use in the services you choose to use: These are the default credentials to use in the services you choose to use:
@@ -320,10 +296,8 @@ These are the default credentials to use in the services you choose to use:
| ------- | -------- | -------- | | ------- | -------- | -------- |
| Pihole | | {{default mistborn password}} | | Pihole | | {{default mistborn password}} |
| Cockpit | cockpit | {{default mistborn password}} | | Cockpit | cockpit | {{default mistborn password}} |
| Wazuh | mistborn | {{default mistborn password}} |
| Nextcloud | mistborn | {{default mistborn password}} | | Nextcloud | mistborn | {{default mistborn password}} |
| Guacamole | 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/` You can find the credentials sent to the Docker containers in: `/opt/mistborn/.envs/.production/`
@@ -487,8 +461,6 @@ sudo journalctl -xfu Mistborn-guacamole
sudo journalctl -xfu Mistborn-rocketchat sudo journalctl -xfu Mistborn-rocketchat
sudo journalctl -xfu Mistborn-onlyoffice sudo journalctl -xfu Mistborn-onlyoffice
sudo journalctl -xfu Mistborn-tor sudo journalctl -xfu Mistborn-tor
sudo journalctl -xfu Mistborn-raspap
sudo journalctl -xfu Mistborn-wazuh
``` ```
## Troubleshooting Docker ## Troubleshooting Docker
@@ -554,13 +526,14 @@ Many features and refinements are in the works at various stages including:
- Plugins for Extra Services (enabling third-party development) - Plugins for Extra Services (enabling third-party development)
- Plugin repository - Plugin repository
- IPv6 support - 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 - Anomaly detection in network traffic
# Featured In # 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) - [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 - [Awesome Open Source](https://www.youtube.com/watch?v=hekP0_crotw) July 2020 (featuring Mistborn version from early July 2020)
- [DB Tech](https://www.youtube.com/watch?v=UE_OuAOgoZI) May 2021
# Follow # 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) 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)
+7 -17
View File
@@ -53,13 +53,6 @@ services:
#image: mistborn_production_traefik #image: mistborn_production_traefik
image: traefik:v2.2 image: traefik:v2.2
container_name: mistborn_production_traefik 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: depends_on:
- django - django
volumes: volumes:
@@ -74,11 +67,11 @@ services:
# #- "0.0.0.0:8080:8080/tcp" # dashboard # #- "0.0.0.0:8080:8080/tcp" # dashboard
command: command:
## API settings ## API settings
- --api.insecure=true #- --api.insecure=true
- --api.dashboard=true #- --api.dashboard=true
- --api.debug=true #- --api.debug=true
## Logs ## Logs
- --log.level=INFO - --log.level=ERROR
## Providers ## Providers
- --providers.docker=true - --providers.docker=true
- --providers.docker.exposedbydefault=false - --providers.docker.exposedbydefault=false
@@ -165,7 +158,7 @@ services:
pihole: pihole:
container_name: mistborn_production_pihole container_name: mistborn_production_pihole
image: pihole/pihole:v5.7 image: pihole/pihole:latest
env_file: env_file:
- ./.envs/.production/.pihole - ./.envs/.production/.pihole
ports: ports:
@@ -175,16 +168,13 @@ services:
- "traefik.enable=true" - "traefik.enable=true"
- "traefik.http.routers.pihole-http.rule=Host(`pihole.mistborn`)" - "traefik.http.routers.pihole-http.rule=Host(`pihole.mistborn`)"
- "traefik.http.routers.pihole-http.entrypoints=web" - "traefik.http.routers.pihole-http.entrypoints=web"
- "traefik.http.routers.pihole-http.middlewares=mistborn_auth,add-pihole-admin" - "traefik.http.routers.pihole-http.middlewares=mistborn_auth@file,add-pihole-admin"
- "traefik.http.routers.pihole-https.rule=Host(`pihole.mistborn`)" - "traefik.http.routers.pihole-https.rule=Host(`pihole.mistborn`)"
- "traefik.http.routers.pihole-https.entrypoints=websecure" - "traefik.http.routers.pihole-https.entrypoints=websecure"
- "traefik.http.routers.pihole-https.middlewares=mistborn_auth,add-pihole-admin" - "traefik.http.routers.pihole-https.middlewares=mistborn_auth@file,add-pihole-admin"
- "traefik.http.routers.pihole-https.tls.certresolver=basic" - "traefik.http.routers.pihole-https.tls.certresolver=basic"
- "traefik.http.middlewares.add-pihole-admin.addPrefix.prefix=/admin" - "traefik.http.middlewares.add-pihole-admin.addPrefix.prefix=/admin"
- "traefik.http.services.pihole-service.loadbalancer.server.port=80" - "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: environment:
- ServerIP=10.2.0.3 - 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 - DNS1='10.2.0.2#5054' # docs say port 5054, was 54; use network_mode: host to see which port is used
+8 -2
View File
@@ -11,15 +11,21 @@
[http.services] [http.services]
[http.services.cockpit.loadBalancer] [http.services.cockpit.loadBalancer]
[[http.services.cockpit.loadBalancer.servers]] [[http.services.cockpit.loadBalancer.servers]]
url = "http://127.0.0.1:9090" url = "http://10.2.3.1:9090"
[http.routers] [http.routers]
[http.routers.cockpit] [http.routers.cockpit]
rule = "Host(`cockpit.mistborn`)" rule = "Host(`cockpit.mistborn`)"
service = "cockpit" service = "cockpit"
entrypoints = ["web", "websecure"] entrypoints = ["web", "websecure"]
middlewares = ["mistborn_auth@docker"] middlewares = ["mistborn_auth"]
[http.middlewares] [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] [http.middlewares.mistborn_headers.headers]
hostsProxyHeaders = ['X-CSRFToken'] hostsProxyHeaders = ['X-CSRFToken']
+1 -1
View File
@@ -19,7 +19,7 @@ services:
- "traefik.http.routers.bitwarden-https.tls.certresolver=basic" - "traefik.http.routers.bitwarden-https.tls.certresolver=basic"
- "traefik.http.services.bitwarden-service.loadbalancer.server.port=80" - "traefik.http.services.bitwarden-service.loadbalancer.server.port=80"
ports: ports:
- "${MISTBORN_BIND_IP}:3012:3012/tcp" - 3012:3012/tcp
restart: unless-stopped restart: unless-stopped
networks: networks:
-30
View File
@@ -1,30 +0,0 @@
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
+2 -2
View File
@@ -216,8 +216,8 @@ services:
image: jitsi/jvb:latest image: jitsi/jvb:latest
restart: unless-stopped restart: unless-stopped
ports: ports:
- "${MISTBORN_BIND_IP}:${JVB_PORT}:${JVB_PORT}/udp" - '${JVB_PORT}:${JVB_PORT}/udp'
- "${MISTBORN_BIND_IP}:${JVB_TCP_PORT}:${JVB_TCP_PORT}" - '${JVB_TCP_PORT}:${JVB_TCP_PORT}'
volumes: volumes:
- ${CONFIG}/jvb:/config:Z - ${CONFIG}/jvb:/config:Z
env_file: env_file:
+8 -11
View File
@@ -2,9 +2,12 @@ version: '3'
services: services:
raspap: raspap:
image: "cyber5k/raspap:${MISTBORN_TAG}" build:
context: ..
dockerfile: ./compose/production/raspap/Dockerfile
#user: root
image: mistborn_production_raspap
container_name: mistborn_production_raspap container_name: mistborn_production_raspap
#network_mode: host
labels: labels:
- "traefik.enable=true" - "traefik.enable=true"
- "traefik.http.routers.raspap-http.rule=Host(`raspap.mistborn`)" - "traefik.http.routers.raspap-http.rule=Host(`raspap.mistborn`)"
@@ -16,16 +19,10 @@ services:
- "traefik.http.routers.raspap-https.tls.certresolver=basic" - "traefik.http.routers.raspap-https.tls.certresolver=basic"
- "traefik.http.services.raspap-service.loadbalancer.server.port=80" - "traefik.http.services.raspap-service.loadbalancer.server.port=80"
env_file: env_file:
- ../.envs/.production/.raspap - ../.envs/.production/.pihole
cap_add: command: /start
#- NET_ADMIN
- SYS_ADMIN
#- CAP_FOWNER
privileged: true
volumes: volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro - ../../mistborn_volumes/extra/raspap/etc-raspap:/etc/raspap
#command: /start
restart: unless-stopped
networks: networks:
default: default:
+2 -2
View File
@@ -15,8 +15,8 @@ services:
- ../../mistborn_volumes/extra/syncthing/data2:/data2 - ../../mistborn_volumes/extra/syncthing/data2:/data2
ports: ports:
#- 8384:8384 #- 8384:8384
- "${MISTBORN_BIND_IP}:22000:22000/tcp" # listening port - 22000:22000/tcp # listening port
- "${MISTBORN_BIND_IP}:21027:21027/udp" # protocol discovery - 21027:21027/udp # protocol discovery
labels: labels:
- "traefik.enable=true" - "traefik.enable=true"
- "traefik.http.routers.syncthing-http.rule=Host(`syncthing.mistborn`)" - "traefik.http.routers.syncthing-http.rule=Host(`syncthing.mistborn`)"
+1 -1
View File
@@ -8,7 +8,7 @@ services:
image: mistborn_production_tor image: mistborn_production_tor
container_name: mistborn_production_tor container_name: mistborn_production_tor
ports: ports:
- "${MISTBORN_BIND_IP}:9150:9150/tcp" - 9150:9150/tcp
networks: networks:
default: default:
-70
View File
@@ -1,70 +0,0 @@
# 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
-3
View File
@@ -1,3 +0,0 @@
{
"shutdown-timeout": 60
}
+15
View File
@@ -0,0 +1,15 @@
#!/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
+19 -17
View File
@@ -59,22 +59,13 @@ echo -e "| | | | \__ \ |_| |_) | (_) | | | | | |"
echo -e "|_| |_|_|___/\__|_.__/ \___/|_| |_| |_|" echo -e "|_| |_|_|___/\__|_.__/ \___/|_| |_| |_|"
echo -e "" echo -e ""
sudo rm -rf /opt/mistborn 2>/dev/null || true # INPUT default admin password
if [ -z "${MISTBORN_DEFAULT_PASSWORD}" ]; then
# clone to /opt and change directory read -p "(Mistborn) Set default admin password: " -s MISTBORN_DEFAULT_PASSWORD
echo "Cloning $GIT_BRANCH branch from mistborn repo" echo
sudo git clone https://gitlab.com/cyber5k/mistborn.git -b $GIT_BRANCH /opt/mistborn else
sudo chown -R $USER:$USER /opt/mistborn echo "MISTBORN_DEFAULT_PASSWORD is already set"
pushd . fi
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? # Install Cockpit?
if [ -z "${MISTBORN_INSTALL_COCKPIT}" ]; then if [ -z "${MISTBORN_INSTALL_COCKPIT}" ]; then
@@ -94,7 +85,18 @@ else
echo "SSH key exists for $USER" echo "SSH key exists for $USER"
fi fi
# initial load update package list during check_updates.sh 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
# install figlet # install figlet
sudo -E apt-get install -y figlet sudo -E apt-get install -y figlet
-6
View File
@@ -7,17 +7,11 @@ After=netfilter-persistent.service
[Service] [Service]
Restart=always Restart=always
RestartSec=15
User=root User=root
Group=docker Group=docker
PermissionsStartOnly=true PermissionsStartOnly=true
# Shutdown container (if running) when unit is stopped # Shutdown container (if running) when unit is stopped
EnvironmentFile=/opt/mistborn/.env 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 down
ExecStartPre=/usr/local/bin/docker-compose -f /opt/mistborn/base.yml build ExecStartPre=/usr/local/bin/docker-compose -f /opt/mistborn/base.yml build
+1 -2
View File
@@ -6,7 +6,6 @@ PartOf=Mistborn-base.service
[Service] [Service]
Restart=always Restart=always
RestartSec=15
User=root User=root
Group=docker Group=docker
PermissionsStartOnly=true PermissionsStartOnly=true
@@ -22,4 +21,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 ExecStopPost=-/sbin/iptables -D DOCKER-USER -i DIFACE -p tcp --dport 3012 -j MISTBORN_LOG_DROP
[Install] [Install]
WantedBy=Mistborn-base.service WantedBy=multi-user.target
@@ -1,22 +0,0 @@
[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
+1 -2
View File
@@ -6,7 +6,6 @@ PartOf=Mistborn-base.service
[Service] [Service]
Restart=always Restart=always
RestartSec=15
User=root User=root
Group=docker Group=docker
PermissionsStartOnly=true PermissionsStartOnly=true
@@ -20,4 +19,4 @@ ExecStop=/opt/mistborn/scripts/wrappers/mistborn_docker.sh guacamole docker-comp
# Post stop # Post stop
[Install] [Install]
WantedBy=Mistborn-base.service WantedBy=multi-user.target
@@ -6,7 +6,6 @@ PartOf=Mistborn-base.service
[Service] [Service]
Restart=always Restart=always
RestartSec=15
User=root User=root
Group=docker Group=docker
PermissionsStartOnly=true PermissionsStartOnly=true
@@ -20,4 +19,4 @@ ExecStop=/opt/mistborn/scripts/wrappers/mistborn_docker.sh homeassistant docker-
# Post stop # Post stop
[Install] [Install]
WantedBy=Mistborn-base.service WantedBy=multi-user.target
+1 -2
View File
@@ -6,7 +6,6 @@ PartOf=Mistborn-base.service
[Service] [Service]
Restart=always Restart=always
RestartSec=15
User=root User=root
Group=docker Group=docker
PermissionsStartOnly=true PermissionsStartOnly=true
@@ -20,4 +19,4 @@ ExecStop=/opt/mistborn/scripts/wrappers/mistborn_docker.sh jellyfin docker-compo
# Post stop # Post stop
[Install] [Install]
WantedBy=Mistborn-base.service WantedBy=multi-user.target
+1 -2
View File
@@ -6,7 +6,6 @@ PartOf=Mistborn-base.service
[Service] [Service]
Restart=always Restart=always
RestartSec=15
User=root User=root
Group=docker Group=docker
PermissionsStartOnly=true PermissionsStartOnly=true
@@ -24,4 +23,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 ExecStopPost=-/opt/mistborn/scripts/wrappers/mistborn_docker.sh jitsi /opt/mistborn/scripts/services/jitsi/iptables_down.sh
[Install] [Install]
WantedBy=Mistborn-base.service WantedBy=multi-user.target
+1 -2
View File
@@ -6,7 +6,6 @@ PartOf=Mistborn-base.service
[Service] [Service]
Restart=always Restart=always
RestartSec=15
User=root User=root
Group=docker Group=docker
PermissionsStartOnly=true PermissionsStartOnly=true
@@ -20,4 +19,4 @@ ExecStop=/opt/mistborn/scripts/wrappers/mistborn_docker.sh nextcloud docker-comp
# Post stop # Post stop
[Install] [Install]
WantedBy=Mistborn-base.service WantedBy=multi-user.target
+1 -2
View File
@@ -6,7 +6,6 @@ PartOf=Mistborn-base.service
[Service] [Service]
Restart=always Restart=always
RestartSec=15
User=root User=root
Group=docker Group=docker
PermissionsStartOnly=true PermissionsStartOnly=true
@@ -20,4 +19,4 @@ ExecStop=/opt/mistborn/scripts/wrappers/mistborn_docker.sh onlyoffice docker-com
# Post stop # Post stop
[Install] [Install]
WantedBy=Mistborn-base.service WantedBy=multi-user.target
-25
View File
@@ -1,25 +0,0 @@
[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
+1 -2
View File
@@ -6,7 +6,6 @@ PartOf=Mistborn-base.service
[Service] [Service]
Restart=always Restart=always
RestartSec=15
User=root User=root
Group=docker Group=docker
PermissionsStartOnly=true PermissionsStartOnly=true
@@ -22,4 +21,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 ExecStopPost=-/sbin/iptables -D DOCKER-USER -i DIFACE -p tcp --dport 3001 -j MISTBORN_LOG_DROP
[Install] [Install]
WantedBy=Mistborn-base.service WantedBy=multi-user.target
+1 -2
View File
@@ -6,7 +6,6 @@ PartOf=Mistborn-base.service
[Service] [Service]
Restart=always Restart=always
RestartSec=15
User=root User=root
Group=docker Group=docker
PermissionsStartOnly=true PermissionsStartOnly=true
@@ -24,4 +23,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 ExecStopPost=-/sbin/iptables -D DOCKER-USER -i DIFACE -p tcp --dport 22000 -j MISTBORN_LOG_DROP
[Install] [Install]
WantedBy=Mistborn-base.service WantedBy=multi-user.target
+1 -2
View File
@@ -6,7 +6,6 @@ PartOf=Mistborn-base.service
[Service] [Service]
Restart=always Restart=always
RestartSec=15
User=root User=root
Group=docker Group=docker
PermissionsStartOnly=true PermissionsStartOnly=true
@@ -22,4 +21,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 ExecStopPost=-/sbin/iptables -D DOCKER-USER -i DIFACE -p tcp --dport 9150 -j MISTBORN_LOG_DROP
[Install] [Install]
WantedBy=Mistborn-base.service WantedBy=multi-user.target
-30
View File
@@ -1,30 +0,0 @@
[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
@@ -1,17 +0,0 @@
---
# 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"
-16
View File
@@ -1,16 +0,0 @@
#!/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
@@ -0,0 +1,21 @@
[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
+4
View File
@@ -0,0 +1,4 @@
#!/bin/bash
# install on gateway
sudo apt-get install -y hostapd vnstat
-30
View File
@@ -1,30 +0,0 @@
#!/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
-4
View File
@@ -1,4 +0,0 @@
#!/bin/bash
systemctl start wazuh-agent
systemctl enable wazuh-agent
-4
View File
@@ -1,4 +0,0 @@
#!/bin/bash
systemctl stop wazuh-agent
systemctl disable wazuh-agent
@@ -1,129 +0,0 @@
#!/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
@@ -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 &
@@ -1,6 +0,0 @@
#!/bin/bash
systemctl stop suricata
systemctl disable suricata
#kill $(pgrep -f suri_reloader) 2>/dev/null
-10
View File
@@ -1,10 +0,0 @@
#!/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
-3
View File
@@ -18,6 +18,3 @@ fi
if [ ! -f /usr/local/bin/docker-compose ]; then if [ ! -f /usr/local/bin/docker-compose ]; then
sudo -E ln -s $(which docker-compose) /usr/local/bin/docker-compose sudo -E ln -s $(which docker-compose) /usr/local/bin/docker-compose
fi fi
# daemon.json
#source ./scripts/subinstallers/docker_daemon.sh
-7
View File
@@ -1,7 +0,0 @@
#!/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
-5
View File
@@ -67,8 +67,3 @@ echo "Installing Docker Compose"
sudo pip3 install cryptography==3.3.2 docker-compose sudo pip3 install cryptography==3.3.2 docker-compose
#fi #fi
# check raspbian fixes
if [ "$DISTRO" == "raspbian" ] || [ "$DISTRO" == "raspios" ]; then
source ./scripts/subinstallers/docker_raspbian.sh
fi
-44
View File
@@ -1,44 +0,0 @@
#!/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
-1
View File
@@ -4,4 +4,3 @@
BITWARDEN_PROD_FILE="$1" BITWARDEN_PROD_FILE="$1"
echo "WEBSOCKET_ENABLED=true" > $BITWARDEN_PROD_FILE echo "WEBSOCKET_ENABLED=true" > $BITWARDEN_PROD_FILE
echo "SIGNUPS_ALLOWED=true" >> $BITWARDEN_PROD_FILE echo "SIGNUPS_ALLOWED=true" >> $BITWARDEN_PROD_FILE
chmod 600 $BITWARDEN_PROD_FILE
@@ -1,6 +0,0 @@
#!/bin/bash
# Elasticsearch
ELASTICSEARCH_PROD_FILE="$1"
echo "MISTBORN_DEFAULT_PASSWORD=$MISTBORN_DEFAULT_PASSWORD" >> $ELASTICSEARCH_PROD_FILE
chmod 600 $ELASTICSEARCH_PROD_FILE
+1 -2
View File
@@ -10,5 +10,4 @@ echo "POSTGRES_DB=guacamole_db" >> $GUAC_PROD_FILE
echo "POSTGRES_DATABASE=guacamole_db" >> $GUAC_PROD_FILE echo "POSTGRES_DATABASE=guacamole_db" >> $GUAC_PROD_FILE
echo "POSTGRES_USER=guac_user" >> $GUAC_PROD_FILE echo "POSTGRES_USER=guac_user" >> $GUAC_PROD_FILE
echo "POSTGRES_PASSWORD=$GUAC_PASSWORD" >> $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
-1
View File
@@ -10,4 +10,3 @@ 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/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_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" 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
+1 -2
View File
@@ -5,6 +5,5 @@ 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=$(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}" NEXTCLOUD_PASSWORD="${MISTBORN_DEFAULT_PASSWORD}"
echo "NEXTCLOUD_ADMIN_USER=mistborn" > $NEXTCLOUD_PROD_FILE 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 echo "NEXTCLOUD_TRUSTED_DOMAINS=nextcloud.mistborn" >> $NEXTCLOUD_PROD_FILE
chmod 600 $NEXTCLOUD_PROD_FILE
+1 -2
View File
@@ -4,5 +4,4 @@
ONLYOFFICE_PROD_FILE="$1" ONLYOFFICE_PROD_FILE="$1"
JWT_SECRET="${MISTBORN_DEFAULT_PASSWORD}" JWT_SECRET="${MISTBORN_DEFAULT_PASSWORD}"
echo "JWT_ENABLED=true" > $ONLYOFFICE_PROD_FILE 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
-6
View File
@@ -1,6 +0,0 @@
#!/bin/bash
# RaspAP
RASPAP_PROD_FILE="$1"
echo "MISTBORN_DEFAULT_PASSWORD=$MISTBORN_DEFAULT_PASSWORD" > $RASPAP_PROD_FILE
chmod 600 $RASPAP_PROD_FILE
+1 -3
View File
@@ -7,9 +7,7 @@ ROCKETCHAT_PASSWORD="${MISTBORN_DEFAULT_PASSWORD}"
echo "ROCKETCHAT_USER=bot" > $ROCKETCHAT_PROD_FILE echo "ROCKETCHAT_USER=bot" > $ROCKETCHAT_PROD_FILE
echo "ROCKETCHAT_ROOM=GENERAL" >> $ROCKETCHAT_PROD_FILE echo "ROCKETCHAT_ROOM=GENERAL" >> $ROCKETCHAT_PROD_FILE
echo "BOT_NAME=bot" >> $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 # docker environment
echo "MISTBORN_BIND_IP=${MISTBORN_BIND_IP}" >> $ROCKETCHAT_PROD_FILE echo "MISTBORN_BIND_IP=${MISTBORN_BIND_IP}" >> $ROCKETCHAT_PROD_FILE
chmod 600 $ROCKETCHAT_PROD_FILE
-92
View File
@@ -1,92 +0,0 @@
#!/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
+3 -3
View File
@@ -15,8 +15,8 @@ echo "DJANGO_ADMIN_URL=admin/" >> $DJANGO_PROD_FILE
echo "USE_DOCKER=yes" >> $DJANGO_PROD_FILE echo "USE_DOCKER=yes" >> $DJANGO_PROD_FILE
echo "REDIS_URL=redis://redis:6379/0" >> $DJANGO_PROD_FILE echo "REDIS_URL=redis://redis:6379/0" >> $DJANGO_PROD_FILE
echo "CELERY_FLOWER_USER=prod" >> $DJANGO_PROD_FILE echo "CELERY_FLOWER_USER=prod" >> $DJANGO_PROD_FILE
echo "CELERY_FLOWER_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 "MISTBORN_DEFAULT_PASSWORD=\"$MISTBORN_DEFAULT_PASSWORD\"" >> $DJANGO_PROD_FILE
echo "#MAILGUN_API_KEY=" >> $DJANGO_PROD_FILE echo "#MAILGUN_API_KEY=" >> $DJANGO_PROD_FILE
echo "#MAILGUN_API_URL=" >> $DJANGO_PROD_FILE echo "#MAILGUN_API_URL=" >> $DJANGO_PROD_FILE
echo "#SENTRY_DNS=" >> $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=$(python3 -c "import secrets; import string; print(f''.join([secrets.choice(string.ascii_letters+string.digits) for x in range(32)]))")
WEBPASSWORD="$1" WEBPASSWORD="$1"
echo "TZ=\"America/New York\"" > $PIHOLE_PROD_FILE 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 chmod 600 $PIHOLE_PROD_FILE
+1 -1
View File
@@ -6,7 +6,7 @@ figlet "Mistborn: Configuring Firewall"
echo "stop iptables wrappers" echo "stop iptables wrappers"
if [ "$DISTRO" == "ubuntu" ]; then if [ "$DISTRO" == "ubuntu" ]; then
echo "Disabling UFW" # Disable UFW
sudo systemctl stop ufw || true sudo systemctl stop ufw || true
sudo systemctl disable ufw || true sudo systemctl disable ufw || true
fi fi
-22
View File
@@ -1,22 +0,0 @@
#!/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
-7
View File
@@ -18,13 +18,6 @@ sudo mistborn-cli pullbuild
sudo docker container prune -f sudo docker container prune -f
sudo docker image prune -f sudo docker image prune -f
# RESTART
sudo systemctl stop Mistborn-base sudo systemctl stop Mistborn-base
# docker daemon
#source ./scripts/subinstallers/docker_daemon.sh
sudo systemctl restart Mistborn-setup sudo systemctl restart Mistborn-setup
sudo systemctl restart Mistborn-base sudo systemctl restart Mistborn-base
+4 -26
View File
@@ -2,16 +2,12 @@
set -e set -e
MISTBORN_HOME="/opt/mistborn" SERVICE="$1"
SERVICES="$1"
shift shift
IFS=',' export MISTBORN_HOME="/opt/mistborn"
read -ra SERVICES_ARRAY <<< "${SERVICES}" export MISTBORN_SERVICE_FILE=${MISTBORN_HOME}/.envs/.production/.${SERVICE}
for SERVICE in "${SERVICES_ARRAY[@]}"; do export MISTBORN_SERVICE_INIT=${MISTBORN_HOME}/scripts/services/${SERVICE}/init.sh
MISTBORN_SERVICE_FILE=${MISTBORN_HOME}/.envs/.production/.${SERVICE}
MISTBORN_SERVICE_INIT=${MISTBORN_HOME}/scripts/services/${SERVICE}/init.sh
# check and create file if needed # check and create file if needed
${MISTBORN_HOME}/scripts/env/check_env_file.sh ${SERVICE} ${MISTBORN_HOME}/scripts/env/check_env_file.sh ${SERVICE}
@@ -35,23 +31,5 @@ for SERVICE in "${SERVICES_ARRAY[@]}"; do
else else
echo "No init script. Proceeding." echo "No init script. Proceeding."
fi 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 "$@" exec "$@"