From ea0d56695e3f13596b1269b2569ab2c6d054abd2 Mon Sep 17 00:00:00 2001 From: Paolo Vecchi Date: Wed, 8 Aug 2018 18:20:06 +0200 Subject: [PATCH] Update INSTALL.ubuntu1804.with.webmin.txt Fixed a few small things --- INSTALL/INSTALL.ubuntu1804.with.webmin.txt | 62 ++++++++++++++-------- 1 file changed, 40 insertions(+), 22 deletions(-) diff --git a/INSTALL/INSTALL.ubuntu1804.with.webmin.txt b/INSTALL/INSTALL.ubuntu1804.with.webmin.txt index 1e57be7c2..102b0d55d 100644 --- a/INSTALL/INSTALL.ubuntu1804.with.webmin.txt +++ b/INSTALL/INSTALL.ubuntu1804.with.webmin.txt @@ -1,6 +1,8 @@ INSTALLATION INSTRUCTIONS ------------------------- # For Ubuntu 18.04.1 server with Webmin +# Why Webmin/Virtualmin? +# Some may not be full time sysadmin and prefer a platform that once it has been setup works and is decently easy to manage. # Assuming you created the subdomanin misp.yourserver.tld to where MISP will be installed # and that the user "misp" is in the sudoers group @@ -22,8 +24,7 @@ chmod +x install.sh # Grab a coffee while it does its magic - -2/ Install LAMP & dependencies +2/ Configure basic Virtualmin environment ------------------------------ Once the system is installed you can perform the following steps: @@ -32,11 +33,15 @@ sudo apt-get install curl gcc git gnupg-agent make python openssl redis-server s # Stop MySQL and install MariaDB (a MySQL fork/alternative) # MariaDB will replace MySQL and it will work with the latests versions of Webmin without modifications -# WARNING: Databases and data may be lost! It is assumed you are installing on a new server with no existing DBs -# NOTE: at present a simple... -# sudo service mysql stop -# sudo apt-get install mariadb-client mariadb-server -# doesn't work well so with 18.04.1 you should do the following: +# WARNING: Databases and data will be lost! It is assumed you are installing on a new server with no existing DBs +# NOTE: at present, a simple... +# 'sudo service mysql stop && sudo apt-get install mariadb-client mariadb-server' +# ... doesn't work well with 18.04.1 so you should do the following: +sudo apt purge mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server-5.7 mysql-server-core-5.7 mysql-server +# Issues may crop up if you leave MySQL configuration there so remove also config files in /etc/mysql. +# Remove and cleanup packages +sudo apt autoremove && sudo apt -f install +# Add repositories for Mariadb 10.3 and install it sudo apt-get install software-properties-common sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8 sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://mariadb.mirrors.ovh.net/MariaDB/repo/10.3/ubuntu bionic main' @@ -47,9 +52,14 @@ sudo apt install mariadb-server # Secure the MariaDB installation (especially by setting a strong root password) if it hasn't been asked during the setup process. sudo mysql_secure_installation +# Go through the post-installation Wizard and configure your misp.yourdomain.tld virtual server +# That should create the misp user and related directories +# Add the misp user to the sudo group # Install PHP and dependencies sudo apt-get install libapache2-mod-php php php-cli php-gnupg php-dev php-json php-mysql php-opcache php-readline php-redis php-xml +sudo pear channel-update pear.php.net +sudo pear install Crypt_GPG # Apply all changes sudo systemctl restart apache2 @@ -57,7 +67,10 @@ sudo systemctl restart apache2 3/ MISP code ------------ # Assuming you created the subdomanin misp.yourserver.tld -# Download MISP using git in the /home/misp/public_html/. +# Download MISP using git in the /home/misp/public_html/ as misp + +sudo - misp +# or log out root and log back in as misp git clone https://github.com/MISP/MISP.git /home/misp/public_html/MISP cd /home/misp/public_html/MISP @@ -71,10 +84,10 @@ git submodule init git submodule update # Make git ignore filesystem permission differences -git config core.filemode false +git submodule foreach git config core.filemode false # install Mitre's STIX and its dependencies by running the following commands: -sudo apt-get install python3-dev python3-pip libxml2-dev libxslt1-dev zlib1g-dev python-setuptools +sudo apt-get install python3-dev python3-pip libxml2-dev libxslt1-dev zlib1g-dev python-setuptools python-pip cd /home/misp/public_html/MISP/app/files/scripts git clone https://github.com/CybOXProject/python-cybox.git git clone https://github.com/STIXProject/python-stix.git @@ -90,15 +103,15 @@ cd /home/misp/public_html/MISP/app/files/scripts/mixbox sudo python3 setup.py install # install PyMISP -cd /var/www/MISP/PyMISP +pip install jsonschema +cd /home/misp/public_html/MISP/PyMISP sudo python3 setup.py install 4/ CakePHP ----------- -# CakePHP is included as a submodule of MISP, execute the following commands to let git fetch it: -cd /home/misp/public_html/MISP +# CakePHP is included as a submodule of MISP -# Once done, install CakeResque along with its dependencies if you intend to use the built in background jobs: +# Install CakeResque along with its dependencies if you intend to use the built in background jobs: cd /home/misp/public_html/MISP/app php composer.phar require kamisama/cake-resque:4.1.2 php composer.phar config vendor-dir Vendor @@ -126,14 +139,17 @@ sudo chmod -R g+ws /home/misp/public_html/MISP/app/files/scripts/tmp # Enter the mysql shell sudo mysql -u root -p -MariaDB [(none)]> create database misp; -MariaDB [(none)]> grant usage on *.* to misp@localhost identified by 'XXXXdbpasswordhereXXXXX'; -MariaDB [(none)]> grant all privileges on misp.* to misp@localhost; -MariaDB [(none)]> flush privileges; -MariaDB [(none)]> exit +# If all went well when you created the misp user in Virtualmin you should already have a misp database +# otherwise create it with: +create database misp; +# Make sure password and all privileges are set +grant usage on *.* to misp@localhost identified by 'XXXXdbpasswordhereXXXXX'; +grant all privileges on misp.* to misp@localhost; +flush privileges; +exit # Import the empty MISP database from MYSQL.sql -sh -c "mysql -u misp -p misp < /home/misp/public_html/MISP/INSTALL/MYSQL.sql" +mysql -u misp -p misp < /home/misp/public_html/MISP/INSTALL/MYSQL.sql # enter the password you set previously @@ -194,7 +210,9 @@ vim /home/misp/public_html/MISP/app/Config/database.php # ); #} -# Important! Change the salt key in /var/www/MISP/app/Config/config.php +# Important! Change the salt key in /home/misp/public_html/MISP/app/Config/config.php +# see line 7 (may change) +# 'salt' => 'yoursaltkeyhere' # The salt key must be a string at least 32 bytes long. # The admin user account will be generated on the first login, make sure that the salt is changed before you create that user # If you forget to do this step, and you are still dealing with a fresh installation, just alter the salt, @@ -231,7 +249,7 @@ gpg --homedir /home/misp/public_html/MISP/.gnupg --gen-key # and return to the "install" shell # Export the public key to the webroot -sh -c "gpg --homedir /home/misp/public_html/MISP/.gnupg --export --armor YOUR-KEYS-EMAIL-HERE > /home/misp/public_html/MISP/app/webroot/gpg.asc" +gpg --homedir /home/misp/public_html/MISP/.gnupg --export --armor YOUR-KEYS-EMAIL-HERE > /home/misp/public_html/MISP/app/webroot/gpg.asc # To make the background workers start on boot chmod +x /home/misp/public_html/MISP/app/Console/worker/start.sh