mirror of https://github.com/MISP/MISP
Merge pull request #652 from Rafiot/travis2
[Travis] Big update, Almost ready to run tests.pull/653/head
commit
8ebc9bf0cf
|
@ -1,4 +1,4 @@
|
||||||
[submodule "app/Lib/cakephp"]
|
[submodule "app/Lib/cakephp"]
|
||||||
path = app/Lib/cakephp
|
path = app/Lib/cakephp
|
||||||
url = https://github.com/cakephp/cakephp.git
|
url = https://github.com/cakephp/cakephp.git
|
||||||
branch = 2.6
|
branch = 2.6
|
||||||
|
|
83
.travis.yml
83
.travis.yml
|
@ -1,59 +1,86 @@
|
||||||
language: php
|
language: php
|
||||||
php:
|
php:
|
||||||
- 5.5
|
- 5.6
|
||||||
|
|
||||||
services:
|
services:
|
||||||
- mysql
|
- mysql
|
||||||
|
- redis
|
||||||
|
|
||||||
sudo: false
|
sudo: true
|
||||||
|
|
||||||
|
cache: pip
|
||||||
|
|
||||||
addons:
|
addons:
|
||||||
|
hosts:
|
||||||
|
- misp.local
|
||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
- python-dev
|
- python-dev
|
||||||
- python-pip
|
- python-pip
|
||||||
- libxml2-dev
|
- libxml2-dev
|
||||||
- libxslt-dev
|
|
||||||
- zlib1g-dev
|
- zlib1g-dev
|
||||||
|
- php5-dev
|
||||||
|
- apache2
|
||||||
|
- libapache2-mod-php5
|
||||||
|
- libapache2-mod-fastcgi
|
||||||
|
- curl
|
||||||
- python-virtualenv
|
- python-virtualenv
|
||||||
- python-pip
|
- python-pip
|
||||||
- php5-redis
|
|
||||||
|
|
||||||
before_script:
|
install:
|
||||||
- virtualenv virtenv
|
- pip install --user pyzmq
|
||||||
- . virtenv/bin/activate
|
- pip install --user git+https://github.com/CybOXProject/python-cybox.git@v2.1.0.12#egg=Package
|
||||||
- pip install pyzmq
|
- pip install --user git+https://github.com/stixproject/python-stix.git@v1.2.0.0#egg=Package
|
||||||
- pip install --exists-action w -e git://github.com/CybOXProject/python-cybox.git@v2.1.0.12#egg=Package
|
- pip install --user git+https://github.com/MISP/PyMISP.git@v1.8#egg=Package
|
||||||
- git clone https://github.com/stixproject/python-stix.git
|
|
||||||
- cd python-stix
|
|
||||||
- git checkout v1.2.0.0
|
|
||||||
- python setup.py install
|
|
||||||
- cd ..
|
|
||||||
- pear install Crypt_GPG
|
- pear install Crypt_GPG
|
||||||
- pear install Net_GeoIP
|
- pear install Net_GeoIP
|
||||||
- cd app
|
- phpenv rehash
|
||||||
|
- pushd app
|
||||||
- composer require kamisama/cake-resque:4.1.2
|
- composer require kamisama/cake-resque:4.1.2
|
||||||
- composer config vendor-dir Vendor
|
- composer config vendor-dir Vendor
|
||||||
- composer install
|
- composer install
|
||||||
- cd ..
|
- popd
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
# enable php-fpm
|
||||||
|
- sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
|
||||||
|
- sudo a2enmod rewrite actions fastcgi alias
|
||||||
|
- echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
|
||||||
|
- ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm
|
||||||
|
# configure apache virtual hosts
|
||||||
|
- sudo cp -f build/travis-ci-apache /etc/apache2/sites-available/misp
|
||||||
|
- sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/misp
|
||||||
|
- cat /etc/apache2/sites-available/misp
|
||||||
|
- sudo a2dissite default
|
||||||
|
- sudo a2ensite misp
|
||||||
|
- sudo service apache2 restart
|
||||||
- phpenv config-add travis/myphpconfig.ini
|
- phpenv config-add travis/myphpconfig.ini
|
||||||
- cp -fa INSTALL/setup/config.php app/Plugin/CakeResque/Config/config.php
|
|
||||||
- chmod -R 750 ./
|
|
||||||
- chmod -R g+ws app/tmp
|
|
||||||
- chmod -R g+ws app/files
|
|
||||||
- chmod -R g+ws app/files/scripts/tmp
|
|
||||||
- mysql -u root -e 'create database misp;'
|
|
||||||
- mysql -u root -e "grant usage on *.* to misp@localhost identified by 'blah'";
|
|
||||||
- mysql -u root -e "grant all privileges on misp.* to misp@localhost;"
|
|
||||||
- mysql -u misp -pblah misp < INSTALL/MYSQL.sql
|
|
||||||
- mkdir .gnupg
|
- mkdir .gnupg
|
||||||
- chmod 700 .gnupg
|
|
||||||
- gpg --homedir .gnupg --gen-key --batch travis/gpg
|
- gpg --homedir .gnupg --gen-key --batch travis/gpg
|
||||||
|
- cp -fa INSTALL/setup/config.php app/Plugin/CakeResque/Config/config.php
|
||||||
- cp travis/bootstrap.php app/Config/bootstrap.php
|
- cp travis/bootstrap.php app/Config/bootstrap.php
|
||||||
- cp travis/database.php app/Config/database.php
|
- cp travis/database.php app/Config/database.php
|
||||||
- cp travis/core.php app/Config/core.php
|
- cp travis/core.php app/Config/core.php
|
||||||
- cp travis/config.php app/Config/config.php
|
- cp travis/config.php app/Config/config.php
|
||||||
|
- sudo chown -R www-data:www-data ./
|
||||||
|
- sudo chmod -R 755 ./
|
||||||
|
- sudo chmod 700 .gnupg
|
||||||
|
- sudo chmod -R 777 tests
|
||||||
|
- sudo chmod -R 777 app/tmp
|
||||||
|
- sudo chmod -R 777 app/files
|
||||||
|
- sudo chmod -R 777 app/files/scripts/tmp
|
||||||
|
- mysql -u root -e 'create database misp;'
|
||||||
|
- mysql -u root -e "grant usage on *.* to misp@localhost identified by 'blah'";
|
||||||
|
- mysql -u root -e "grant all privileges on misp.* to misp@localhost;"
|
||||||
|
- mysql -u misp -pblah misp < INSTALL/MYSQL.sql
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- exit 0
|
- AUTH=`app/Console/cake userInit -q`
|
||||||
|
- sudo chown -R www-data:www-data app/
|
||||||
|
- curl http://misp.local >> /dev/null
|
||||||
|
- pushd tests
|
||||||
|
- echo 'url = "http://misp.local"' >> keys.py
|
||||||
|
- echo 'key = "'${AUTH}'"' >> keys.py
|
||||||
|
- cat keys.py
|
||||||
|
- ./test.py
|
||||||
|
- popd
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<VirtualHost *:80>
|
<VirtualHost *:80>
|
||||||
ServerAdmin me@me.local
|
ServerAdmin admin@misp.local
|
||||||
ServerName misp.local
|
ServerName misp.local
|
||||||
DocumentRoot %TRAVIS_BUILD_DIR%/app/webroot
|
DocumentRoot %TRAVIS_BUILD_DIR%/app/webroot
|
||||||
|
|
||||||
<Directory "%TRAVIS_BUILD_DIR%"/app/webroot>
|
<Directory %TRAVIS_BUILD_DIR%/app/webroot>
|
||||||
Options FollowSymLinks MultiViews ExecCGI -Indexes
|
Options FollowSymLinks MultiViews ExecCGI -Indexes
|
||||||
AllowOverride All
|
AllowOverride All
|
||||||
Order allow,deny
|
Order allow,deny
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import json
|
||||||
|
from simplejson.decoder import JSONDecodeError
|
||||||
|
|
||||||
|
from pymisp import PyMISP
|
||||||
|
from keys import url, key
|
||||||
|
|
||||||
|
|
||||||
|
misp = PyMISP(url, key, True, 'json')
|
||||||
|
|
||||||
|
try:
|
||||||
|
event = misp.new_event(0, 1, 0, "This is a test")
|
||||||
|
print(event)
|
||||||
|
print(json.dumps(event, indent=2))
|
||||||
|
except JSONDecodeError as e:
|
||||||
|
print(e.doc)
|
||||||
|
exit(0)
|
|
@ -150,6 +150,6 @@ CakeLog::config('error', array(
|
||||||
'file' => 'error',
|
'file' => 'error',
|
||||||
));
|
));
|
||||||
|
|
||||||
CakePlugin::loadAll(array(
|
//CakePlugin::loadAll(array(
|
||||||
'CakeResque' => array('bootstrap' => true)
|
// 'CakeResque' => array('bootstrap' => true)
|
||||||
));
|
//));
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
<?php
|
<?php
|
||||||
$config = array (
|
$config = array (
|
||||||
'debug' => 0,
|
'debug' => 0,
|
||||||
'Security' =>
|
'Security' =>
|
||||||
array (
|
array (
|
||||||
'level' => 'medium',
|
'level' => 'medium',
|
||||||
'salt' => 'Rooraenietu8Eeyo<Qu2eeNfterd-dd+',
|
'salt' => 'Rooraenietu8Eeyo<Qu2eeNfterd-dd+',
|
||||||
'cipherSeed' => '',
|
'cipherSeed' => '',
|
||||||
//'auth'=>array('CertAuth.Certificate'), // additional authentication methods
|
//'auth'=>array('CertAuth.Certificate'), // additional authentication methods
|
||||||
),
|
),
|
||||||
'MISP' =>
|
'MISP' =>
|
||||||
array (
|
array (
|
||||||
'baseurl' => '',
|
'baseurl' => 'http://localhost',
|
||||||
'footerpart1' => 'Powered by MISP',
|
'footerpart1' => 'Powered by MISP',
|
||||||
'footerpart2' => '© Belgian Defense CERT & NCIRC',
|
'footerpart2' => '© Belgian Defense CERT & NCIRC',
|
||||||
'org' => 'ORGNAME',
|
'org' => 'ORGNAME',
|
||||||
|
@ -29,7 +29,7 @@ $config = array (
|
||||||
'take_ownership_xml_import' => false,
|
'take_ownership_xml_import' => false,
|
||||||
'unpublishedprivate' => false,
|
'unpublishedprivate' => false,
|
||||||
),
|
),
|
||||||
'GnuPG' =>
|
'GnuPG' =>
|
||||||
array (
|
array (
|
||||||
'onlyencrypted' => false,
|
'onlyencrypted' => false,
|
||||||
'email' => '',
|
'email' => '',
|
||||||
|
@ -45,19 +45,19 @@ $config = array (
|
||||||
'user' => '',
|
'user' => '',
|
||||||
'password' => '',
|
'password' => '',
|
||||||
),
|
),
|
||||||
'SecureAuth' =>
|
'SecureAuth' =>
|
||||||
array (
|
array (
|
||||||
'amount' => 5,
|
'amount' => 5,
|
||||||
'expire' => 300,
|
'expire' => 300,
|
||||||
),
|
),
|
||||||
// Uncomment the following to enable client SSL certificate authentication
|
// Uncomment the following to enable client SSL certificate authentication
|
||||||
/*
|
/*
|
||||||
'CertAuth' =>
|
'CertAuth' =>
|
||||||
array(
|
array(
|
||||||
'ca' => array( 'FIRST.Org' ), // allowed CAs
|
'ca' => array( 'FIRST.Org' ), // allowed CAs
|
||||||
'caId' => 'O', // which attribute will be used to verify the CA
|
'caId' => 'O', // which attribute will be used to verify the CA
|
||||||
'userModel' => 'User', // name of the User class to check if user exists
|
'userModel' => 'User', // name of the User class to check if user exists
|
||||||
'userModelKey' => 'nids_sid', // User field that will be used for querying
|
'userModelKey' => 'nids_sid', // User field that will be used for querying
|
||||||
'map' => array( // maps client certificate attributes to User properties
|
'map' => array( // maps client certificate attributes to User properties
|
||||||
'O' => 'org',
|
'O' => 'org',
|
||||||
'emailAddress'=>'email',
|
'emailAddress'=>'email',
|
||||||
|
@ -69,7 +69,7 @@ $config = array (
|
||||||
'restApi' => array( // API parameters
|
'restApi' => array( // API parameters
|
||||||
'url' => 'https://example.com/data/users', // URL to query
|
'url' => 'https://example.com/data/users', // URL to query
|
||||||
'headers' => array(), // additional headers, used for authentication
|
'headers' => array(), // additional headers, used for authentication
|
||||||
'param' => array( 'email' => 'email'), // query parameters to add to the URL, mapped to USer properties
|
'param' => array( 'email' => 'email'), // query parameters to add to the URL, mapped to USer properties
|
||||||
'map' => array( // maps REST result to the User properties
|
'map' => array( // maps REST result to the User properties
|
||||||
'uid' => 'nids_sid',
|
'uid' => 'nids_sid',
|
||||||
'team' => 'org',
|
'team' => 'org',
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
* In production mode, flash messages redirect after a time interval.
|
* In production mode, flash messages redirect after a time interval.
|
||||||
* In development mode, you need to click the flash message to continue.
|
* In development mode, you need to click the flash message to continue.
|
||||||
*/
|
*/
|
||||||
Configure::write('debug', 0); // 0 = for production, 2 = full debug mode
|
Configure::write('debug', 2); // 0 = for production, 2 = full debug mode
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configure the Error handler used to handle errors for your application. By default
|
* Configure the Error handler used to handle errors for your application. By default
|
||||||
|
@ -281,4 +281,4 @@ Cache::config('_cake_model_', array(
|
||||||
'duration' => $duration
|
'duration' => $duration
|
||||||
));
|
));
|
||||||
|
|
||||||
//require_once dirname(__DIR__) . '/Vendor/autoload.php';
|
//require_once dirname(__DIR__) . '/Vendor/autoload.php';
|
||||||
|
|
Loading…
Reference in New Issue