diff --git a/bin/email.sh b/bin/email.sh index 0ba1b78..00edd17 100644 --- a/bin/email.sh +++ b/bin/email.sh @@ -9,10 +9,13 @@ echo '\033[35m \033[0m' echo "\033[35;1mEnable mail sending for php \033[0m" -# TODO check if root +if [ "$EUID" -ne 0 ] + then echo "Please run as root" + exit +fi # http://www.sycha.com/lamp-setup-debian-linux-apache-mysql-php#anchor13 -sleep 3 +sleep 2 apt-get --yes --force-yes install exim4 echo "\033[35;1mConfiguring EXIM4 \033[0m" while [ "$configexim" != "y" ] && [ "$configexim" != "n" ] diff --git a/bin/fail2ban.sh b/bin/fail2ban.sh index f02f11e..0f18144 100644 --- a/bin/fail2ban.sh +++ b/bin/fail2ban.sh @@ -10,6 +10,13 @@ echo '\033[35m /_/ \__,_/_/_//____/_.___/\__,_/_/ /_/ \033[0m' echo "\033[35;1mInstalling fall2ban \033[0m" + +if [ "$EUID" -ne 0 ] + then echo "Please run as root" + exit +fi + +sleep 2 apt-get --yes --force-yes install fail2ban cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local # ToDo ask for email and configure jail.local with it diff --git a/bin/firewall.sh b/bin/firewall.sh index 7620e07..874d7dd 100644 --- a/bin/firewall.sh +++ b/bin/firewall.sh @@ -10,7 +10,13 @@ echo '\033[35m /_/ /___/_/ |_/_____/ |__/|__/_/ |_/_____/_____/ \033[0m' echo "\033[35;1mInstalling ufw and setup firewall (allowing only ssh and http) \033[0m" -sleep 3 + +if [ "$EUID" -ne 0 ] + then echo "Please run as root" + exit +fi + +sleep 2 apt-get --yes --force-yes install ufw # ufw allow ssh # knockd will open the ssh port ufw allow http diff --git a/bin/knockd.sh b/bin/knockd.sh index e55cf6f..d681f12 100644 --- a/bin/knockd.sh +++ b/bin/knockd.sh @@ -10,7 +10,13 @@ echo '\033[35m /_/|_/_/ /_/\____/\___/_/|_|\__,_/ \033[0m' echo "\033[35;1mInstalling knockd to control ssh port opening\033[0m" -sleep 3 + +if [ "$EUID" -ne 0 ] + then echo "Please run as root" + exit +fi + +sleep 2 apt-get --yes --force-yes install knockd mv /etc/knockd.conf /etc/knockd.conf.ori diff --git a/bin/lemp.sh b/bin/lemp.sh index e7c9d34..60a35cf 100644 --- a/bin/lemp.sh +++ b/bin/lemp.sh @@ -8,14 +8,15 @@ echo '\033[35m /_/\___/_/ /_/ /_/ .___/ /_/ \033[0m' -echo "\033[35;1mLEMP server (Nginx Mysql Php) \033[0m" -sleep 3 +echo "\033[35;1mLEMP server (Nginx Mysql Php-fpm) \033[0m" if [ "$EUID" -ne 0 ] then echo "Please run as root" exit fi +sleep 2 + echo '\033[35m __ ___ __ / |/ /_ ___________ _/ / diff --git a/bin/misc.sh b/bin/misc.sh index 67f357e..13ab4b6 100644 --- a/bin/misc.sh +++ b/bin/misc.sh @@ -10,8 +10,15 @@ echo '\033[35m /_/ /_/_/____/\___/ \033[0m' + +if [ "$EUID" -ne 0 ] + then echo "Please run as root" + exit +fi +sleep 2 apt-get --yes --force-yes install vim curl sed -i "s/^# en_GB.UTF-8/en_GB.UTF-8/g" /etc/locale.gen locale-gen apt-get --yes --force-yes install ntp dpkg-reconfigure tzdata +apt-get --yes --force-yes install needrestart diff --git a/bin/upgrade.sh b/bin/upgrade.sh index b4d1e8c..3d84fcc 100644 --- a/bin/upgrade.sh +++ b/bin/upgrade.sh @@ -9,5 +9,12 @@ echo '\033[35m / /_/ / ____/ /_/ / _, _/ ___ |/ /_/ / /___ \____/_/ \____/_/ |_/_/ |_/_____/_____/ \033[0m' + +if [ "$EUID" -ne 0 ] + then echo "Please run as root" + exit +fi + apt-get update apt-get dist-upgrade +needrestart -rl diff --git a/bin/user.sh b/bin/user.sh index a6dffc5..25cbc64 100644 --- a/bin/user.sh +++ b/bin/user.sh @@ -8,6 +8,12 @@ echo '\033[35m \____//____/_____/_/ |_| \033[0m' echo "\033[35;1mCreate new user (you will be asked a user name and a password) \033[0m" + +if [ "$EUID" -ne 0 ] + then echo "Please run as root" + exit +fi + sleep 3 # TODO check if root