Merge branch 'master' into 53-wifi
This commit is contained in:
Vendored
+4
-4
@@ -4,10 +4,10 @@ VAR_FILE=/opt/mistborn/.env
|
||||
|
||||
source /opt/mistborn/scripts/subinstallers/platform.sh
|
||||
|
||||
MISTBORN_DNS_BIND_IP="0.0.0.0"
|
||||
if [ "$DISTRO" == "ubuntu" ] && [ "$VERSION_ID" == "20.04" ]; then
|
||||
MISTBORN_DNS_BIND_IP="10.2.3.1"
|
||||
fi
|
||||
MISTBORN_DNS_BIND_IP="10.2.3.1"
|
||||
#if [ "$DISTRO" == "ubuntu" ] && [ "$VERSION_ID" == "20.04" ]; then
|
||||
# MISTBORN_DNS_BIND_IP="10.2.3.1"
|
||||
#fi
|
||||
|
||||
echo "MISTBORN_DNS_BIND_IP=${MISTBORN_DNS_BIND_IP}" | sudo tee ${VAR_FILE}
|
||||
sudo chown mistborn:mistborn ${VAR_FILE}
|
||||
|
||||
+9
-6
@@ -2,6 +2,8 @@
|
||||
|
||||
set -e
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
## ensure run as nonroot user
|
||||
#if [ "$EUID" -eq 0 ]; then
|
||||
MISTBORN_USER="mistborn"
|
||||
@@ -97,7 +99,7 @@ git submodule update --init --recursive
|
||||
sudo apt-get update
|
||||
|
||||
# install figlet
|
||||
sudo apt-get install -y figlet
|
||||
sudo -E apt-get install -y figlet
|
||||
|
||||
# get os and distro
|
||||
source ./scripts/subinstallers/platform.sh
|
||||
@@ -114,7 +116,7 @@ fi
|
||||
|
||||
|
||||
# SSH Server
|
||||
sudo apt-get install -y openssh-server
|
||||
sudo -E apt-get install -y openssh-server
|
||||
sudo sed -i 's/#PasswordAuthentication.*/PasswordAuthentication yes/' /etc/ssh/sshd_config
|
||||
sudo sed -i 's/PasswordAuthentication.*/PasswordAuthentication yes/' /etc/ssh/sshd_config
|
||||
sudo sed -i 's/#PermitRootLogin.*/PermitRootLogin prohibit-password/' /etc/ssh/sshd_config
|
||||
@@ -125,13 +127,13 @@ sudo systemctl enable ssh
|
||||
sudo systemctl restart ssh
|
||||
|
||||
# Additional tools fail2ban
|
||||
sudo apt-get install -y dnsutils fail2ban
|
||||
sudo -E apt-get install -y dnsutils fail2ban
|
||||
|
||||
# Install kernel headers
|
||||
if [ "$DISTRO" == "ubuntu" ] || [ "$DISTRO" == "debian" ]; then
|
||||
sudo apt install -y linux-headers-$(uname -r)
|
||||
sudo -E apt install -y linux-headers-$(uname -r)
|
||||
elif [ "$DISTRO" == "raspbian" ]; then
|
||||
sudo apt-get install -y raspberrypi-kernel-headers
|
||||
sudo -E apt install -y raspberrypi-kernel-headers
|
||||
fi
|
||||
|
||||
# Wireugard
|
||||
@@ -143,7 +145,7 @@ sudo systemctl enable docker
|
||||
sudo systemctl start docker
|
||||
|
||||
# Unattended upgrades
|
||||
sudo apt-get install -y unattended-upgrades
|
||||
sudo -E apt-get install -y unattended-upgrades
|
||||
|
||||
# Cockpit
|
||||
if [[ "$MISTBORN_INSTALL_COCKPIT" =~ ^([yY][eE][sS]|[yY])$ ]]
|
||||
@@ -204,6 +206,7 @@ sudo mkdir -p ../mistborn_volumes/extra
|
||||
|
||||
# Traefik final setup (cockpit)
|
||||
cp ./compose/production/traefik/traefik.toml.template ./compose/production/traefik/traefik.toml
|
||||
|
||||
# setup tls certs
|
||||
source ./scripts/subinstallers/openssl.sh
|
||||
sudo rm -rf ../mistborn_volumes/base/tls
|
||||
|
||||
@@ -17,11 +17,11 @@ elif [ "$DISTRO" == "raspbian" ]; then
|
||||
|
||||
fi
|
||||
|
||||
sudo apt-get install -y cockpit
|
||||
sudo -E apt-get install -y cockpit
|
||||
|
||||
if $(sudo apt-cache show cockpit-docker > /dev/null 2>&1) ; then
|
||||
# no longer supported upstream in Ubuntu 20.04
|
||||
sudo apt-get install -y cockpit-docker
|
||||
sudo -E apt-get install -y cockpit-docker
|
||||
fi
|
||||
|
||||
sudo cp ./scripts/conf/cockpit.conf /etc/cockpit/cockpit.conf
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
figlet "Mistborn: Installing Docker"
|
||||
|
||||
sudo apt update
|
||||
sudo apt install -y python python3-pip python3-setuptools libffi-dev python3-dev libssl-dev
|
||||
sudo -E apt install -y python python3-pip python3-setuptools libffi-dev python3-dev libssl-dev
|
||||
|
||||
if [ "$DISTRO" == "ubuntu" ] && [ "$VERSION_ID" == "20.04" ]; then
|
||||
echo "Automated Docker install"
|
||||
sudo apt-get install -y docker-compose
|
||||
sudo -E apt-get install -y docker-compose
|
||||
else
|
||||
echo "Manual Docker installation"
|
||||
source ./scripts/subinstallers/docker_manual.sh
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# dependencies
|
||||
echo "Installing Docker dependencies"
|
||||
sudo apt-get install -y \
|
||||
sudo -E apt-get install -y \
|
||||
apt-transport-https \
|
||||
ca-certificates \
|
||||
curl \
|
||||
@@ -42,9 +42,9 @@ echo "Installing docker"
|
||||
sudo apt-get update
|
||||
|
||||
if [ "$DISTRO" == "ubuntu" ] || [ "$DISTRO" == "debian" ]; then
|
||||
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
|
||||
sudo -E apt-get install -y docker-ce docker-ce-cli containerd.io
|
||||
elif [ "$DISTRO" == "raspbian" ]; then
|
||||
sudo apt install -y --no-install-recommends \
|
||||
sudo -E apt install -y --no-install-recommends \
|
||||
docker-ce \
|
||||
cgroupfs-mount
|
||||
fi
|
||||
@@ -59,7 +59,7 @@ echo "Installing Docker Compose"
|
||||
# sudo chmod +x /usr/local/bin/docker-compose
|
||||
#elif [ "$DISTRO" == "raspbian" ]; then
|
||||
# Install required packages
|
||||
sudo apt install -y python-backports.ssl-match-hostname
|
||||
sudo -E apt install -y python-backports.ssl-match-hostname
|
||||
|
||||
# Install Docker Compose from pip
|
||||
# This might take a while
|
||||
|
||||
@@ -20,6 +20,8 @@ echo "#MAILGUN_API_KEY=" >> $DJANGO_PROD_FILE
|
||||
echo "#MAILGUN_API_URL=" >> $DJANGO_PROD_FILE
|
||||
echo "#SENTRY_DNS=" >> $DJANGO_PROD_FILE
|
||||
echo "MISTBORN_INSTALL_COCKPIT=$MISTBORN_INSTALL_COCKPIT" >> $DJANGO_PROD_FILE
|
||||
echo "MISTBORN_PORTAL_IP=10.2.3.1" >> $DJANGO_PROD_FILE
|
||||
echo "MISTBORN_PORTAL_PORT=5000" >> $DJANGO_PROD_FILE
|
||||
|
||||
# generate production .env file for postgresql
|
||||
POSTGRES_PROD_FILE="./.envs/.production/.postgres"
|
||||
|
||||
@@ -46,7 +46,8 @@ sudo iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
|
||||
# if installing over SSH, add SSH rule
|
||||
if [ ! -z "${SSH_CLIENT}" ]; then
|
||||
SSH_SRC=$(echo $SSH_CLIENT | awk '{print $1}')
|
||||
sudo iptables -A INPUT -p tcp -s $SSH_SRC --dport 22 -j ACCEPT
|
||||
SSH_PRT=$(echo $SSH_CLIENT | awk '{print $3}')
|
||||
sudo iptables -A INPUT -p tcp -s $SSH_SRC --dport $SSH_PRT -j ACCEPT
|
||||
fi
|
||||
|
||||
# docker rules
|
||||
@@ -102,7 +103,7 @@ if [ ! "$(dpkg-query -l iptables-persistent)" ]; then
|
||||
echo iptables-persistent iptables-persistent/autosave_v6 boolean true | sudo debconf-set-selections
|
||||
|
||||
# install
|
||||
sudo apt-get install -y iptables-persistent ipset
|
||||
sudo -E apt-get install -y iptables-persistent ipset
|
||||
else
|
||||
echo "Saving iptables rules"
|
||||
sudo bash -c "iptables-save > /etc/iptables/rules.v4"
|
||||
|
||||
@@ -8,7 +8,7 @@ CRT_PATH="$KEY_FOLDER/$CRT_FILE"
|
||||
KEY_PATH="$KEY_FOLDER/$KEY_FILE"
|
||||
|
||||
# ensure openssl installed
|
||||
sudo apt-get install -y openssl
|
||||
sudo -E apt-get install -y openssl
|
||||
|
||||
# make folder
|
||||
mkdir -p $KEY_FOLDER
|
||||
|
||||
@@ -11,7 +11,7 @@ if ! $(sudo apt-cache show wireguard > /dev/null 2>&1) ; then
|
||||
# Wireguard
|
||||
if [ "$DISTRO" == "raspbian" ]; then
|
||||
echo "Adding Wireguard repo keys"
|
||||
sudo apt-get install -y dirmngr
|
||||
sudo -E apt-get install -y dirmngr
|
||||
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8B48AD6246925553
|
||||
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7638D0442B90D010
|
||||
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 04EE7237B7D453EC
|
||||
@@ -29,4 +29,4 @@ fi
|
||||
|
||||
echo "Installing Wireguard"
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y openresolv wireguard
|
||||
sudo -E apt-get install -y openresolv wireguard
|
||||
|
||||
@@ -2,17 +2,23 @@
|
||||
|
||||
set -e
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
sudo git -C /opt/mistborn pull
|
||||
sudo git -C /opt/mistborn submodule update --init --recursive
|
||||
|
||||
# ensure mistborn-cli is installed
|
||||
sudo pip3 install -e /opt/mistborn/modules/mistborn-cli
|
||||
|
||||
# handle updates to Mistborn systemd scripts
|
||||
iface=$(ip -o -4 route show to default | egrep -o 'dev [^ ]*' | awk 'NR==1{print $2}')
|
||||
sudo cp /opt/mistborn/scripts/services/Mistborn* /etc/systemd/system/
|
||||
sudo find /etc/systemd/system/ -type f -name 'Mistborn*' | xargs sudo sed -i "s/User=root/User=mistborn/"
|
||||
sudo find /etc/systemd/system/ -type f -name 'Mistborn*' | xargs sudo sed -i "s/DIFACE/$iface/"
|
||||
|
||||
# handle updates to traefik
|
||||
sudo cp /opt/mistborn/compose/production/traefik/traefik.toml.template /opt/mistborn/compose/production/traefik/traefik.toml
|
||||
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable Mistborn-setup.service
|
||||
sudo systemctl restart Mistborn-setup.service
|
||||
|
||||
Reference in New Issue
Block a user