Resolve "Mistborn and wireguard fail after restart and nextcloud"
This commit is contained in:
Vendored
+13
@@ -1,5 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
#### ENV file
|
||||||
|
|
||||||
VAR_FILE=/opt/mistborn/.env
|
VAR_FILE=/opt/mistborn/.env
|
||||||
|
|
||||||
source /opt/mistborn/scripts/subinstallers/platform.sh
|
source /opt/mistborn/scripts/subinstallers/platform.sh
|
||||||
@@ -19,3 +21,14 @@ if [ "$GIT_BRANCH" != "master" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "MISTBORN_TAG=$MISTBORN_TAG" | sudo tee -a ${VAR_FILE}
|
echo "MISTBORN_TAG=$MISTBORN_TAG" | sudo tee -a ${VAR_FILE}
|
||||||
|
|
||||||
|
#### install and base services
|
||||||
|
iface=$(ip -o -4 route show to default | egrep -o 'dev [^ ]*' | awk 'NR==1{print $2}')
|
||||||
|
|
||||||
|
# default interface
|
||||||
|
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=$USER/"
|
||||||
|
#sudo find /etc/systemd/system/ -type f -name 'Mistborn*' | xargs sudo sed -i "s/ root:root / $USER:$USER /"
|
||||||
|
sudo find /etc/systemd/system/ -type f -name 'Mistborn*' | xargs sudo sed -i "s/DIFACE/$iface/"
|
||||||
|
|
||||||
|
sudo systemctl daemon-reload
|
||||||
+6
-13
@@ -117,10 +117,10 @@ fi
|
|||||||
|
|
||||||
# SSH Server
|
# SSH Server
|
||||||
sudo -E 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/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
|
#sudo sed -i 's/#PermitRootLogin.*/PermitRootLogin prohibit-password/' /etc/ssh/sshd_config
|
||||||
sudo sed -i 's/PermitRootLogin.*/PermitRootLogin prohibit-password/' /etc/ssh/sshd_config
|
#sudo sed -i 's/PermitRootLogin.*/PermitRootLogin prohibit-password/' /etc/ssh/sshd_config
|
||||||
sudo sed -i 's/#Port.*/Port 22/' /etc/ssh/sshd_config
|
sudo sed -i 's/#Port.*/Port 22/' /etc/ssh/sshd_config
|
||||||
sudo sed -i 's/Port.*/Port 22/' /etc/ssh/sshd_config
|
sudo sed -i 's/Port.*/Port 22/' /etc/ssh/sshd_config
|
||||||
sudo systemctl enable ssh
|
sudo systemctl enable ssh
|
||||||
@@ -166,8 +166,6 @@ sudo pip3 install -e ./modules/mistborn-cli
|
|||||||
|
|
||||||
# Mistborn
|
# Mistborn
|
||||||
# final setup vars
|
# final setup vars
|
||||||
iface=$(ip -o -4 route show to default | egrep -o 'dev [^ ]*' | awk 'NR==1{print $2}')
|
|
||||||
figlet "Mistborn default NIC: $iface"
|
|
||||||
|
|
||||||
#IPV4_PUBLIC=$(ip -o -4 route show default | egrep -o 'dev [^ ]*' | awk '{print $2}' | xargs ip -4 addr show | grep 'inet ' | awk '{print $2}' | grep -o "^[0-9.]*" | tr -cd '\11\12\15\40-\176' | head -1) # tail -1 to get last
|
#IPV4_PUBLIC=$(ip -o -4 route show default | egrep -o 'dev [^ ]*' | awk '{print $2}' | xargs ip -4 addr show | grep 'inet ' | awk '{print $2}' | grep -o "^[0-9.]*" | tr -cd '\11\12\15\40-\176' | head -1) # tail -1 to get last
|
||||||
IPV4_PUBLIC="10.2.3.1"
|
IPV4_PUBLIC="10.2.3.1"
|
||||||
@@ -188,18 +186,13 @@ sudo systemctl restart unattended-upgrades
|
|||||||
|
|
||||||
# setup Mistborn services
|
# setup Mistborn services
|
||||||
|
|
||||||
# install and start base services
|
|
||||||
# default interface
|
|
||||||
sudo cp ./scripts/services/Mistborn* /etc/systemd/system/
|
|
||||||
sudo find /etc/systemd/system/ -type f -name 'Mistborn*' | xargs sudo sed -i "s/User=root/User=$USER/"
|
|
||||||
#sudo find /etc/systemd/system/ -type f -name 'Mistborn*' | xargs sudo sed -i "s/ root:root / $USER:$USER /"
|
|
||||||
sudo find /etc/systemd/system/ -type f -name 'Mistborn*' | xargs sudo sed -i "s/DIFACE/$iface/"
|
|
||||||
|
|
||||||
#if [ "$DISTRO" == "debian" ] || [ "$DISTRO" == "raspbian" ]; then
|
#if [ "$DISTRO" == "debian" ] || [ "$DISTRO" == "raspbian" ]; then
|
||||||
# # remove systemd-resolved lines
|
# # remove systemd-resolved lines
|
||||||
# sudo sed -i '/.*systemd-resolved/d' /etc/systemd/system/Mistborn-base.service
|
# sudo sed -i '/.*systemd-resolved/d' /etc/systemd/system/Mistborn-base.service
|
||||||
#fi
|
#fi
|
||||||
|
|
||||||
|
sudo cp ./scripts/services/Mistborn-setup.service /etc/systemd/system/
|
||||||
|
|
||||||
# setup local volumes for pihole
|
# setup local volumes for pihole
|
||||||
sudo mkdir -p ../mistborn_volumes/
|
sudo mkdir -p ../mistborn_volumes/
|
||||||
sudo chown -R root:root ../mistborn_volumes/
|
sudo chown -R root:root ../mistborn_volumes/
|
||||||
|
|||||||
Executable
+9
@@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
sudo systemctl stop Mistborn-base
|
||||||
|
sudo systemctl restart Mistborn-setup
|
||||||
|
sudo systemctl restart Mistborn-base
|
||||||
@@ -4,6 +4,7 @@ Before=Mistborn-base.service
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
|
User=mistborn
|
||||||
ExecStart=/opt/mistborn/scripts/env/setup.sh
|
ExecStart=/opt/mistborn/scripts/env/setup.sh
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
|||||||
+5
-10
@@ -10,19 +10,14 @@ sudo git -C /opt/mistborn submodule update --init --recursive
|
|||||||
# ensure mistborn-cli is installed
|
# ensure mistborn-cli is installed
|
||||||
sudo pip3 install -e /opt/mistborn/modules/mistborn-cli
|
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
|
# handle updates to traefik
|
||||||
#sudo cp /opt/mistborn/compose/production/traefik/traefik.toml.template /opt/mistborn/compose/production/traefik/traefik.toml
|
#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
|
|
||||||
|
|
||||||
sudo mistborn-cli pullbuild
|
sudo mistborn-cli pullbuild
|
||||||
|
|
||||||
|
sudo docker container prune -f
|
||||||
|
sudo docker image prune -f
|
||||||
|
|
||||||
|
sudo systemctl stop Mistborn-base
|
||||||
|
sudo systemctl restart Mistborn-setup
|
||||||
sudo systemctl restart Mistborn-base
|
sudo systemctl restart Mistborn-base
|
||||||
|
|||||||
Reference in New Issue
Block a user