From bf8792c3b9ca591aa77e4a92f1fa99d7c7800766 Mon Sep 17 00:00:00 2001 From: George Liu Date: Fri, 16 Sep 2016 07:27:33 +1000 Subject: [PATCH] update dynamic dmotd.sh banner to support 2 new variables in 123.09beta01 [CODEB] ENABLEMOTD_CSFMSG='y' # motd banner csf message alert disaply ENABLEMOTD_LINKSMSG='y' # motd centminmod.com links bookmark alert display [/CODEB] When you log into Centmin Mod 123.09beta01 you get a motd banner with stats and csf firewall warning alert and links to bookmark at centminmod.com. These 2 variables when set in persistent config file /etc/centminmod/custom_config.inc can disable the CSF Firewall and Bookmark links part of the motd banner display. --- config/motd/dmotd.sh | 16 ++++++++++++++-- example/custom_config.inc | 3 +++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/config/motd/dmotd.sh b/config/motd/dmotd.sh index 83210c523..b4e6f722b 100755 --- a/config/motd/dmotd.sh +++ b/config/motd/dmotd.sh @@ -14,6 +14,7 @@ RELEASE=$(cat /etc/redhat-release | sed -e 's| (Core)||' -e 's| release||') PSA=$(ps -Afl | wc -l) CURRENTUSER=$(users | wc -w) CMSCRIPT_GITDIR='/usr/local/src/centminmod' +CONFIGSCANBASE='/etc/centminmod' ########################################################### # Setup Colours black='\E[30;40m' @@ -48,6 +49,11 @@ return } ########################################################### +if [ -f "${CONFIGSCANBASE}/custom_config.inc" ]; then + # default is at /etc/centminmod/custom_config.inc + source "${CONFIGSCANBASE}/custom_config.inc" +fi + # time of day HOUR=$(date +"%H") if [ $HOUR -lt 12 -a $HOUR -ge 0 ] @@ -87,12 +93,17 @@ echo " $MEM =============================================================================== $DF -=============================================================================== +" +if [[ "$ENABLEMOTD_CSFMSG" != [nN] ]]; then +echo "=============================================================================== ! This server maybe running CSF Firewall ! DO NOT run the below command or you will lock yourself out of the server: iptables -F - +" +fi +if [[ "$ENABLEMOTD_LINKSMSG" != [nN] ]]; then +echo " =============================================================================== * Getting Started Guide - http://centminmod.com/getstarted.html * Centmin Mod FAQ - http://centminmod.com/faq.html @@ -100,6 +111,7 @@ $DF * Community Forums https://community.centminmod.com [ << Register ] =============================================================================== " +fi } diff --git a/example/custom_config.inc b/example/custom_config.inc index 144a7b005..62b0b2f03 100644 --- a/example/custom_config.inc +++ b/example/custom_config.inc @@ -13,6 +13,9 @@ PUSHOVER_EMAIL='' # Signup pushover.net push email notifications to mobile & tab CMGIT='https://github.com/centminmod/centminmod.git' AUTO_GITUPDATE='n' +ENABLEMOTD_CSFMSG='y' # motd banner csf message alert disaply +ENABLEMOTD_LINKSMSG='y' # motd centminmod.com links bookmark alert display + # Clang & GCC Compilers CLANG='y' # Nginx and LibreSSL CLANG_PHP='n' # PHP