Browse Source

Merge branch 'testing' into 'master'

Testing

See merge request cyber5k/mistborn!31
merge-requests/31/merge
Sebastian Werner 6 years ago
parent
commit
cfef8a58dd
  1. 31
      scripts/install.sh
  2. 12
      scripts/subinstallers/cockpit.sh
  3. 14
      scripts/subinstallers/docker.sh
  4. 7
      scripts/subinstallers/docker_manual.sh
  5. 15
      scripts/subinstallers/iptables.sh
  6. 4
      scripts/subinstallers/openssl.sh
  7. 7
      scripts/subinstallers/wireguard.sh

31
scripts/install.sh

@ -93,15 +93,22 @@ pushd . @@ -93,15 +93,22 @@ pushd .
cd /opt/mistborn
git submodule update --init --recursive
# get os and distro
source ./scripts/subinstallers/platform.sh
# initial load update package list
if [ "$DISTRO" == "ubuntu" ] || [ "$DISTRO" == "debian" ] || [ "$DISTRO" == "raspbian" ] ; then
sudo apt-get update
elif ["$DISTRO" == "arch"]; then
sudo pacman -Syyy
fi
# install figlet
if [ "$DISTRO" == "ubuntu" ] || [ "$DISTRO" == "debian" ] || [ "$DISTRO" == "raspbian" ] ; then
sudo apt-get install -y figlet
# get os and distro
source ./scripts/subinstallers/platform.sh
elif ["$DISTRO" == "arch"]; then
sudo pacman -S --noconfirm figlet
fi
# iptables
echo "Setting up firewall (iptables)"
@ -125,13 +132,19 @@ sudo systemctl enable ssh @@ -125,13 +132,19 @@ sudo systemctl enable ssh
sudo systemctl restart ssh
# Additional tools fail2ban
if [ "$DISTRO" == "ubuntu" ] || [ "$DISTRO" == "debian" ] || [ "$DISTRO" == "raspbian" ] ; then
sudo apt-get install -y dnsutils fail2ban
elif ["$DISTRO" == "arch"]; then
sudo pacman -S --noconfirm bind-tools fail2ban
fi
# Install kernel headers
if [ "$DISTRO" == "ubuntu" ] || [ "$DISTRO" == "debian" ]; then
sudo apt install -y linux-headers-$(uname -r)
elif [ "$DISTRO" == "raspbian" ]; then
sudo apt-get install -y raspberrypi-kernel-headers
elif ["$DISTRO" == "arch"]; then
sudo pacman -S --noconfirm linux-lts-headers
fi
# Wireugard
@ -143,7 +156,7 @@ sudo systemctl enable docker @@ -143,7 +156,7 @@ sudo systemctl enable docker
sudo systemctl start docker
# Unattended upgrades
sudo apt-get install -y unattended-upgrades
#sudo apt-get install -y unattended-upgrades
# Cockpit
if [[ "$MISTBORN_INSTALL_COCKPIT" =~ ^([yY][eE][sS]|[yY])$ ]]
@ -174,12 +187,12 @@ IPV4_PUBLIC="10.2.3.1" @@ -174,12 +187,12 @@ IPV4_PUBLIC="10.2.3.1"
#fi
# unattended upgrades
sudo cp ./scripts/conf/20auto-upgrades /etc/apt/apt.conf.d/
sudo cp ./scripts/conf/50unattended-upgrades /etc/apt/apt.conf.d/
#sudo cp ./scripts/conf/20auto-upgrades /etc/apt/apt.conf.d/
#sudo cp ./scripts/conf/50unattended-upgrades /etc/apt/apt.conf.d/
sudo systemctl stop unattended-upgrades
#sudo systemctl stop unattended-upgrades
sudo systemctl daemon-reload
sudo systemctl restart unattended-upgrades
#sudo systemctl restart unattended-upgrades
# setup Mistborn services

12
scripts/subinstallers/cockpit.sh

