for debian 8
Install a minimal Debian 8 (debian-8.1.0-amd64-netinst.iso) system with the software:
- SSH Server
- Standard system utilities
Login as root
apt install postfix
- Postfix Configuration: Satellite system
Once the system is installed you can perform the following steps as root:
apt install vim
apt install zip php-pear git redis-server make python-dev python-pip libxml2-dev libxslt-dev zlib1g-dev php5-dev php5-fpm php5-mysql nginx-full curl sudo pear install Crypt_GPG # we need version >1.3.0 pear install Net_GeoIP
cd /var/www/ git clone https://github.com/MISP/MISP.git
cd /var/www/MISP git config core.filemode false
Upgrade pip - See pypa/pip#2686
python -m pip install --upgrade --force setuptools python -m pip install --upgrade --force pip
cd /var/www/MISP/app/files/scripts
/usr/local/bin/pip install git+git://github.com/CybOXProject/[email protected]#egg=cybox /usr/local/bin/pip install git+git://github.com/STIXProject/[email protected]#egg=stix
cd /var/www/MISP git submodule init git submodule update
Once done, install CakeResque along with its dependencies if you intend to use the built in background jobs:
cd /var/www/MISP/app curl -s https://getcomposer.org/installer | php php composer.phar require kamisama/cake-resque:4.1.2 php composer.phar config vendor-dir Vendor php composer.phar install
CakeResque normally uses phpredis to connect to redis, but it has a (buggy) fallback connector through Redisent. It is highly advised to install phpredis
pecl install redis apt install php5-redis
echo "extension=redis.so" >> /etc/php5/fpm/php.ini
cp -fa /var/www/MISP/INSTALL/setup/config.php /var/www/MISP/app/Plugin/CakeResque/Config/config.php
chown -R www-data:www-data /var/www/MISP chmod -R 750 /var/www/MISP chmod -R g+ws /var/www/MISP/app/tmp chmod -R g+ws /var/www/MISP/app/files chmod -R g+ws /var/www/MISP/app/files/scripts/tmp
Install database
apt install mariadb-server
mysql -u root -p
MariaDB [(none)]> create database misp; MariaDB [(none)]> grant usage on . to misp@localhost identified by 'XXXXXXXXX'; MariaDB [(none)]> grant all privileges on misp.* to misp@localhost ; MariaDB [(none)]> exit
cd /var/www/MISP
mysql -u misp -p misp < INSTALL/MYSQL.sql #enter the password you set previously
7/ nginx/PHP configuration -----------------------# Now configure your apache server with the DocumentRoot /var/www/MISP/app/webroot/
cp /var/www/MISP/INSTALL/apache.misp /etc/apache2/sites-available/misp.conf
cat << EOF > /etc/nginx/sites-available/misp.conf server { listen 80;
root /var/www/MISP/app/webroot/;
index index.php index.html index.htm;
server_name _;
location / {
try_files \$uri \$uri/ /index.php;
}
location ~ \.php$ {
try_files \$uri =404;
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
include fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}} EOF
cat << EOF > /etc/php5/fpm/pool.d/misp.conf [misp] listen = /var/run/php5-fpm.sock listen.allowed_clients = 127.0.0.1 listen.owner = www-data listen.group = www-data user = www-data group = www-data
pm = dynamic pm.max_children = 6 pm.start_servers = 3 pm.min_spare_servers = 3 pm.max_spare_servers = 5
pm.max_requests = 500
request_terminate_timeout = 120s request_slowlog_timeout = 5s
slowlog = /var/log/nginx/$pool.log.slow rlimit_files = 4096 rlimit_core = 0 chdir = /var/www/MISP catch_workers_output = yes EOF
rm /etc/nginx/sites-enabled/default rm /etc/php5/fpm/pool.d/www.conf
ln -s /etc/nginx/sites-available/misp.conf /etc/nginx/sites-enabled/misp.conf
systemctl restart php5-fpm.service systemctl restart nginx.service
service apache2 reload
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 cp -a config.default.php config.php
To enable the background workers, if you have installed the package required for it in 4/, uncomment the following lines:
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,
delete the user from mysql and log in again using the default admin credentials ([email protected] / admin)
chown -R www-data:www-data /var/www/MISP/app/Config chmod -R 750 /var/www/MISP/app/Config
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
sudo -u www-data gpg --homedir /var/www/MISP/.gnupg --export --armor YOUR-EMAIL > /var/www/MISP/app/webroot/gpg.asc
chmod +x /var/www/MISP/app/Console/worker/start.sh vim /etc/rc.local
Add the following line before the last line (exit 0). Make sure that you replace www-data with your apache user:
su www-data -c 'bash /var/www/MISP/app/Console/worker/start.sh'
The default user/pass = [email protected]/admin -> Bonjour01!
Using the server settings tool in the admin interface (Administration -> Server Settings), set MISP up to your preference
sudo -u www-data MISP/app/Console/worker/start.sh
Don't forget to change the email, password and authentication key after installation.
If any of the directories that MISP uses to store files is not writeable to the apache user, change the permissions
chmod -R 750 /var/www/MISP/ chown -R www-data:www-data /var/www/MISP/
Make sure that the STIX libraries and GnuPG work as intended, if not, refer to INSTALL.txt's paragraphs dealing with these two items
-
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
pip install pyzmq