#!/bin/bash #################################################### CONFIGURATION ### BUILD=202112181 PASS=$(openssl rand -base64 32|sha256sum|base64|head -c 32| tr '[:upper:]' '[:lower:]') DBPASS=$(openssl rand -base64 24|sha256sum|base64|head -c 32| tr '[:upper:]' '[:lower:]') SERVERID=$(openssl rand -base64 12|sha256sum|base64|head -c 32| tr '[:upper:]' '[:lower:]') REPO=yolanmees/Spikster if [ -z "$1" ]; BRANCH=latest then BRANCH=$1 fi #################################################### CLI TOOLS ### reset=$(tput sgr0) bold=$(tput bold) underline=$(tput smul) black=$(tput setaf 0) white=$(tput setaf 7) red=$(tput setaf 1) green=$(tput setaf 2) yellow=$(tput setaf 3) blue=$(tput setaf 4) purple=$(tput setaf 5) bgblack=$(tput setab 0) bgwhite=$(tput setab 7) bgred=$(tput setab 1) bggreen=$(tput setab 2) bgyellow=$(tput setab 4) bgblue=$(tput setab 4) bgpurple=$(tput setab 5) #################################################### Spikster SETUP ###### # LOGO clear echo "${green}${bold}" echo "" echo "███████╗██████╗ ██╗██╗ ██╗███████╗████████╗███████╗██████╗ " echo "██╔════╝██╔══██╗██║██║ ██╔╝██╔════╝╚══██╔══╝██╔════╝██╔══██╗" echo "███████╗██████╔╝██║█████╔╝ ███████╗ ██║ █████╗ ██████╔╝" echo "╚════██║██╔═══╝ ██║██╔═██╗ ╚════██║ ██║ ██╔══╝ ██╔══██╗" echo "███████║██║ ██║██║ ██╗███████║ ██║ ███████╗██║ ██║" echo "╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚══════╝╚═╝ ╚═╝" echo "Installation has been started... Hold on!" echo "${reset}" sleep 3s # BASIC SETUP clear clear echo "${bggreen}${black}${bold}" echo "Base setup..." echo "${reset}" sleep 1s apt-get update apt-get -y install software-properties-common curl wget nano vim rpl sed zip unzip openssl expect dirmngr apt-transport-https lsb-release ca-certificates dnsutils dos2unix zsh htop ffmpeg # GET IP clear clear echo "${bggreen}${black}${bold}" echo "Getting IP..." echo "${reset}" sleep 1s IP=$(curl -s https://checkip.amazonaws.com) # MOTD WELCOME MESSAGE clear echo "${bggreen}${black}${bold}" echo "Motd settings..." echo "${reset}" sleep 1s WELCOME=/etc/motd touch $WELCOME cat > "$WELCOME" < "$JAIL" < "$PHPINI" < "$NGINX" < "$NODE" < $CIPIBULD < $CIPIPING < $PUBKEYGH <> /usr/lib/systemd/system/user@.service echo 'DefaultStartLimitBurst=50' >> /usr/lib/systemd/system/user@.service echo 'StartLimitBurst=0' >> /usr/lib/systemd/system/user@.service systemctl daemon-reload TASK=/etc/cron.d/cipi.crontab touch $TASK cat > "$TASK" < /proc/sys/vm/drop_caches && swapoff -a && swapon -a * * * * * cd /var/www/html && php artisan schedule:run >> /dev/null 2>&1 5 2 * * * cd /var/www/html/utility/cipi-update && sh run.sh >> /dev/null 2>&1 EOF crontab $TASK systemctl restart nginx.service rpl -i -w "#PasswordAuthentication" "PasswordAuthentication" /etc/ssh/sshd_config rpl -i -w "# PasswordAuthentication" "PasswordAuthentication" /etc/ssh/sshd_config rpl -i -w "PasswordAuthentication no" "PasswordAuthentication yes" /etc/ssh/sshd_config rpl -i -w "PermitRootLogin yes" "PermitRootLogin no" /etc/ssh/sshd_config service sshd restart TASK=/etc/supervisor/conf.d/cipi.conf touch $TASK cat > "$TASK" <