mirror of https://github.com/MISP/MISP
203 lines
7.8 KiB
YAML
203 lines
7.8 KiB
YAML
language: php
|
|
|
|
php:
|
|
- 7.1
|
|
- 7.2
|
|
- 7.3
|
|
- nightly
|
|
|
|
services:
|
|
- redis
|
|
|
|
sudo: required
|
|
dist: bionic
|
|
group: edge
|
|
|
|
addons:
|
|
mariadb: '10.2'
|
|
hosts:
|
|
- misp.local
|
|
- localhost
|
|
|
|
before_install:
|
|
- git config --global user.name "TravisCI"
|
|
- export PATH="$HOME/.local/bin:$PATH"
|
|
|
|
install:
|
|
- date
|
|
- sudo apt-get -y update
|
|
# Travis lacks entropy.
|
|
- sudo apt-get -y install haveged
|
|
- sudo apt-get -y install python3 python3-pip python3-dev python3-nose libxml2-dev libzmq3-dev zlib1g-dev apache2 curl php-mysql php-dev php-cli libapache2-mod-php libfuzzy-dev php-mbstring libonig4 php-json php-xml php-opcache php-readline php-redis php-gnupg php-gd
|
|
- sudo apt-get -y dist-upgrade
|
|
- sudo pip3 install --upgrade pip setuptools requests pyzmq
|
|
- sudo pip3 install --upgrade -r requirements.txt
|
|
- sudo pip3 install pipenv
|
|
- phpenv rehash
|
|
- sudo mkdir $HOME/.composer ; sudo chown $USER:www-data $HOME/.composer
|
|
- pushd app
|
|
- sudo -H -u $USER php composer.phar install
|
|
- sudo phpenmod redis
|
|
- sudo phpenmod gnupg
|
|
- popd
|
|
- cp -fa INSTALL/setup/config.php app/Plugin/CakeResque/Config/config.php
|
|
# Set perms
|
|
- sudo chown -R $USER:www-data `pwd`
|
|
- sudo chmod -R 775 `pwd`
|
|
- sudo chmod -R g+ws `pwd`/app/tmp
|
|
- sudo chmod -R g+ws `pwd`/app/tmp/cache
|
|
- sudo chmod -R g+ws `pwd`/app/tmp/cache/persistent
|
|
- sudo chmod -R g+ws `pwd`/app/tmp/cache/models
|
|
- sudo chmod -R g+ws `pwd`/app/tmp/logs
|
|
- sudo chmod -R g+ws `pwd`/app/files
|
|
- sudo chmod -R g+ws `pwd`/app/files/scripts/tmp
|
|
- sudo chown -R $USER:www-data `pwd`
|
|
# Resque perms
|
|
- sudo chown -R $USER:www-data `pwd`/app/Plugin/CakeResque/tmp
|
|
- sudo chmod -R 755 `pwd`/app/Plugin/CakeResque/tmp
|
|
# install MySQL
|
|
- sudo chmod -R 777 `pwd`/INSTALL
|
|
- mysql -u root -e "SET GLOBAL sql_mode = 'STRICT_ALL_TABLES';"
|
|
- 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
|
|
# configure apache virtual hosts
|
|
- sudo chmod -R 777 `pwd`/build
|
|
- sudo mkdir -p /etc/apache2/sites-available
|
|
- sudo cp -f build/travis-ci-apache /etc/apache2/sites-available/misp.local.conf
|
|
- sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/misp.local.conf
|
|
- sudo a2dissite 000-default
|
|
- sudo a2ensite misp.local.conf
|
|
- sudo a2enmod rewrite
|
|
- sudo service apache2 restart
|
|
# MISP configuration
|
|
- sudo chmod -R 777 `pwd`/travis
|
|
- sudo cp app/Config/bootstrap.default.php app/Config/bootstrap.php
|
|
- sudo cp travis/database.php app/Config/database.php
|
|
- sudo cp app/Config/core.default.php app/Config/core.php
|
|
- sudo cp app/Config/config.default.php app/Config/config.php
|
|
# Ensure the perms
|
|
- sudo chown -R $USER:www-data `pwd`/app/Config
|
|
- sudo chmod -R 770 `pwd`/app/Config
|
|
# GPG setup
|
|
- sudo mkdir `pwd`/.gnupg
|
|
# /!\ VERY INSECURE BUT FASTER ON THE BUILD ENV OF TRAVIS
|
|
- sudo cp -a /dev/urandom /dev/random
|
|
- sudo gpg --no-tty --no-permission-warning --pinentry-mode=loopback --passphrase "travistest" --homedir `pwd`/.gnupg --gen-key --batch `pwd`/travis/gpg
|
|
- sudo chown $USER:www-data `pwd`/.gnupg
|
|
- sudo chmod 700 `pwd`/.gnupg
|
|
# change perms
|
|
- sudo chown -R $USER:www-data `pwd`
|
|
- sudo chmod +x /home/travis/build
|
|
- sudo chmod +x /home/travis
|
|
- sudo chmod +x /home
|
|
# Get authkey
|
|
- sudo usermod -a -G www-data $USER
|
|
- sudo -E su $USER -c 'app/Console/cake userInit -q | sudo tee ./key.txt'
|
|
- sudo -E su $USER -c 'app/Console/cake Admin runUpdates'
|
|
- sudo -E su $USER -c 'app/Console/cake Admin setSetting "MISP.python_bin" "/usr/bin/python3"'
|
|
- sudo -E su $USER -c 'app/Console/cake Admin setSetting "Session.autoRegenerate" 0'
|
|
- sudo -E su $USER -c 'app/Console/cake Admin setSetting "Session.timeout" 600'
|
|
- sudo -E su $USER -c 'app/Console/cake Admin setSetting "Session.cookieTimeout" 3600'
|
|
- sudo -E su $USER -c 'app/Console/cake Admin setSetting "MISP.host_org_id" 1'
|
|
- sudo -E su $USER -c 'app/Console/cake Admin setSetting "MISP.email" "info@admin.test"'
|
|
- sudo -E su $USER -c 'app/Console/cake Admin setSetting "MISP.disable_emailing" false'
|
|
- sudo -E su $USER -c 'app/Console/cake Admin setSetting "debug" true'
|
|
- sudo -E su $USER -c 'app/Console/cake Admin setSetting "Plugin.CustomAuth_disable_logout" false'
|
|
- sudo -E su $USER -c 'app/Console/cake Admin setSetting "MISP.redis_host" "127.0.0.1"'
|
|
- sudo -E su $USER -c 'app/Console/cake Admin setSetting "MISP.redis_port" 6379'
|
|
- sudo -E su $USER -c 'app/Console/cake Admin setSetting "MISP.redis_database" 13'
|
|
- sudo -E su $USER -c 'app/Console/cake Admin setSetting "MISP.redis_password" ""'
|
|
- sudo -E su $USER -c 'app/Console/cake Admin updateGalaxies'
|
|
- sudo -E su $USER -c 'app/Console/cake Admin updateTaxonomies'
|
|
- sudo -E su $USER -c 'app/Console/cake Admin updateWarningLists'
|
|
- sudo -E su $USER -c 'app/Console/cake Admin updateNoticeLists'
|
|
- sudo -E su $USER -c 'app/Console/cake Admin updateObjectTemplates "1337"'
|
|
- sudo -E su $USER -c 'app/Console/cake Admin setSetting "Plugin.ZeroMQ_enable" true'
|
|
- sudo -E su $USER -c 'app/Console/cake Live 1'
|
|
- sudo chmod 777 ./key.txt
|
|
- sudo chmod -R 777 ./tests
|
|
# Start workers
|
|
- sudo chmod +x app/Console/worker/start.sh
|
|
- app/Console/worker/start.sh &
|
|
- sleep 10
|
|
# Dirty install python stuff
|
|
- pushd cti-python-stix2
|
|
- sudo pip3 install .
|
|
- popd
|
|
- pushd app/files/scripts
|
|
- sudo -H -u $USER git clone https://github.com/CybOXProject/python-cybox.git
|
|
- sudo -H -u $USER git clone https://github.com/STIXProject/python-stix.git
|
|
- sudo -H -u $USER git clone https://github.com/MAECProject/python-maec.git
|
|
- sudo -H -u $USER git clone https://github.com/CybOXProject/mixbox.git
|
|
- pushd mixbox
|
|
- sudo pip3 install .
|
|
- popd
|
|
- pushd python-cybox
|
|
- sudo pip3 install .
|
|
- popd
|
|
- pushd python-stix
|
|
- sudo pip3 install .
|
|
- popd
|
|
- pushd python-maec
|
|
- sudo pip3 install .
|
|
- popd
|
|
- popd
|
|
|
|
before_script:
|
|
- curl http://misp.local
|
|
- AUTH=`cat key.txt`
|
|
- sudo chmod -R 777 PyMISP
|
|
- pushd PyMISP
|
|
- echo 'url = "http://misp.local"' >> tests/keys.py
|
|
- echo 'key = "'${AUTH}'"' >> tests/keys.py
|
|
- cat tests/keys.py
|
|
- popd
|
|
|
|
script:
|
|
- pushd tests
|
|
- ./curl_tests.sh $AUTH
|
|
- popd
|
|
- pushd PyMISP
|
|
- git submodule init
|
|
- git submodule update
|
|
- pipenv install -d
|
|
- pipenv run python tests/testlive_comprehensive.py
|
|
- pipenv run python tests/test.py
|
|
- pipenv run python tests/test_mispevent.py
|
|
- popd
|
|
- cp PyMISP/tests/keys.py PyMISP/examples/events/
|
|
- pushd PyMISP/examples/events/
|
|
- pipenv run python ./create_massive_dummy_events.py -l 5 -a 30
|
|
- popd
|
|
- pushd app/files/feed-metadata
|
|
- jsonschema -i defaults.json schema.json
|
|
- popd
|
|
|
|
after_failure:
|
|
- ls -Rl `pwd`/app
|
|
- curl http://misp.local
|
|
- cat /etc/apache2/sites-available/misp.local.conf
|
|
- sudo ls -l /var/log/apache2
|
|
- sudo cat `pwd`/app/tmp/logs/error.log
|
|
- sudo cat `pwd`/app/tmp/logs/debug.log
|
|
- sudo cat /var/log/apache2/error.log
|
|
- sudo cat /var/log/apache2/misp.local_error.log
|
|
- sudo cat /var/log/apache2/misp.local_access.log
|
|
- pwd
|
|
|
|
notifications:
|
|
webhooks:
|
|
urls:
|
|
- https://webhooks.gitter.im/e/05e30284086a8e948d31
|
|
on_success: change # options: [always|never|change] default: always
|
|
on_failure: always # options: [always|never|change] default: always
|
|
on_start: never # options: [always|never|change] default: always
|
|
|
|
after_success:
|
|
- coveralls
|
|
- coverage report
|
|
- coverage xml
|
|
- codecov
|