@ -15,14 +15,26 @@ elif [ "$DISTRO" == "raspbian" ]; then @@ -15,14 +15,26 @@ elif [ "$DISTRO" == "raspbian" ]; then
echo "Raspbian repos contain cockpit"
elif [ "$DISTRO" == "arch" ]; then
echo "Arch Linux repos contain cockpit"
fi
if [ "$DISTRO" == "ubuntu" ] || [ "$DISTRO" == "debian" ] || [ "$DISTRO" == "raspbian" ]; then
sudo apt-get install -y cockpit
elif ["$DISTRO" == "arch"]; then
sudo pacman -S --noconfirm cockpit
fi
if [ "$DISTRO" == "ubuntu" ] || [ "$DISTRO" == "debian" ] || [ "$DISTRO" == "raspbian" ]; then
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
fi
elif [ "$DISTRO" == "arch" ]; then
sudo pacman -S --noconfirm cockpit-docker
fi
sudo cp ./scripts/conf/cockpit.conf /etc/cockpit/cockpit.conf
sudo systemctl restart cockpit.socket

14
scripts/subinstallers/docker.sh

@ -3,12 +3,22 @@ @@ -3,12 +3,22 @@
# Docker
figlet "Mistborn: Installing Docker"
sudo apt update
sudo apt install -y python python3-pip python3-setuptools libffi-dev python3-dev libssl-dev
if [ "$DISTRO" == "ubuntu" ] || [ "$DISTRO" == "debian" ] || [ "$DISTRO" == "raspbian" ]; then
sudo apt-get update
sudo apt-get install -y python python3-pip python3-setuptools libffi-dev python3-dev libssl-dev
elif [ "$DISTRO" == "arch" ]; then
sudo pacman -Syyy
sudo pacman -S --noconfirm python python-pip python-setuptools libffi openssl
fi
if [ "$DISTRO" == "ubuntu" ] && [ "$VERSION_ID" == "20.04" ]; then
echo "Automated Docker install"
sudo apt-get install -y docker-compose
elif [ "$DISTRO" == "arch" ]; then
echo "Semi-Automated Docker install"
sudo pacman -S --noconfirm docker-compose
source ./scripts/subinstallers/docker_manual.sh
else
echo "Manual Docker installation"
source ./scripts/subinstallers/docker_manual.sh

7
scripts/subinstallers/docker_manual.sh

@ -38,8 +38,12 @@ elif [ "$DISTRO" == "raspbian" ]; then @@ -38,8 +38,12 @@ elif [ "$DISTRO" == "raspbian" ]; then
fi
# install Docker
if [ "$DISTRO" == "ubuntu" ] || [ "$DISTRO" == "debian" ] || [ "$DISTRO" == "raspbian" ]; then
echo "Installing docker"
sudo apt-get update
fi
if [ "$DISTRO" == "ubuntu" ] || [ "$DISTRO" == "debian" ]; then
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
@ -52,6 +56,7 @@ fi @@ -52,6 +56,7 @@ fi
# Docker group
sudo usermod -aG docker $USER
if [ "$DISTRO" == "ubuntu" ] || [ "$DISTRO" == "debian" ] || [ "$DISTRO" == "raspbian" ]; then
# Docker Compose
echo "Installing Docker Compose"
#if [ "$DISTRO" == "ubuntu" ] || [ "$DISTRO" == "debian" ]; then
@ -65,4 +70,4 @@ sudo apt install -y python-backports.ssl-match-hostname @@ -65,4 +70,4 @@ sudo apt install -y python-backports.ssl-match-hostname
# This might take a while
sudo pip3 install docker-compose
#fi
fi

15
scripts/subinstallers/iptables.sh

