Big update, Almost ready to run tests.

pull/652/head
Raphaël Vinot 2015-09-11 19:23:20 +02:00
parent b6857b4743
commit 3e4364dd6c
8 changed files with 92 additions and 46 deletions

4
.gitmodules vendored
View File

@ -1,4 +1,4 @@
[submodule "app/Lib/cakephp"]
path = app/Lib/cakephp
url = https://github.com/cakephp/cakephp.git
branch = 2.6
url = https://github.com/cakephp/cakephp.git
branch = 2.6

View File

@ -1,59 +1,86 @@
language: php
php:
- 5.5
- 5.6
services:
- mysql
- redis
sudo: false
sudo: true
cache: pip
addons:
hosts:
- misp.local
apt:
packages:
- python-dev
- python-pip
- libxml2-dev
- libxslt-dev
- zlib1g-dev
- php5-dev
- apache2
- libapache2-mod-php5
- libapache2-mod-fastcgi
- curl
- python-virtualenv
- python-pip
- php5-redis
before_script:
- virtualenv virtenv
- . virtenv/bin/activate
- pip install pyzmq
- pip install --exists-action w -e git://github.com/CybOXProject/python-cybox.git@v2.1.0.12#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 ..
install:
- pip install --user pyzmq
- pip install --user git+https://github.com/CybOXProject/python-cybox.git@v2.1.0.12#egg=Package
- pip install --user git+https://github.com/stixproject/python-stix.git@v1.2.0.0#egg=Package
- pip install --user git+https://github.com/MISP/PyMISP.git@v1.8#egg=Package
- pear install Crypt_GPG
- pear install Net_GeoIP
- cd app
- phpenv rehash
- pushd app
- composer require kamisama/cake-resque:4.1.2
- composer config vendor-dir Vendor
- 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
- 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
- chmod 700 .gnupg
- 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/database.php app/Config/database.php
- cp travis/core.php app/Config/core.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:
- 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

View File

@ -1,9 +1,9 @@
<VirtualHost *:80>
ServerAdmin me@me.local
ServerAdmin admin@misp.local
ServerName misp.local
DocumentRoot %TRAVIS_BUILD_DIR%/app/webroot
<Directory "%TRAVIS_BUILD_DIR%"/app/webroot>
<Directory %TRAVIS_BUILD_DIR%/app/webroot>
Options FollowSymLinks MultiViews ExecCGI -Indexes
AllowOverride All
Order allow,deny

0
tests/__init__.py Normal file
View File

19
tests/test.py Executable file
View File

@ -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)

View File

@ -150,6 +150,6 @@ CakeLog::config('error', array(
'file' => 'error',
));
CakePlugin::loadAll(array(
'CakeResque' => array('bootstrap' => true)
));
//CakePlugin::loadAll(array(
// 'CakeResque' => array('bootstrap' => true)
//));

View File

@ -10,7 +10,7 @@ $config = array (
),
'MISP' =>
array (
'baseurl' => '',
'baseurl' => 'http://localhost',
'footerpart1' => 'Powered by MISP',
'footerpart2' => '&copy; Belgian Defense CERT & NCIRC',
'org' => 'ORGNAME',

View File

@ -32,7 +32,7 @@
* In production mode, flash messages redirect after a time interval.
* 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