From 36999ae60aa5d4b35ee4474437ba2308b84a98ba Mon Sep 17 00:00:00 2001 From: Steve Clement Date: Fri, 1 Mar 2019 10:19:32 +0530 Subject: [PATCH] chg: [installer] Level installer --- INSTALL/INSTALL.debian.sh | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/INSTALL/INSTALL.debian.sh b/INSTALL/INSTALL.debian.sh index fc37aee61..d2cf730c9 100755 --- a/INSTALL/INSTALL.debian.sh +++ b/INSTALL/INSTALL.debian.sh @@ -188,7 +188,7 @@ checkOpt () { setOpt () { options=() - for o in $@; do + for o in $@; do case "$o" in ("-c") echo "core"; CORE=1 ;; ("-V") echo "viper"; VIPER=1 ;; @@ -405,7 +405,7 @@ checkUsrLocalSrc () { echo "Good, /usr/local/src exists and is writeable as $MISP_USER" else # TODO: The below might be shorter, more elegant and more modern - #[[ -n $KALI ]] || [[ -n $UNATTENDED ]] && echo "Just do it" + #[[ -n $KALI ]] || [[ -n $UNATTENDED ]] && echo "Just do it" if [ "$KALI" == "1" -o "$UNATTENDED" == "1" ]; then ANSWER="y" else @@ -455,7 +455,7 @@ setBaseURL () { IP=`echo $CONN |awk {'print $2'}| cut -f1 -d/` if [[ $(checkManufacturer) != "innotek GmbH" ]]; then debug "We guess that this is a physical machine and cannot possibly guess what the MISP_BASEURL might be." - if [[ "$UNATTENDED" != "1" ]]; then + if [[ "$UNATTENDED" != "1" ]]; then echo "You can now enter your own MISP_BASEURL, if you wish to NOT do that, the MISP_BASEURL will be empty, which will work, but ideally you configure it afterwards." echo "Do you want to change it now? (y/n) " read ANSWER @@ -491,14 +491,14 @@ setBaseURL () { # Test and install software RNG installRNG () { sudo modprobe tpm-rng 2> /dev/null - if [ "$?" -eq "0" ]; then + if [ "$?" -eq "0" ]; then echo tpm-rng | sudo tee -a /etc/modules fi checkAptLock sudo apt install -qy rng-tools # This might fail on TPM grounds, enable the security chip in your BIOS sudo service rng-tools start - if [ "$?" -eq "1" ]; then + if [ "$?" -eq "1" ]; then sudo apt purge -qy rng-tools sudo apt install -qy haveged sudo /etc/init.d/haveged start @@ -592,11 +592,11 @@ installDeps () { # Skip dist-upgrade for now, pulls in 500+ updated packages #sudo apt -y dist-upgrade gitMail=$(git config --global --get user.email ; echo $?) - if [ "$?" -eq "1" ]; then + if [ "$?" -eq "1" ]; then git config --global user.email "root@kali.lan" fi gitUser=$(git config --global --get user.name ; echo $?) - if [ "$?" -eq "1" ]; then + if [ "$?" -eq "1" ]; then git config --global user.name "Root User" fi @@ -868,17 +868,6 @@ checkSudoKeeper () { fi } -runTests () { - sudo sed -i -E "s/url\ =\ (.*)/url\ =\ 'https:\/\/misp.local'/g" $PATH_TO_MISP/PyMISP/tests/testlive_comprehensive.py - sudo sed -i -E "s/key\ =\ (.*)/key\ =\ '${AUTH_KEY}'/g" $PATH_TO_MISP/PyMISP/tests/testlive_comprehensive.py - sudo chown -R www-data:www-data $PATH_TO_MISP/PyMISP/ - - sudo -H -u www-data sh -c "cd $PATH_TO_MISP/PyMISP && git submodule foreach git pull origin master" - sudo -H -u www-data ${PATH_TO_MISP}/venv/bin/pip install -e $PATH_TO_MISP/PyMISP/.[fileobjects,neo,openioc,virustotal,pdfexport] - sudo -H -u www-data git clone https://github.com/viper-framework/viper-test-files.git $PATH_TO_MISP/PyMISP/tests/viper-test-files - sudo -H -u www-data sh -c "cd $PATH_TO_MISP/PyMISP && ${PATH_TO_MISP}/venv/bin/python tests/testlive_comprehensive.py" -} - installCoreDeps () { debug "Installing core dependencies" # Install the dependencies: (some might already be installed) @@ -1082,7 +1071,7 @@ installCore () { installCake () { debug "Installing CakePHP" - # Once done, install CakeResque along with its dependencies + # Once done, install CakeResque along with its dependencies # if you intend to use the built in background jobs: cd ${PATH_TO_MISP}/app # Make composer cache happy @@ -1833,9 +1822,6 @@ installSupported () { [[ -n $MAIL2 ]] || [[ -n $ALL ]] && mail2misp progress 100 - # Run tests - runTests - # Run final script to inform the User what happened - functionLocation('generic/supportFunctions.md') theEnd } @@ -2118,7 +2104,7 @@ checkFlavour debug "Checking for parameters or Unattended Kali Install" if [[ $# == 0 && $0 != "/tmp/misp-kali.sh" ]]; then usage - exit + exit else debug "Setting install options with given parameters." # The setOpt/checkOpt function lives in generic/supportFunctions.md