2013-11-11 23:18:13 +01:00
|
|
|
language: php
|
2016-07-01 14:43:06 +02:00
|
|
|
|
2013-11-11 23:18:13 +01:00
|
|
|
php:
|
2018-07-07 12:31:55 +02:00
|
|
|
- 7.2
|
2019-01-21 21:27:58 +01:00
|
|
|
- 7.3
|
2020-01-20 11:02:42 +01:00
|
|
|
- 7.4
|
2016-06-02 16:52:03 +02:00
|
|
|
- nightly
|
2013-11-12 16:23:37 +01:00
|
|
|
|
2015-09-07 00:40:47 +02:00
|
|
|
services:
|
2015-09-11 19:23:20 +02:00
|
|
|
- redis
|
2013-11-12 16:23:37 +01:00
|
|
|
|
2016-01-04 18:11:56 +01:00
|
|
|
sudo: required
|
2018-08-10 23:45:43 +02:00
|
|
|
dist: bionic
|
2015-09-07 00:40:47 +02:00
|
|
|
|
|
|
|
addons:
|
2018-08-10 23:45:43 +02:00
|
|
|
mariadb: '10.2'
|
2015-09-11 19:23:20 +02:00
|
|
|
hosts:
|
|
|
|
- misp.local
|
2015-09-12 22:23:07 +02:00
|
|
|
- localhost
|
2016-01-12 15:18:51 +01:00
|
|
|
|
|
|
|
before_install:
|
|
|
|
- git config --global user.name "TravisCI"
|
2018-08-10 23:45:43 +02:00
|
|
|
- export PATH="$HOME/.local/bin:$PATH"
|
2016-01-12 15:18:51 +01:00
|
|
|
|
2015-09-11 19:23:20 +02:00
|
|
|
install:
|
2019-08-26 19:43:43 +02:00
|
|
|
- date
|
2018-08-10 21:48:12 +02:00
|
|
|
- sudo apt-get -y update
|
2020-08-12 08:27:05 +02:00
|
|
|
# Install haveged, because Travis lacks entropy.
|
2020-08-12 16:25:04 +02:00
|
|
|
- sudo apt-get -y install haveged python3 python3-venv python3-pip python3-dev python3-nose python3-redis python3-lxml python3-dateutil python3-msgpack 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
|
2019-08-16 12:09:01 +02:00
|
|
|
- sudo pip3 install --upgrade pip setuptools requests pyzmq
|
|
|
|
- sudo pip3 install --upgrade -r requirements.txt
|
2020-08-31 13:52:49 +02:00
|
|
|
- pip3 install --user poetry
|
2015-09-11 19:23:20 +02:00
|
|
|
- phpenv rehash
|
2019-07-20 21:03:54 +02:00
|
|
|
- sudo mkdir $HOME/.composer ; sudo chown $USER:www-data $HOME/.composer
|
2015-09-11 19:23:20 +02:00
|
|
|
- pushd app
|
2020-08-12 16:24:26 +02:00
|
|
|
- sudo -H -u $USER php composer.phar install --no-progress
|
2019-07-20 21:35:52 +02:00
|
|
|
- sudo phpenmod redis
|
|
|
|
- sudo phpenmod gnupg
|
2015-09-11 19:23:20 +02:00
|
|
|
- popd
|
|
|
|
- cp -fa INSTALL/setup/config.php app/Plugin/CakeResque/Config/config.php
|
2016-01-04 18:11:56 +01:00
|
|
|
# Set perms
|
2019-07-20 20:20:22 +02:00
|
|
|
- sudo chown -R $USER:www-data `pwd`
|
2019-08-16 12:09:01 +02:00
|
|
|
- sudo chmod -R 775 `pwd`
|
2016-01-04 18:11:56 +01:00
|
|
|
- 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
|
2019-07-20 20:20:22 +02:00
|
|
|
- sudo chown -R $USER:www-data `pwd`
|
2016-01-04 18:11:56 +01:00
|
|
|
# Resque perms
|
2019-07-20 20:20:22 +02:00
|
|
|
- sudo chown -R $USER:www-data `pwd`/app/Plugin/CakeResque/tmp
|
2016-01-04 18:11:56 +01:00
|
|
|
- sudo chmod -R 755 `pwd`/app/Plugin/CakeResque/tmp
|
|
|
|
# install MySQL
|
|
|
|
- sudo chmod -R 777 `pwd`/INSTALL
|
2019-08-16 11:59:23 +02:00
|
|
|
- mysql -u root -e "SET GLOBAL sql_mode = 'STRICT_ALL_TABLES';"
|
2015-09-22 10:57:08 +02:00
|
|
|
- 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
|
2016-01-04 18:11:56 +01:00
|
|
|
# configure apache virtual hosts
|
|
|
|
- sudo chmod -R 777 `pwd`/build
|
2018-08-10 23:45:43 +02:00
|
|
|
- sudo mkdir -p /etc/apache2/sites-available
|
2016-01-04 18:11:56 +01:00
|
|
|
- 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
|
2019-07-20 21:35:52 +02:00
|
|
|
- sudo cp app/Config/bootstrap.default.php app/Config/bootstrap.php
|
2016-01-04 18:11:56 +01:00
|
|
|
- sudo cp travis/database.php app/Config/database.php
|
2019-07-20 21:35:52 +02:00
|
|
|
- sudo cp app/Config/core.default.php app/Config/core.php
|
|
|
|
- sudo cp app/Config/config.default.php app/Config/config.php
|
2020-04-26 21:45:02 +02:00
|
|
|
- sudo cp travis/email.php app/Config/email.php
|
2016-01-04 18:11:56 +01:00
|
|
|
# Ensure the perms
|
2019-07-20 20:20:22 +02:00
|
|
|
- sudo chown -R $USER:www-data `pwd`/app/Config
|
2019-08-16 11:28:55 +02:00
|
|
|
- sudo chmod -R 770 `pwd`/app/Config
|
2016-01-04 18:11:56 +01:00
|
|
|
# GPG setup
|
|
|
|
- sudo mkdir `pwd`/.gnupg
|
|
|
|
# /!\ VERY INSECURE BUT FASTER ON THE BUILD ENV OF TRAVIS
|
|
|
|
- sudo cp -a /dev/urandom /dev/random
|
2019-07-05 08:16:08 +02:00
|
|
|
- sudo gpg --no-tty --no-permission-warning --pinentry-mode=loopback --passphrase "travistest" --homedir `pwd`/.gnupg --gen-key --batch `pwd`/travis/gpg
|
2020-08-11 12:37:14 +02:00
|
|
|
- sudo gpg --list-secret-keys --homedir `pwd`/.gnupg
|
2019-07-20 20:20:22 +02:00
|
|
|
# change perms
|
|
|
|
- sudo chown -R $USER:www-data `pwd`
|
|
|
|
- sudo chmod +x /home/travis/build
|
|
|
|
- sudo chmod +x /home/travis
|
|
|
|
- sudo chmod +x /home
|
2020-06-02 10:55:43 +02:00
|
|
|
- sudo chmod -R 770 `pwd`/.gnupg
|
2016-01-04 18:11:56 +01:00
|
|
|
# Get authkey
|
|
|
|
- sudo usermod -a -G www-data $USER
|
2019-10-14 14:22:06 +02:00
|
|
|
- sudo -E su $USER -c 'app/Console/cake Admin runUpdates'
|
2020-11-14 13:20:48 +01:00
|
|
|
- sudo -E su $USER -c 'app/Console/cake userInit -q | sudo tee ./key.txt'
|
2019-07-20 18:54:23 +02:00
|
|
|
- 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"'
|
2019-10-17 11:21:16 +02:00
|
|
|
- sudo -E su $USER -c 'app/Console/cake Admin setSetting "MISP.disable_emailing" false'
|
2019-08-30 12:04:38 +02:00
|
|
|
- sudo -E su $USER -c 'app/Console/cake Admin setSetting "debug" true'
|
2019-07-20 18:54:23 +02:00
|
|
|
- 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" ""'
|
2020-08-11 12:37:14 +02:00
|
|
|
- sudo -E su $USER -c 'app/Console/cake Admin setSetting "GnuPG.email" "info@admin.test"'
|
2020-05-09 11:34:48 +02:00
|
|
|
- sudo -E su $USER -c 'app/Console/cake Admin setSetting "GnuPG.homedir" "`pwd`/.gnupg"'
|
|
|
|
- sudo -E su $USER -c 'app/Console/cake Admin setSetting "GnuPG.password" "travistest"'
|
2019-07-20 18:54:23 +02:00
|
|
|
- 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'
|
2019-12-16 12:46:44 +01:00
|
|
|
- sudo -E su $USER -c 'app/Console/cake Admin updateObjectTemplates 1'
|
2019-07-20 18:54:23 +02:00
|
|
|
- sudo -E su $USER -c 'app/Console/cake Admin setSetting "Plugin.ZeroMQ_enable" true'
|
2019-07-20 20:20:22 +02:00
|
|
|
- sudo -E su $USER -c 'app/Console/cake Live 1'
|
2016-01-04 18:11:56 +01:00
|
|
|
- sudo chmod 777 ./key.txt
|
2016-01-12 15:18:51 +01:00
|
|
|
- sudo chmod -R 777 ./tests
|
2019-07-20 20:20:22 +02:00
|
|
|
# Start workers
|
|
|
|
- sudo chmod +x app/Console/worker/start.sh
|
2020-08-12 08:29:22 +02:00
|
|
|
- sudo -E su $USER -c 'app/Console/worker/start.sh &'
|
2019-07-20 20:20:22 +02:00
|
|
|
- sleep 10
|
2019-07-21 01:38:23 +02:00
|
|
|
# Dirty install python stuff
|
2020-01-20 11:02:42 +01:00
|
|
|
- virtualenv -p python3.6 ./venv
|
|
|
|
- sudo -E su $USER -c 'app/Console/cake Admin setSetting "MISP.python_bin" "$TRAVIS_BUILD_DIR/venv/bin/python"'
|
|
|
|
- . ./venv/bin/activate
|
2019-07-21 01:38:23 +02:00
|
|
|
- pushd cti-python-stix2
|
2020-01-20 11:02:42 +01:00
|
|
|
- pip install .
|
2019-07-21 01:38:23 +02:00
|
|
|
- popd
|
2020-01-20 11:02:42 +01:00
|
|
|
- pushd PyMISP
|
|
|
|
- pip install .[fileobjects]
|
2019-07-21 01:38:23 +02:00
|
|
|
- popd
|
2020-01-20 11:02:42 +01:00
|
|
|
- pip install stix zmq redis plyara
|
|
|
|
- deactivate
|
2016-01-04 18:11:56 +01:00
|
|
|
|
|
|
|
before_script:
|
|
|
|
- curl http://misp.local
|
|
|
|
- AUTH=`cat key.txt`
|
|
|
|
- sudo chmod -R 777 PyMISP
|
2015-09-22 10:57:08 +02:00
|
|
|
- pushd PyMISP
|
|
|
|
- echo 'url = "http://misp.local"' >> tests/keys.py
|
|
|
|
- echo 'key = "'${AUTH}'"' >> tests/keys.py
|
|
|
|
- cat tests/keys.py
|
|
|
|
- popd
|
2013-11-14 12:43:31 +01:00
|
|
|
|
|
|
|
script:
|
2020-09-23 18:17:32 +02:00
|
|
|
- ./app/Vendor/bin/parallel-lint --exclude app/Lib/cakephp/ --exclude app/Vendor/ --exclude app/Lib/random_compat/ -e php,ctp app/
|
2020-07-06 16:01:29 +02:00
|
|
|
- ./app/Vendor/bin/phpunit app/Test/ComplexTypeToolTest.php
|
2020-10-24 19:09:20 +02:00
|
|
|
- ./app/Vendor/bin/phpunit app/Test/JSONConverterToolTest.php
|
2020-11-17 10:09:05 +01:00
|
|
|
# Ensure the perms
|
|
|
|
- sudo chown -R $USER:www-data `pwd`/app/Config
|
|
|
|
- sudo chmod -R 770 `pwd`/app/Config
|
2016-01-12 15:18:51 +01:00
|
|
|
- pushd tests
|
|
|
|
- ./curl_tests.sh $AUTH
|
|
|
|
- popd
|
2015-09-22 10:57:08 +02:00
|
|
|
- pushd PyMISP
|
2019-10-10 13:11:46 +02:00
|
|
|
- git submodule init
|
|
|
|
- git submodule update
|
2020-10-17 12:36:53 +02:00
|
|
|
- travis_retry poetry install -E fileobjects -E openioc -E virustotal -E docs -E pdfexport
|
2020-02-26 16:38:02 +01:00
|
|
|
- poetry run python tests/testlive_comprehensive.py
|
|
|
|
- poetry run python tests/test_mispevent.py
|
2016-01-04 18:11:56 +01:00
|
|
|
- popd
|
2016-07-01 14:00:05 +02:00
|
|
|
- cp PyMISP/tests/keys.py PyMISP/examples/events/
|
|
|
|
- pushd PyMISP/examples/events/
|
2020-02-26 15:25:44 +01:00
|
|
|
- poetry run python ./create_massive_dummy_events.py -l 5 -a 30
|
2016-07-01 14:00:05 +02:00
|
|
|
- popd
|
2020-10-02 15:37:07 +02:00
|
|
|
- python3 tools/misp-feed/validate.py
|
2016-01-04 18:11:56 +01:00
|
|
|
|
|
|
|
after_failure:
|
|
|
|
- curl http://misp.local
|
|
|
|
- cat /etc/apache2/sites-available/misp.local.conf
|
2020-08-12 16:26:25 +02:00
|
|
|
- sudo tail -n +1 `pwd`/app/tmp/logs/*
|
2016-01-04 18:11:56 +01:00
|
|
|
- sudo ls -l /var/log/apache2
|
|
|
|
- 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
|
|
|
|
|
2016-06-08 11:38:58 +02:00
|
|
|
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
|
2015-09-22 16:40:35 +02:00
|
|
|
|
|
|
|
after_success:
|
2020-08-12 16:26:25 +02:00
|
|
|
- sudo tail -n +1 `pwd`/app/tmp/logs/*
|
2015-09-22 16:40:35 +02:00
|
|
|
- coveralls
|
2015-10-29 06:45:33 +01:00
|
|
|
- coverage report
|
|
|
|
- coverage xml
|
2017-07-17 11:11:38 +02:00
|
|
|
- codecov
|