@ -94,6 +94,7 @@ sudo ip6tables -P FORWARD DROP @@ -94,6 +94,7 @@ sudo ip6tables -P FORWARD DROP
sudo ip6tables -P OUTPUT ACCEPT
# iptables-persistent
if [ "$DISTRO" == "ubuntu" ] || [ "$DISTRO" == "debian" ] || [ "$DISTRO" == "raspbian" ]; then
if [ ! "$(dpkg-query -l iptables-persistent)" ]; then
echo "Installing iptables-persistent"
@ -109,12 +110,26 @@ else @@ -109,12 +110,26 @@ else
echo "Saving ip6tables rules"
sudo bash -c "ip6tables-save > /etc/iptables/rules.v6"
fi
elif [ "$DISTRO" == "arch" ]; then
echo "Saving iptables rules"
sudo bash -c "iptables-save > /etc/iptables/rules.v4"
echo "Saving ip6tables rules"
sudo bash -c "ip6tables-save > /etc/iptables/rules.v6"
fi
# IP forwarding
if [ "$DISTRO" == "ubuntu" ] || [ "$DISTRO" == "debian" ] || [ "$DISTRO" == "raspbian" ]; then
sudo sed -i 's/.*net.ipv4.ip_forward.*/net.ipv4.ip_forward=1/' /etc/sysctl.conf
sudo sysctl -p /etc/sysctl.conf
elif [ "$DISTRO" == "arch" ]; then
sudo echo "net.ipv4.ip_forward=1" > /etc/sysctl.d/30-ipforward.conf
sudo sysctl -p /etc/sysctl.d/30-ipforward.conf
fi
# rsyslog to create /var/log/iptables.log
if [ "$DISTRO" == "ubuntu" ] || [ "$DISTRO" == "debian" ] || [ "$DISTRO" == "raspbian" ]; then
sudo cp ./scripts/conf/15-iptables.conf /etc/rsyslog.d/
sudo chown root:root /etc/rsyslog.d/15-iptables.conf
sudo systemctl restart rsyslog
fi
## implement archlinux alternativ

4
scripts/subinstallers/openssl.sh

@ -8,7 +8,11 @@ CRT_PATH="$KEY_FOLDER/$CRT_FILE" @@ -8,7 +8,11 @@ CRT_PATH="$KEY_FOLDER/$CRT_FILE"
KEY_PATH="$KEY_FOLDER/$KEY_FILE"
# ensure openssl installed
if [ "$DISTRO" == "ubuntu" ] || [ "$DISTRO" == "debian" ] || [ "$DISTRO" == "raspbian" ]; then
sudo apt-get install -y openssl
elif [ "$DISTRO" == "arch" ]; then
sudo pacman -S --noconfirm openssl
fi
# make folder
mkdir -p $KEY_FOLDER

7
scripts/subinstallers/wireguard.sh

@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
figlet "Mistborn: Installing Wireguard"
# if wireguard not in current repositories
if [ "$DISTRO" == "ubuntu" ] || [ "$DISTRO" == "debian" ] || [ "$DISTRO" == "raspbian" ]; then
if ! $(sudo apt-cache show wireguard > /dev/null 2>&1) ; then
# install PPAs
@ -26,7 +27,13 @@ if ! $(sudo apt-cache show wireguard > /dev/null 2>&1) ; then @@ -26,7 +27,13 @@ if ! $(sudo apt-cache show wireguard > /dev/null 2>&1) ; then
sudo bash -c "printf 'Package: *\nPin: release a=unstable\nPin-Priority: 90\n' > /etc/apt/preferences.d/limit-unstable"
fi
fi
fi
echo "Installing Wireguard"
if [ "$DISTRO" == "ubuntu" ] || [ "$DISTRO" == "debian" ] || [ "$DISTRO" == "raspbian" ]; then
sudo apt-get update
sudo apt-get install -y openresolv wireguard
elif [ "$DISTRO" == "arch" ]; then
sudo pacman -Syyy
sudo pacman -S --noconfirm openresolv wireguard-lts wireguard-tools
fi

Loading…
Cancel
Save