2011-11-26 10:45:31 +01:00
|
|
|
INSTALLATION INSTRUCTIONS
|
2015-02-02 13:12:15 +01:00
|
|
|
------------------------- for ubuntu 14.04-server
|
2013-03-29 19:47:59 +01:00
|
|
|
|
|
|
|
1/ Minimal ubuntu install
|
2011-11-26 10:45:31 +01:00
|
|
|
-------------------------
|
2014-08-02 09:16:16 +02:00
|
|
|
|
2015-02-02 13:12:15 +01:00
|
|
|
Install a minimal ubuntu 14.04-server system with the software:
|
2016-02-02 17:30:55 +01:00
|
|
|
|
2013-03-29 19:47:59 +01:00
|
|
|
- OpenSSH server
|
2014-08-02 09:16:16 +02:00
|
|
|
- LAMP server (don't forget php5-mysql)
|
2013-03-29 19:47:59 +01:00
|
|
|
- Mail server
|
|
|
|
|
|
|
|
You will get some questions, you will probably want to set:
|
2015-03-13 13:42:11 +01:00
|
|
|
sudo apt-get install postfix
|
2013-03-29 19:47:59 +01:00
|
|
|
- Postfix Configuration: Satellite system
|
|
|
|
|
|
|
|
Make sure your system is up2date:
|
|
|
|
apt-get update
|
|
|
|
apt-get upgrade
|
|
|
|
|
|
|
|
|
2014-02-11 15:54:46 +01:00
|
|
|
2/ Dependencies *
|
2013-03-29 19:47:59 +01:00
|
|
|
----------------
|
|
|
|
Once the system is installed you can perform the following steps as root:
|
|
|
|
|
|
|
|
# Because vim is just so practical
|
|
|
|
apt-get install vim
|
|
|
|
|
2014-02-11 15:54:46 +01:00
|
|
|
# Install the dependencies:
|
2017-02-15 17:27:03 +01:00
|
|
|
apt-get install gcc zip php-pear git redis-server make python-dev python-pip libxml2-dev libxslt1-dev zlib1g-dev php5-dev php5-xml libapache2-mod-php5 php5-mysql php5-json php5-redis curl gnupg-agent
|
2016-06-04 01:10:45 +02:00
|
|
|
pear install Crypt_GPG # we need version >1.3.0
|
2014-02-11 15:54:46 +01:00
|
|
|
|
|
|
|
3/ MISP code
|
|
|
|
------------
|
2016-06-04 01:10:45 +02:00
|
|
|
# Download MISP using git in the /var/www/ directory.
|
2016-07-11 02:19:20 +02:00
|
|
|
mkdir /var/www/MISP
|
|
|
|
cd /var/www/MISP
|
|
|
|
git clone https://github.com/MISP/MISP.git /var/www/MISP
|
|
|
|
git checkout tags/$(git describe --tags `git rev-list --tags --max-count=1`)
|
|
|
|
# if the last shortcut doesn't work, specify the latest version manually
|
|
|
|
# example: git checkout tags/v2.4.XY
|
|
|
|
# the message regarding a "detached HEAD state" is expected behaviour
|
|
|
|
# (you only have to create a new branch, if you want to change stuff and do a pull request for example)
|
2014-02-11 15:54:46 +01:00
|
|
|
|
|
|
|
# Make git ignore filesystem permission differences
|
|
|
|
git config core.filemode false
|
|
|
|
|
2014-10-07 17:53:22 +02:00
|
|
|
# install Mitre's STIX and its dependencies by running the following commands:
|
|
|
|
apt-get install python-dev python-pip libxml2-dev libxslt-dev zlib1g-dev
|
|
|
|
cd /var/www/MISP/app/files/scripts
|
|
|
|
git clone https://github.com/CybOXProject/python-cybox.git
|
|
|
|
git clone https://github.com/STIXProject/python-stix.git
|
2014-10-20 14:44:03 +02:00
|
|
|
cd /var/www/MISP/app/files/scripts/python-cybox
|
2016-01-15 12:47:13 +01:00
|
|
|
git checkout v2.1.0.12
|
2014-10-20 14:44:03 +02:00
|
|
|
python setup.py install
|
|
|
|
cd /var/www/MISP/app/files/scripts/python-stix
|
2015-06-10 12:47:00 +02:00
|
|
|
git checkout v1.1.1.4
|
2014-10-20 14:44:03 +02:00
|
|
|
python setup.py install
|
2014-10-07 17:53:22 +02:00
|
|
|
|
2014-09-12 13:29:30 +02:00
|
|
|
4/ CakePHP
|
2014-02-11 15:54:46 +01:00
|
|
|
-----------
|
|
|
|
# CakePHP is now included as a submodule of MISP, execute the following commands to let git fetch it:
|
|
|
|
|
2014-10-20 14:44:03 +02:00
|
|
|
cd /var/www/MISP
|
2014-02-11 15:54:46 +01:00
|
|
|
git submodule init
|
|
|
|
git submodule update
|
|
|
|
|
2014-09-12 13:29:30 +02:00
|
|
|
# Once done, install CakeResque along with its dependencies if you intend to use the built in background jobs:
|
|
|
|
cd /var/www/MISP/app
|
2015-04-08 13:05:05 +02:00
|
|
|
php composer.phar require kamisama/cake-resque:4.1.2
|
2014-09-12 13:29:30 +02:00
|
|
|
php composer.phar config vendor-dir Vendor
|
2014-02-11 15:54:46 +01:00
|
|
|
php composer.phar install
|
|
|
|
|
2016-07-13 21:08:02 +02:00
|
|
|
# Enable CakeResque with php5-redis
|
|
|
|
sudo php5enmod redis
|
2014-05-05 17:13:42 +02:00
|
|
|
|
|
|
|
# To use the scheduler worker for scheduled tasks, do the following:
|
2014-05-06 10:44:53 +02:00
|
|
|
cp -fa /var/www/MISP/INSTALL/setup/config.php /var/www/MISP/app/Plugin/CakeResque/Config/config.php
|
2014-05-05 17:13:42 +02:00
|
|
|
|
2014-02-11 15:54:46 +01:00
|
|
|
5/ Set the permissions
|
|
|
|
----------------------
|
|
|
|
|
|
|
|
# Check if the permissions are set correctly using the following commands as root:
|
|
|
|
chown -R www-data:www-data /var/www/MISP
|
|
|
|
chmod -R 750 /var/www/MISP
|
2014-10-07 17:53:22 +02:00
|
|
|
chmod -R g+ws /var/www/MISP/app/tmp
|
|
|
|
chmod -R g+ws /var/www/MISP/app/files
|
2014-10-07 23:21:48 +02:00
|
|
|
chmod -R g+ws /var/www/MISP/app/files/scripts/tmp
|
2014-02-11 15:54:46 +01:00
|
|
|
|
|
|
|
6/ Create a database and user
|
2013-03-29 19:47:59 +01:00
|
|
|
-----------------------------
|
|
|
|
# Enter the mysql shell
|
|
|
|
mysql -u root -p
|
|
|
|
|
|
|
|
mysql> create database misp;
|
|
|
|
mysql> grant usage on *.* to misp@localhost identified by 'XXXXXXXXX';
|
|
|
|
mysql> grant all privileges on misp.* to misp@localhost ;
|
|
|
|
mysql> exit
|
|
|
|
|
2015-02-09 11:07:18 +01:00
|
|
|
cd /var/www/MISP
|
|
|
|
|
2016-06-04 01:10:45 +02:00
|
|
|
# Import the empty MySQL database from MYSQL.sql
|
2015-03-13 13:42:11 +01:00
|
|
|
mysql -u misp -p misp < INSTALL/MYSQL.sql
|
|
|
|
#enter the password you set previously
|
2013-03-29 19:47:59 +01:00
|
|
|
|
2011-11-26 10:45:31 +01:00
|
|
|
|
2014-02-11 15:54:46 +01:00
|
|
|
7/ Apache configuration
|
2013-03-29 19:47:59 +01:00
|
|
|
-----------------------
|
|
|
|
# Now configure your apache server with the DocumentRoot /var/www/MISP/app/webroot/
|
2016-01-15 12:47:13 +01:00
|
|
|
# A sample vhost can be found in /var/www/MISP/INSTALL/apache.misp.ubuntu
|
2012-06-08 17:03:27 +02:00
|
|
|
|
2016-01-15 12:47:13 +01:00
|
|
|
cp /var/www/MISP/INSTALL/apache.misp.ubuntu /etc/apache2/sites-available/misp.conf
|
2014-05-05 17:13:42 +02:00
|
|
|
|
2016-06-04 01:10:45 +02:00
|
|
|
# Be aware that the configuration files for apache 2.4 and up have changed.
|
2014-05-05 17:13:42 +02:00
|
|
|
# The configuration file has to have the .conf extension in the sites-available directory
|
|
|
|
# For more information, visit http://httpd.apache.org/docs/2.4/upgrading.html
|
2016-06-04 01:08:16 +02:00
|
|
|
|
2015-02-02 13:12:15 +01:00
|
|
|
a2dissite 000-default
|
|
|
|
# 000-default can be called default based on distribution, in which case run a2dissite default
|
2013-03-29 19:47:59 +01:00
|
|
|
a2ensite misp
|
2012-03-06 10:21:46 +01:00
|
|
|
|
2013-03-29 19:47:59 +01:00
|
|
|
# Enable modules
|
|
|
|
a2enmod rewrite
|
2012-03-06 10:21:46 +01:00
|
|
|
|
2013-03-29 19:47:59 +01:00
|
|
|
# Restart apache
|
|
|
|
service apache2 reload
|
|
|
|
|
2016-06-04 01:10:45 +02:00
|
|
|
# We seriously recommend using only SSL !
|
2013-03-29 19:47:59 +01:00
|
|
|
# Check out the apache.misp.ssl file for an example
|
|
|
|
|
|
|
|
|
2014-02-11 15:54:46 +01:00
|
|
|
8/ MISP configuration
|
2013-03-29 19:47:59 +01:00
|
|
|
---------------------
|
2014-09-11 14:34:02 +02:00
|
|
|
# There are 4 sample configuration files in /var/www/MISP/app/Config that need to be copied
|
2014-05-05 17:13:42 +02:00
|
|
|
cd /var/www/MISP/app/Config
|
|
|
|
cp -a bootstrap.default.php bootstrap.php
|
|
|
|
cp -a database.default.php database.php
|
|
|
|
cp -a core.default.php core.php
|
2014-09-11 14:34:02 +02:00
|
|
|
cp -a config.default.php config.php
|
2016-06-04 01:08:16 +02:00
|
|
|
|
2014-09-11 14:34:02 +02:00
|
|
|
# Configure the fields in the newly created files:
|
|
|
|
# database.php : login, port, password, database
|
2014-10-01 15:23:12 +02:00
|
|
|
|
2014-09-11 14:34:02 +02:00
|
|
|
# Important! Change the salt key in /var/www/MISP/app/Config/config.php
|
2015-05-11 12:56:51 +02:00
|
|
|
# The salt key must be an at least 32 byte long string.
|
2014-09-11 14:34:02 +02:00
|
|
|
# The admin user account will be generated on the first login, make sure that the salt is changed before you create that user
|
2016-06-04 01:10:45 +02:00
|
|
|
# If you forget to do this step, and you are still dealing with a fresh installation, just alter the salt,
|
2014-09-11 14:34:02 +02:00
|
|
|
# delete the user from mysql and log in again using the default admin credentials (admin@admin.test / admin)
|
2013-03-29 19:47:59 +01:00
|
|
|
|
2016-01-29 15:33:27 +01:00
|
|
|
# Change base url in config.php
|
|
|
|
'baseurl' => 'http://yourhostname.net',
|
|
|
|
#or if using https:
|
|
|
|
'baseurl' => 'https://yourhostname.net',
|
2016-02-27 23:53:15 +01:00
|
|
|
# alternatively, you can leave this field empty if you would like to use relative pathing in MISP
|
|
|
|
'baseurl' => '',
|
2016-01-29 15:33:27 +01:00
|
|
|
|
2013-03-29 19:47:59 +01:00
|
|
|
# and make sure the file permissions are still OK
|
|
|
|
chown -R www-data:www-data /var/www/MISP/app/Config
|
|
|
|
chmod -R 750 /var/www/MISP/app/Config
|
|
|
|
|
2012-06-08 17:03:27 +02:00
|
|
|
# Generate a GPG encryption key.
|
2013-03-29 19:47:59 +01:00
|
|
|
mkdir /var/www/MISP/.gnupg
|
|
|
|
chown www-data:www-data /var/www/MISP/.gnupg
|
|
|
|
chmod 700 /var/www/MISP/.gnupg
|
|
|
|
sudo -u www-data gpg --homedir /var/www/MISP/.gnupg --gen-key
|
2015-05-12 15:11:43 +02:00
|
|
|
|
2016-02-27 23:53:15 +01:00
|
|
|
# The email address should match the one set in the config.php / set in the configuration menu in the administration menu configuration file
|
2012-03-27 14:49:31 +02:00
|
|
|
|
2012-06-08 17:03:27 +02:00
|
|
|
# And export the public key to the webroot
|
2013-03-29 19:47:59 +01:00
|
|
|
sudo -u www-data gpg --homedir /var/www/MISP/.gnupg --export --armor YOUR-EMAIL > /var/www/MISP/app/webroot/gpg.asc
|
|
|
|
|
2014-05-05 17:13:42 +02:00
|
|
|
# To make the background workers start on boot
|
|
|
|
chmod +x /var/www/MISP/app/Console/worker/start.sh
|
|
|
|
sudo vim /etc/rc.local
|
2014-10-07 17:53:22 +02:00
|
|
|
# Add the following line before the last line (exit 0). Make sure that you replace www-data with your apache user:
|
2016-02-01 23:26:43 +01:00
|
|
|
sudo -u www-data bash /var/www/MISP/app/Console/worker/start.sh
|
2014-05-05 17:13:42 +02:00
|
|
|
|
2014-09-11 14:34:02 +02:00
|
|
|
# Now log in using the webinterface:
|
2016-06-04 01:10:45 +02:00
|
|
|
# The default user/pass = admin@admin.test/admin
|
2012-03-27 09:31:41 +02:00
|
|
|
|
2014-09-11 14:34:02 +02:00
|
|
|
# Using the server settings tool in the admin interface (Administration -> Server Settings), set MISP up to your preference
|
|
|
|
# It is especially vital that no critical issues remain!
|
2015-06-02 13:52:39 +02:00
|
|
|
# start the workers by navigating to the workers tab and clicking restart all workers
|
2011-12-11 16:59:35 +01:00
|
|
|
|
2016-02-02 17:29:08 +01:00
|
|
|
# Don't forget to change the email, password and authentication key after installation.
|
2012-03-27 09:31:41 +02:00
|
|
|
|
2014-10-07 17:53:22 +02:00
|
|
|
# Once done, have a look at the diagnostics
|
|
|
|
|
|
|
|
# If any of the directories that MISP uses to store files is not writeable to the apache user, change the permissions
|
|
|
|
# you can do this by running the following commands:
|
|
|
|
|
|
|
|
chmod -R 750 /var/www/MISP/<directory path with an indicated issue>
|
|
|
|
chown -R www-data:www-data /var/www/MISP/<directory path with an indicated issue>
|
|
|
|
|
|
|
|
# Make sure that the STIX libraries and GnuPG work as intended, if not, refer to INSTALL.txt's paragraphs dealing with these two items
|
|
|
|
|
2015-02-09 11:07:18 +01:00
|
|
|
# If anything goes wrong, make sure that you check MISP's logs for errors:
|
|
|
|
# /var/www/MISP/app/tmp/logs/error.log
|
|
|
|
# /var/www/MISP/app/tmp/logs/resque-worker-error.log
|
|
|
|
# /var/www/MISP/app/tmp/logs/resque-scheduler-error.log
|
|
|
|
# /var/www/MISP/app/tmp/logs/resque-2015-01-01.log //where the actual date is the current date
|
2014-10-07 17:53:22 +02:00
|
|
|
|
2013-03-29 19:47:59 +01:00
|
|
|
Recommended actions
|
2011-12-11 16:59:35 +01:00
|
|
|
-------------------
|
2013-03-29 19:47:59 +01:00
|
|
|
- By default CakePHP exposes his name and version in email headers. Apply a patch to remove this behavior.
|
|
|
|
|
|
|
|
- You should really harden your OS
|
|
|
|
- You should really harden the configuration of Apache
|
|
|
|
- You should really harden the configuration of MySQL
|
|
|
|
- Keep your software up2date (MISP, CakePHP and everything else)
|
|
|
|
- Log and audit
|
2015-06-24 17:38:15 +02:00
|
|
|
|
|
|
|
Optional features
|
|
|
|
-------------------
|
2015-06-29 08:56:45 +02:00
|
|
|
# MISP has a new pub/sub feature, using ZeroMQ. To enable it, simply run the following command
|
|
|
|
pip install pyzmq
|
2016-02-01 23:26:43 +01:00
|
|
|
# ZeroMQ depends on the Python client for Redis
|
|
|
|
pip install redis
|