added root check and needrestart check

This commit is contained in:
Bachir Soussi Chiadmi 2018-04-07 11:23:02 +02:00
parent 0e81a4ab11
commit c1eefcd6fc
8 changed files with 49 additions and 6 deletions

View File

@ -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" ]

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
__ ___ __
/ |/ /_ ___________ _/ /

View File

@ -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

View File

@ -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

View File

@ -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