Browse Source

reverted for bash shell

Bachir Soussi Chiadmi 4 years ago
parent
commit
faabe5d622
15 changed files with 56 additions and 56 deletions
  1. 4 4
      bin/_addUserSite.sh
  2. 2 2
      bin/autoupdate.sh
  3. 2 2
      bin/dotfiles.sh
  4. 3 3
      bin/email.sh
  5. 2 2
      bin/fail2ban.sh
  6. 2 2
      bin/firewall.sh
  7. 1 1
      bin/gitbarrerepos.sh
  8. 3 3
      bin/knockd.sh
  9. 23 23
      bin/lemp.sh
  10. 1 1
      bin/misc.sh
  11. 1 1
      bin/ssh.sh
  12. 2 2
      bin/user.sh
  13. 3 3
      bin/vhost.sh
  14. 3 3
      bin/zabbix.sh
  15. 4 4
      install.sh

+ 4 - 4
bin/_addUserSite.sh

@@ -11,7 +11,7 @@ echo -e '\033[35m
 / /_/ /___/ / /___/ _, _/
 \____//____/_____/_/ |_|
 \033[0m'
-echo "\033[35;1mCreate new user (you will be asked a user name and a password) \033[0m"
+echo -e "\033[35;1mCreate new user (you will be asked a user name and a password) \033[0m"
 sleep 3
 while [ "$user" = "" ]
 do
@@ -41,7 +41,7 @@ echo -e '\033[35m
 | |/ / / / / /_/ (__  ) /_
 |___/_/ /_/\____/____/\__/
 \033[0m'
-echo "\033[35;1mVHOST install \033[0m"
+echo -e "\033[35;1mVHOST install \033[0m"
 
 while [ "$_host_name" = "" ]
 do
@@ -75,7 +75,7 @@ ln -s /home/"$user"/logs /var/www/"$_host_name"/logs
 # a2ensite "$_host_name".conf
 #restart apache
 # service apache2 restart
-echo "\033[92;1mvhost $_host_name configured\033[Om"
+echo -e "\033[92;1mvhost $_host_name configured\033[Om"
 
 
 # todo add mysql user and database
@@ -88,7 +88,7 @@ echo -e '\033[35m
 /_/  /_/\__, /____/\__, /_/
        /____/        /_/
 \033[0m'
-echo "\033[35;1mMysql database \033[0m"
+echo -e "\033[35;1mMysql database \033[0m"
 
 while [ "$_dbname" = "" ]
 do

+ 2 - 2
bin/autoupdate.sh

@@ -16,7 +16,7 @@ if [ "$EUID" -ne 0 ]; then
   exit
 fi
 
-echo "\033[35;1mInstalling apticron \033[0m"
+echo -e "\033[35;1mInstalling apticron \033[0m"
 apt-get --yesinstall apticron
 
 sleep 3
@@ -27,4 +27,4 @@ sed -i -r "s/EMAIL=\"root\"/EMAIL=\"$email\"/g" /etc/apticron/apticron.conf
 # sed -i -r "s/# DIFF_ONLY=\"1\"/DIFF_ONLY=\"1\"/g" /etc/apticron/apticron.conf
 sed -i -r "s/# NOTIFY_NEW=\"0\"/NOTIFY_NEW=\"0\"/g" /etc/apticron/apticron.conf
 
-echo "\033[92;1mApticron installed and configured\033[0m"
+echo -e "\033[92;1mApticron installed and configured\033[0m"

+ 2 - 2
bin/dotfiles.sh

@@ -8,7 +8,7 @@ echo -e '\033[35m
 /_____/\____/\__/  /_/   /_/_/\___/____/
 \033[0m'
 #installing better prompt and some goodies
-echo "\033[35;1mInstalling shell prompt for current user $USER \033[0m"
+echo -e "\033[35;1mInstalling shell prompt for current user $USER \033[0m"
 sleep 2
 # get the current position
 _cwd="$(pwd)"
@@ -19,4 +19,4 @@ git clone https://figureslibres.io/gogs/bachir/dotfiles-server.git ~/.dotfiles-s
 source ~/.bashrc
 # return to working directory
 cd "$_cwd"
-echo "\033[92;1mDot files installed for $USER\033[0m"
+echo -e "\033[92;1mDot files installed for $USER\033[0m"

+ 3 - 3
bin/email.sh

@@ -7,7 +7,7 @@ echo -e '\033[35m
  / /  / / ___ |_/ // /___
 /_/  /_/_/  |_/___/_____/
 \033[0m'
-echo "\033[35;1mEnable mail sending for php \033[0m"
+echo -e "\033[35;1mEnable mail sending for php \033[0m"
 
 if [ "$EUID" -ne 0 ]; then
   echo "Please run as root"
@@ -29,7 +29,7 @@ fi
 # http://www.sycha.com/lamp-setup-debian-linux-apache-mysql-php#anchor13
 sleep 2
 apt-get --yesinstall exim4
-echo "\033[35;1mConfiguring EXIM4 \033[0m"
+echo -e "\033[35;1mConfiguring EXIM4 \033[0m"
 while [ "$configexim" != "y" ] && [ "$configexim" != "n" ]
 do
   echo -n "Should we configure exim4 ? [y|n] "
@@ -48,7 +48,7 @@ systemctl restart exim4
 
 # dkim spf
 # https://debian-administration.org/article/718/DKIM-signing_outgoing_mail_with_exim4
-echo "\033[35;1mConfiguring DKIM \033[0m"
+echo -e "\033[35;1mConfiguring DKIM \033[0m"
 while [ "$installdkim" != "y" ] && [ "$installdkim" != "n" ]
 do
   echo -n "Should we install dkim for exim4 ? [y|n] "

+ 2 - 2
bin/fail2ban.sh

@@ -9,7 +9,7 @@ echo -e '\033[35m
  / __/ / /_/ / / // __// /_/ / /_/ / / / /
 /_/    \__,_/_/_//____/_.___/\__,_/_/ /_/
 \033[0m'
-echo "\033[35;1mInstalling fall2ban \033[0m"
+echo -e "\033[35;1mInstalling fall2ban \033[0m"
 
 if [ "$EUID" -ne 0 ]; then
   echo "Please run as root"
@@ -23,4 +23,4 @@ cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
 touch /var/log/auth.log
 systemctl enable fail2ban
 systemctl restart fail2ban
-echo "\033[92;1mfail2ban installed and configured\033[Om"
+echo -e "\033[92;1mfail2ban installed and configured\033[Om"

+ 2 - 2
bin/firewall.sh

@@ -9,7 +9,7 @@ echo -e '\033[35m
  / __/ _/ // _, _/ /___  | |/ |/ / ___ |/ /___/ /___
 /_/   /___/_/ |_/_____/  |__/|__/_/  |_/_____/_____/
 \033[0m'
-echo "\033[35;1mInstalling ufw and setup firewall (allowing only ssh and http) \033[0m"
+echo -e "\033[35;1mInstalling ufw and setup firewall (allowing only ssh and http) \033[0m"
 
 if [ "$EUID" -ne 0 ]; then
   echo "Please run as root"
@@ -26,4 +26,4 @@ ufw allow https
 
 ufw enable
 ufw status verbose
-echo "\033[92;1mufw installed and firwall configured\033[Om"
+echo -e "\033[92;1mufw installed and firwall configured\033[Om"

+ 1 - 1
bin/gitbarrerepos.sh

@@ -11,7 +11,7 @@ echo -e '\033[35m
 / /_/ / / /_
 \____/_/\__/
 \033[0m'
-echo "\033[35;1mCreate new git barre repos and deploy script\033[0m"
+echo -e "\033[35;1mCreate new git barre repos and deploy script\033[0m"
 echo "Git barre repo will be installed in chosen user home directory"
 echo "git prod repos will be installed in public_html directory of provided domain, the domain have to exists as shortcut in chosen user/www before running this script. Please run first vhost.sh script and say yes to the question create a shortcut !"
 

+ 3 - 3
bin/knockd.sh

@@ -9,7 +9,7 @@ echo -e '\033[35m
  / ,< / / / / /_/ / /__/ ,< / /_/ /
 /_/|_/_/ /_/\____/\___/_/|_|\__,_/
 \033[0m'
-echo "\033[35;1mInstalling knockd to control ssh port opening\033[0m"
+echo -e "\033[35;1mInstalling knockd to control ssh port opening\033[0m"
 
 if [ "$EUID" -ne 0 ]; then
   echo "Please run as root"
@@ -50,7 +50,7 @@ Alias=knockd.service" >> /lib/systemd/system/knockd.service
 systemctl enable knockd
 systemctl start knockd
 
-echo "\033[92;1mknockd installed and configured\033[Om"
-echo "\033[92;1mplease note this sequence for future ssh knocking\033[Om"
+echo -e "\033[92;1mknockd installed and configured\033[Om"
+echo -e "\033[92;1mplease note this sequence for future ssh knocking\033[Om"
 echo "$sq"
 sleep 3

+ 23 - 23
bin/lemp.sh

@@ -8,7 +8,7 @@ echo -e '\033[35m
 /_/\___/_/ /_/ /_/ .___/
                 /_/
 \033[0m'
-echo "\033[35;1mLEMP server (Nginx Mysql Php-fpm) \033[0m"
+echo -e "\033[35;1mLEMP server (Nginx Mysql Php-fpm) \033[0m"
 
 if [ "$EUID" -ne 0 ]; then
   echo "Please run as root"
@@ -37,7 +37,7 @@ echo -e '\033[35m
 /_/  /_/\__, /____/\__, /_/
        /____/        /_/
 \033[0m'
-echo "\033[35;1minstalling Mysql \033[0m"
+echo -e "\033[35;1minstalling Mysql \033[0m"
 sleep 3
 apt-get --yesinstall mariadb-server
 mysql_secure_installation
@@ -46,7 +46,7 @@ cp "$_assets"/mysql/innodb-file-per-table.cnf /etc/mysql/conf.d/
 
 systemctl enable mariadb.service
 systemctl restart mariadb.service
-echo "\033[92;1mmysql installed\033[Om"
+echo -e "\033[92;1mmysql installed\033[Om"
 
 echo -e '\033[35m
     ____  __  ______
@@ -55,7 +55,7 @@ echo -e '\033[35m
  / ____/ __  / ____/
 /_/   /_/ /_/_/
 \033[0m'
-echo "\033[35;1mInstalling PHP 7.0 \033[0m"
+echo -e "\033[35;1mInstalling PHP 7.0 \033[0m"
 sleep 3
 apt-get --yesinstall php7.0-fpm php7.0-mysql php7.0-opcache php7.0-curl php7.0-mbstring php7.0-zip php7.0-xml php7.0-gd php7.0-mcrypt php-memcached php7.0-imagick
 
@@ -78,7 +78,7 @@ systemctl start php7.0-fpm
 #
 # systemctl start memcached
 
-echo "\033[92;1mphp installed\033[Om"
+echo -e "\033[92;1mphp installed\033[Om"
 
 echo -e '\033[35m
     _   __      _
@@ -88,7 +88,7 @@ echo -e '\033[35m
 /_/ |_/\__, /_/_/ /_/_/|_|
       /____/
 \033[0m'
-echo "\033[35;1mInstalling Nginx \033[0m"
+echo -e "\033[35;1mInstalling Nginx \033[0m"
 sleep 3
 apt-get --yesinstall nginx
 mv /etc/nginx/sites-available/default /etc/nginx/sites-available/default.ori
@@ -96,7 +96,7 @@ cp "$_assets"/default.nginxconf /etc/nginx/sites-available/default
 
 systemctl enable nginx
 systemctl restart nginx
-echo "\033[92;1mNginx installed\033[Om"
+echo -e "\033[92;1mNginx installed\033[Om"
 
 echo -e '\033[35m
            __          __  ___      ___       __          _
@@ -106,21 +106,21 @@ echo -e '\033[35m
  / .___/_/ /_/ .___/_/  /_/\__, /_/  |_\__,_/_/ /_/ /_/_/_/ /_/
 /_/         /_/           /____/
 \033[0m'
-echo "\033[35;1mInstalling phpMyAdmin \033[0m"
+echo -e "\033[35;1mInstalling phpMyAdmin \033[0m"
 apt-get --yesinstall phpmyadmin
 ln -s /usr/share/phpmyadmin /var/www/html/
 cp "$_assets"/nginx-phpmyadmin.conf > /etc/nginx/sites-available/phpmyadmin.conf
 ln -s /etc/nginx/sites-available/phpmyadmin.conf /etc/nginx/sites-enabled/phpmyadmin.conf
 
-# echo "\033[35;1msecuring phpMyAdmin \033[0m"
+# echo -e "\033[35;1msecuring phpMyAdmin \033[0m"
 # sed -i "s/DirectoryIndex index.php/DirectoryIndex index.php\nAllowOverride all/"
 # cp "$_assets"/phpmyadmin_htaccess > /usr/share/phpmyadmin/.htaccess
 # echo -n "define a user name for phpmyadmin : "
 # read un
 # htpasswd -c /etc/phpmyadmin/.htpasswd $un
 # service apache2 restart
-echo "\033[92;1mphpMyAdmin installed\033[Om"
-echo "\033[92;1mYou can access it at yourip/phpmyadmin\033[Om"
+echo -e "\033[92;1mphpMyAdmin installed\033[Om"
+echo -e "\033[92;1mYou can access it at yourip/phpmyadmin\033[Om"
 
 echo -e '\033[35m
     ____           ___
@@ -129,7 +129,7 @@ echo -e '\033[35m
  / _, _/  __/ /_/ / (__  )
 /_/ |_|\___/\__,_/_/____/
 \033[0m'
-echo "\033[35;1mInstalling Redis \033[0m"
+echo -e "\033[35;1mInstalling Redis \033[0m"
 sleep 3
 apt-get --yesinstall redis-server php-redis
 
@@ -141,7 +141,7 @@ apt-get --yesinstall redis-server php-redis
 systemctl enable redis-server
 systemctl restart redis-server
 systemctl restart php7.0-fpm
-echo "\033[92;1mRedis installed\033[Om"
+echo -e "\033[92;1mRedis installed\033[Om"
 
 echo -e '\033[35m
    ______
@@ -151,12 +151,12 @@ echo -e '\033[35m
 \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                     /_/
 \033[0m'
-echo "\033[35;1mInstalling Composer \033[0m"
+echo -e "\033[35;1mInstalling Composer \033[0m"
 sleep 3
 export COMPOSER_HOME=/usr/local/composer
 curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
 
-echo "\033[92;1mComposer installed\033[Om"
+echo -e "\033[92;1mComposer installed\033[Om"
 
 
 echo -e '\033[35m
@@ -166,13 +166,13 @@ echo -e '\033[35m
  / /_/ / /  / /_/ (__  ) / / /
 /_____/_/   \__,_/____/_/ /_/
 \033[0m'
-echo "\033[35;1mInstalling Drush and DrupalConsole\033[0m"
+echo -e "\033[35;1mInstalling Drush and DrupalConsole\033[0m"
 sleep 3
 curl https://drupalconsole.com/installer -L -o /usr/local/bin/drupal
 chmod +x /usr/local/bin/drupal
 curl https://github.com/drush-ops/drush-launcher/releases/download/0.6.0/drush.phar -L -o /usr/local/bin/drush
 chmod +x /usr/local/bin/drush
-echo "\033[92;1mDrush and DrupalConsoleinstalled\033[Om"
+echo -e "\033[92;1mDrush and DrupalConsoleinstalled\033[Om"
 
 
 
@@ -183,7 +183,7 @@ echo "\033[92;1mDrush and DrupalConsoleinstalled\033[Om"
 #  / /|_/ / _ \/ _ \/ / __/ _/_/  / /|_/ / // / _ \/ / _ \
 # /_/  /_/\___/_//_/_/\__/ /_/   /_/  /_/\_,_/_//_/_/_//_/
 # \033[0m'
-# echo "\033[35;1mInstalling Munin \033[0m"
+# echo -e "\033[35;1mInstalling Munin \033[0m"
 # sleep 3
 # # https://www.howtoforge.com/tutorial/server-monitoring-with-munin-and-monit-on-debian/
 # apt-get --yesinstall munin munin-node munin-plugins-extra
@@ -220,9 +220,9 @@ echo "\033[92;1mDrush and DrupalConsoleinstalled\033[Om"
 #
 # service apache2 restart
 # service munin-node restart
-# echo "\033[92;1mMunin installed\033[Om"
+# echo -e "\033[92;1mMunin installed\033[Om"
 #
-# echo "\033[35;1mInstalling Monit \033[0m"
+# echo -e "\033[35;1mInstalling Monit \033[0m"
 # sleep 3
 # # https://www.howtoforge.com/tutorial/server-monitoring-with-munin-and-monit-on-debian/2/
 # apt-get --yesinstall monit
@@ -253,7 +253,7 @@ echo "\033[92;1mDrush and DrupalConsoleinstalled\033[Om"
 #
 # service monit start
 #
-# echo "\033[92;1mMonit installed\033[Om"
+# echo -e "\033[92;1mMonit installed\033[Om"
 
 
 # echo -e '\033[35m
@@ -263,7 +263,7 @@ echo "\033[92;1mDrush and DrupalConsoleinstalled\033[Om"
 #  / ___ | |/ |/ (__  ) /_/ /_/ / /_
 # /_/  |_|__/|__/____/\__/\__,_/\__/
 # \033[0m'
-# echo "\033[35;1mInstalling Awstat \033[0m"
+# echo -e "\033[35;1mInstalling Awstat \033[0m"
 # sleep 3
 # apt-get --yesinstall awstats
 # # Configure AWStats
@@ -273,4 +273,4 @@ echo "\033[92;1mDrush and DrupalConsoleinstalled\033[Om"
 # fi
 # # Disable Awstats from executing every 10 minutes. Put a hash in front of any line.
 # sed -i 's/^[^#]/#&/' /etc/cron.d/awstats
-# echo "\033[92;1mAwstat installed\033[Om"
+# echo -e "\033[92;1mAwstat installed\033[Om"

+ 1 - 1
bin/misc.sh

@@ -28,4 +28,4 @@ apt-get --yesinstall tmux etckeeper needrestart htop lynx unzip
 
 
 
-echo "\033[92;1mMisc done \033[Om"
+echo -e "\033[92;1mMisc done \033[Om"

+ 1 - 1
bin/ssh.sh

@@ -18,4 +18,4 @@ sed -i 's/PermitRootLogin\ yes/PermitRootLogin no/g' /etc/ssh/sshd_config
 sed -i 's/PermitEmptyPasswords\ yes/PermitEmptyPasswords no/g' /etc/ssh/sshd_config
 sed -i 's/Protocol\ [0-9]/Protocol 2/g' /etc/ssh/sshd_config
 systemctl reload ssh
-echo "\033[92;1mSSH secured\033[Om"
+echo -e "\033[92;1mSSH secured\033[Om"

+ 2 - 2
bin/user.sh

@@ -7,7 +7,7 @@ echo -e '\033[35m
 / /_/ /___/ / /___/ _, _/
 \____//____/_____/_/ |_|
 \033[0m'
-echo "\033[35;1mCreate new user (you will be asked a user name and a password) \033[0m"
+echo -e "\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"
@@ -50,4 +50,4 @@ groupadd admin
 usermod -a -G admin "$user"
 # allow admin group to su
 dpkg-statoverride --update --add root admin 4750 /bin/su
-echo "\033[92;1muser $user configured\033[Om"
+echo -e "\033[92;1muser $user configured\033[Om"

+ 3 - 3
bin/vhost.sh

@@ -6,7 +6,7 @@ echo -e '\033[35m
 | |/ / / / / /_/ (__  ) /_
 |___/_/ /_/\____/____/\__/
 \033[0m'
-echo "\033[35;1mNginx VHOST install \033[0m"
+echo -e "\033[35;1mNginx VHOST install \033[0m"
 while [ "$vh" != "y" ] && [ "$vh" != "n" ]
 do
   echo -n "Should we install a vhost? [y|n] "
@@ -50,7 +50,7 @@ if [ "$vh" = "y" ]; then
   # ask for let's encrypt
   while [ "$_letsencrypt" != "yes" ] && [ "$_letsencrypt" != "no" ]
   do
-    echo "\033[35;1mLet's encrypt \033[0m"
+    echo -e "\033[35;1mLet's encrypt \033[0m"
     echo "Let's encrypt needs a public registered domain name with proper DNS records ( A records or CNAME records for subdomains pointing to your server)."
     echo -n "Should we install let's encrypt certificate with $_domain? [yes|no] "
     read _letsencrypt
@@ -147,7 +147,7 @@ if [ "$vh" = "y" ]; then
 
   # restart nginx
   systemctl start nginx
-  echo "\033[92;1mvhost $_domain configured \033[Om"
+  echo -e "\033[92;1mvhost $_domain configured \033[Om"
 else
   echo "Vhost installation aborted"
 fi

+ 3 - 3
bin/zabbix.sh

@@ -112,6 +112,6 @@ ufw allow from "$_ip" to any port 22
 systemctl restart zabbix-agent
 systemctl enable zabbix-agent
 
-echo "\033[92;1mZabbix-agent installed and configured, please add the host $_host_name in your zabbix-server \033[Om"
-echo "\033[92;1mAnd import requested templates in assets/zabbix/templates/ \033[Om"
-echo "\033[92;1mzabbix user mysql password is $_passwd \033[Om"
+echo -e "\033[92;1mZabbix-agent installed and configured, please add the host $_host_name in your zabbix-server \033[Om"
+echo -e "\033[92;1mAnd import requested templates in assets/zabbix/templates/ \033[Om"
+echo -e "\033[92;1mzabbix user mysql password is $_passwd \033[Om"

+ 4 - 4
install.sh

@@ -13,7 +13,7 @@ echo -e '\033[35m
 /_____/\___/_.___/_/\__,_/_/ /_/   /____/\___/_/    |___/\___/_/
 
 \033[0m'
-echo "\033[35;1mThis script has been tested only on Linux Debian 10 \033[0m"
+echo -e "\033[35;1mThis script has been tested only on Linux Debian 10 \033[0m"
 
 if [[ $EUID -ne 0 ]]; then
   echo "Please run as root"
@@ -156,14 +156,14 @@ fi
 #   # Remove old tmp dir
 #   rm -rf /var/tmpbackup
 
-#   echo "\033[35;1m /tmp and /var/tmp secured using tmpfs. \033[0m"
+#   echo -e "\033[35;1m /tmp and /var/tmp secured using tmpfs. \033[0m"
 # } # End function secure_tmp_tmpfs
 
 # check_tmp_secured
 # if [ $? = 0  ]; then
 #     secure_tmp_tmpfs
 # else
-#     echo "\033[35;1mFunction canceled. /tmp already secured. \033[0m"
+#     echo -e "\033[35;1mFunction canceled. /tmp already secured. \033[0m"
 # fi
 
 # TODO add warning message on ssh connection if system needs updates
@@ -179,4 +179,4 @@ echo -e '\033[35m
 /  __/ / / / /_/ /
 \___/_/ /_/\__,_/
 \033[0m'
-echo "\033[35;1m* * script done * * \033[0m"
+echo -e "\033[35;1m* * script done * * \033[0m"