added fail2ban restart and new addUserSite.sh script

This commit is contained in:
Bachir Soussi Chiadmi 2017-06-27 11:00:49 +02:00
parent 0d13bcc677
commit 63a0a1ac02
2 changed files with 51 additions and 0 deletions

View File

@ -26,10 +26,13 @@ fi
done done
adduser "$user" adduser "$user"
mkdir /home/$user/logs mkdir /home/$user/logs
mkdir /home/$user/public_html mkdir /home/$user/public_html
mkdir /home/$user/backups mkdir /home/$user/backups
chmod -w /home/"$user"
echo '\033[35m echo '\033[35m
__ __ __ __
_ __/ /_ ____ _____/ /_ _ __/ /_ ____ _____/ /_
@ -73,3 +76,50 @@ a2ensite "$_host_name".conf
#restart apache #restart apache
service apache2 restart service apache2 restart
echo "\033[92;1mvhost $_host_name configured\033[Om" echo "\033[92;1mvhost $_host_name configured\033[Om"
# todo add mysql user and database
echo '\033[35m
__ ___ __
/ |/ /_ ___________ _/ /
/ /|_/ / / / / ___/ __ `/ /
/ / / / /_/ (__ ) /_/ / /
/_/ /_/\__, /____/\__, /_/
/____/ /_/
\033[0m'
echo "\033[35;1mMysql database \033[0m"
while [ "$_dbname" = "" ]
do
read -p "enter a database name ? " _dbname
if [ "$_dbname" != "" ]; then
read -p "is database name $_dbname correcte [y|n] " validated
if [ "$validated" = "y" ]; then
break
else
_dbname=""
fi
fi
done
passok=0
while [ "$passok" = "0" ]
do
echo -n "Write database password for $user"
read passwda
echo -n "confirm password"
read passwdb
if [ "$passwda" = "$passwdb" ]; then
$_pswd=$passwda
passok=1
else
echo "pass words don't match, please try again"
fi
done
# mysql> create user '$_dbname'@'localhost' identified by '$_pswd';
# mysql> create database $_dbname;
# mysql> grant all privileges on esadhar_eval.* to 'esadhar_eval'@'localhost';
# mysql> flush privileges;

View File

@ -87,6 +87,7 @@ echo '\033[35m
echo "\033[35;1mInstalling fall2ban \033[0m" echo "\033[35;1mInstalling fall2ban \033[0m"
apt-get install fail2ban apt-get install fail2ban
cat "$_cwd"/assets/fail2ban.jail.conf > /etc/fail2ban/jail.conf cat "$_cwd"/assets/fail2ban.jail.conf > /etc/fail2ban/jail.conf
service fail2ban restart
echo "\033[92;1mfail2ban installed and configured\033[Om" echo "\033[92;1mfail2ban installed and configured\033[Om"
echo '\033[35m echo '\033[35m