diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 913b03b75..4d04954bc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -105,12 +105,11 @@ jobs: sudo a2enmod rewrite sudo systemctl restart apache2 # 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 build/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 - sudo cp travis/email.php app/Config/email.php + sudo cp build/email.php app/Config/email.php # Ensure the perms sudo chown -R $USER:www-data `pwd`/app/Config sudo chmod -R 777 `pwd`/app/Config @@ -118,7 +117,7 @@ jobs: 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 gpg --no-tty --no-permission-warning --pinentry-mode=loopback --passphrase "travistest" --homedir `pwd`/.gnupg --gen-key --batch `pwd`/build/gpg sudo gpg --list-secret-keys --homedir `pwd`/.gnupg # change perms sudo chown -R $USER:www-data `pwd` diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4378f9c8f..000000000 --- a/.travis.yml +++ /dev/null @@ -1,195 +0,0 @@ -language: php - -php: - - 7.2 - - 7.3 - - 7.4 - - nightly - -services: - - redis - -sudo: required -dist: bionic - -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 - # Install haveged, because Travis lacks entropy. - - 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 - - sudo pip3 install --upgrade pip setuptools requests - - sudo pip3 install --upgrade -r requirements.txt - - sudo pip3 install --upgrade -r requirements-dev.txt - - pip3 install --user poetry - - phpenv rehash - - sudo mkdir $HOME/.composer ; sudo chown $USER:www-data $HOME/.composer - - pushd app - - sudo -H -u $USER php composer.phar install --no-progress - - 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 - - sudo cp travis/email.php app/Config/email.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 gpg --list-secret-keys --homedir `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 - - sudo chmod -R 770 `pwd`/.gnupg - # Get authkey - - sudo usermod -a -G www-data $USER - - sudo -E su $USER -c 'app/Console/cake Admin runUpdates' - - sudo -E su $USER -c 'app/Console/cake userInit -q | sudo tee ./key.txt' - - 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 setSetting "GnuPG.email" "info@admin.test"' - - 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"' - - 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 1' - - 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 - - sudo -E su $USER -c 'app/Console/worker/start.sh &' - - sleep 10 - # Dirty install python stuff - - 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 - - pushd cti-python-stix2 - - pip install . - - popd - - pushd PyMISP - - pip install .[fileobjects] - - popd - - pip install stix zmq redis plyara - - deactivate - -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: - - ./app/Vendor/bin/parallel-lint --exclude app/Lib/cakephp/ --exclude app/Vendor/ --exclude app/Lib/random_compat/ -e php,ctp app/ - - ./app/Vendor/bin/phpunit app/Test/ComplexTypeToolTest.php - - ./app/Vendor/bin/phpunit app/Test/JSONConverterToolTest.php - # Ensure the perms - - sudo chown -R $USER:www-data `pwd`/app/Config - - sudo chmod -R 770 `pwd`/app/Config - - pushd tests - - ./curl_tests.sh $AUTH - - popd - - pushd PyMISP - - git submodule init - - git submodule update - - travis_retry poetry install -E fileobjects -E openioc -E virustotal -E docs -E pdfexport - - poetry run python tests/testlive_comprehensive.py - - poetry run python tests/test_mispevent.py - - popd - - cp PyMISP/tests/keys.py PyMISP/examples/events/ - - pushd PyMISP/examples/events/ - - poetry run python ./create_massive_dummy_events.py -l 5 -a 30 - - popd - - python3 tools/misp-feed/validate.py - -after_failure: - - curl http://misp.local - - cat /etc/apache2/sites-available/misp.local.conf - - sudo tail -n +1 `pwd`/app/tmp/logs/* - - 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 - -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: - - sudo tail -n +1 `pwd`/app/tmp/logs/* - - coveralls - - coverage report - - coverage xml - - codecov diff --git a/travis/database.php b/build/database.php similarity index 100% rename from travis/database.php rename to build/database.php diff --git a/travis/email.php b/build/email.php similarity index 50% rename from travis/email.php rename to build/email.php index 05fdd21c3..6537b42ff 100644 --- a/travis/email.php +++ b/build/email.php @@ -1,7 +1,7 @@ 'Debug', - 'log' => true - ); + 'log' => true, + ]; } diff --git a/travis/gpg b/build/gpg similarity index 100% rename from travis/gpg rename to build/gpg diff --git a/build/travis-ci-apache b/build/travis-ci-apache deleted file mode 100644 index 78f396734..000000000 --- a/build/travis-ci-apache +++ /dev/null @@ -1,15 +0,0 @@ - - ServerAdmin me@me.local - ServerName misp.local - DocumentRoot %TRAVIS_BUILD_DIR%/app/webroot - - Options -Indexes - AllowOverride all - Require all granted - - - LogLevel warn - ErrorLog /var/log/apache2/misp.local_error.log - CustomLog /var/log/apache2/misp.local_access.log combined - ServerSignature Off - diff --git a/tests/curl_tests.sh b/tests/curl_tests.sh deleted file mode 100755 index fa0883cbc..000000000 --- a/tests/curl_tests.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -x - -AUTH="$1" - -# Check if user is logged -curl -i -H "Authorization: $AUTH" -H "Accept: application/json" -X GET http://misp.local/servers/getVersion -curl -i -H "Accept: application/json" -H "content-type: application/json" -H "Authorization: $AUTH" --data "@event.json" -X POST http://misp.local/events -curl -H "Authorization: $AUTH" -X GET http://misp.local/events/csv/download/1/ignore:1 | sed -e 's/^M//g' | cut -d, -f2 --complement | sort > 1.csv -cat 1.csv -cut -d, -f2 --complement event.csv | sort > compare.csv -diff compare.csv 1.csv -curl -i -H "Accept: application/json" -H "content-type: application/json" -H "Authorization: $AUTH" -X POST http://misp.local/events/delete/1 diff --git a/travis/bootstrap.php b/travis/bootstrap.php deleted file mode 100644 index ec050e512..000000000 --- a/travis/bootstrap.php +++ /dev/null @@ -1,154 +0,0 @@ - 'File', //[required] - * 'duration'=> 3600, //[optional] - * 'probability'=> 100, //[optional] - * 'path' => CACHE, //[optional] use system tmp directory - remember to use absolute path - * 'prefix' => 'cake_', //[optional] prefix every cache file with this string - * 'lock' => false, //[optional] use file locking - * 'serialize' => true, // [optional] - * 'mask' => 0666, // [optional] permission mask to use when creating cache files - * )); - * - * APC (http://pecl.php.net/package/APC) - * - * Cache::config('default', array( - * 'engine' => 'Apc', //[required] - * 'duration'=> 3600, //[optional] - * 'probability'=> 100, //[optional] - * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string - * )); - * - * Xcache (http://xcache.lighttpd.net/) - * - * Cache::config('default', array( - * 'engine' => 'Xcache', //[required] - * 'duration'=> 3600, //[optional] - * 'probability'=> 100, //[optional] - * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string - * 'user' => 'user', //user from xcache.admin.user settings - * 'password' => 'password', //plaintext password (xcache.admin.pass) - * )); - * - * Memcache (http://memcached.org/) - * - * Cache::config('default', array( - * 'engine' => 'Memcache', //[required] - * 'duration'=> 3600, //[optional] - * 'probability'=> 100, //[optional] - * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string - * 'servers' => array( - * '127.0.0.1:11211' // localhost, default port 11211 - * ), //[optional] - * 'persistent' => true, // [optional] set this to false for non-persistent connections - * 'compress' => false, // [optional] compress data in Memcache (slower, but uses less memory) - * )); - * - * Wincache (http://php.net/wincache) - * - * Cache::config('default', array( - * 'engine' => 'Wincache', //[required] - * 'duration'=> 3600, //[optional] - * 'probability'=> 100, //[optional] - * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string - * )); - * - * Redis (http://http://redis.io/) - * - * Cache::config('default', array( - * 'engine' => 'Redis', //[required] - * 'duration'=> 3600, //[optional] - * 'probability'=> 100, //[optional] - * 'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string - * 'server' => '127.0.0.1' // localhost - * 'port' => 6379 // default port 6379 - * 'timeout' => 0 // timeout in seconds, 0 = unlimited - * 'persistent' => true, // [optional] set this to false for non-persistent connections - * )); - */ -Cache::config('default', array('engine' => 'File')); -Configure::load('config'); - -if (!Configure::read('MISP.baseurl')) { - if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) { - Configure::write('MISP.baseurl', sprintf('https://%s:%d', $_SERVER['SERVER_ADDR'], $_SERVER['SERVER_PORT'])); - } else { - Configure::write('MISP.baseurl', sprintf('http://%s:%d', $_SERVER['SERVER_ADDR'], $_SERVER['SERVER_PORT'])); - } -} - -/** - * Plugins need to be loaded manually, you can either load them one by one or all of them in a single call - * Uncomment one of the lines below, as you need. make sure you read the documentation on CakePlugin to use more - * advanced ways of loading plugins - * - * CakePlugin::loadAll(); // Loads all plugins at once - * CakePlugin::load('DebugKit'); //Loads a single plugin named DebugKit - * - */ - -CakePlugin::load('SysLog'); -CakePlugin::load('Assets'); // having Logable -CakePlugin::load('SysLogLogable'); - -/** - * Uncomment the following line to enable client SSL certificate authentication. - * It's also necessary to configure the plugin — for more information, please read app/Plugin/CertAuth/reame.md - */ -// CakePlugin::load('CertAuth'); - -/** - * You can attach event listeners to the request lifecyle as Dispatcher Filter . By Default CakePHP bundles two filters: - * - * - AssetDispatcher filter will serve your asset files (css, images, js, etc) from your themes and plugins - * - CacheDispatcher filter will read the Cache.check configure variable and try to serve cached content generated from controllers - * - * Feel free to remove or add filters as you see fit for your application. A few examples: - * - * Configure::write('Dispatcher.filters', array( - * 'MyCacheFilter', // will use MyCacheFilter class from the Routing/Filter package in your app. - * 'MyPlugin.MyFilter', // will use MyFilter class from the Routing/Filter package in MyPlugin plugin. - * array('callable' => $aFunction, 'on' => 'before', 'priority' => 9), // A valid PHP callback type to be called on beforeDispatch - * array('callable' => $anotherMethod, 'on' => 'after'), // A valid PHP callback type to be called on afterDispatch - * - * )); - */ -Configure::write('Dispatcher.filters', array( - 'AssetDispatcher', - 'CacheDispatcher' -)); - -/** - * Configures default file logging options - */ -App::uses('CakeLog', 'Log'); -CakeLog::config('debug', array( - 'engine' => 'FileLog', - 'types' => array('notice', 'info', 'debug'), - 'file' => 'debug', -)); -CakeLog::config('error', array( - 'engine' => 'FileLog', - 'types' => array('warning', 'error', 'critical', 'alert', 'emergency'), - 'file' => 'error', -)); - -CakePlugin::loadAll(array( - 'CakeResque' => array('bootstrap' => true) -)); diff --git a/travis/config.php b/travis/config.php deleted file mode 100644 index 881781223..000000000 --- a/travis/config.php +++ /dev/null @@ -1,81 +0,0 @@ - 1, - 'Security' => - array ( - 'level' => 'medium', - 'salt' => 'Rooraenietu8Eeyo '', - //'auth'=>array('CertAuth.Certificate'), // additional authentication methods - ), - 'MISP' => - array ( - 'baseurl' => 'http://misp.local', - 'footerpart1' => 'Powered by MISP', - 'footerpart2' => '© Belgian Defense CERT & NCIRC', - 'org' => 'ORGNAME', - 'showorg' => true, - 'background_jobs' => false, - 'email' => 'email@address.com', - 'contact' => 'email@address.com', - 'cveurl' => 'http://web.nvd.nist.gov/view/vuln/detail?vulnId=', - 'disablerestalert' => false, - 'default_event_distribution' => '0', - 'default_attribute_distribution' => 'event', - 'tagging' => true, - 'full_tags_on_event_index' => true, - 'footer_logo' => '', - 'take_ownership_xml_import' => false, - 'unpublishedprivate' => false, - ), - 'GnuPG' => - array ( - 'onlyencrypted' => false, - 'email' => '', - 'homedir' => '', - 'password' => '', - 'bodyonlyencrypted' => false, - ), - 'Proxy' => - array ( - 'host' => '', - 'port' => '', - 'method' => '', - 'user' => '', - 'password' => '', - ), - 'SecureAuth' => - array ( - 'amount' => 5, - 'expire' => 300, - ), - // Uncomment the following to enable client SSL certificate authentication - /* - 'CertAuth' => - array( - 'ca' => array( 'FIRST.Org' ), // allowed CAs - 'caId' => 'O', // which attribute will be used to verify the CA - 'userModel' => 'User', // name of the User class to check if user exists - 'userModelKey' => 'nids_sid', // User field that will be used for querying - 'map' => array( // maps client certificate attributes to User properties - 'O' => 'org', - 'emailAddress'=>'email', - ), - 'syncUser' => true, // should the User be synchronized with an external REST API - 'userDefaults'=> array( // default user attributes, only used when creating new users - 'role_id' => 4, - ), - 'restApi' => array( // API parameters - 'url' => 'https://example.com/data/users', // URL to query - 'headers' => array(), // additional headers, used for authentication - 'param' => array( 'email' => 'email'), // query parameters to add to the URL, mapped to USer properties - 'map' => array( // maps REST result to the User properties - 'uid' => 'nids_sid', - 'team' => 'org', - 'email' => 'email', - 'pgp_public'=> 'gpgkey', - ), - ), - ), - */ -); diff --git a/travis/core.php b/travis/core.php deleted file mode 100644 index c22dee853..000000000 --- a/travis/core.php +++ /dev/null @@ -1,285 +0,0 @@ - 0 - * and log errors with CakeLog when debug = 0. - * - * Options: - * - * - `handler` - callback - The callback to handle errors. You can set this to any callable type, - * including anonymous functions. - * - `level` - int - The level of errors you are interested in capturing. - * - `trace` - boolean - Include stack traces for errors in log files. - * - * @see ErrorHandler for more information on error handling and configuration. - */ - Configure::write('Error', array( - 'handler' => 'ErrorHandler::handleError', - 'level' => E_ALL & ~E_DEPRECATED, - 'trace' => true - )); - -/** - * Configure the Exception handler used for uncaught exceptions. By default, - * ErrorHandler::handleException() is used. It will display a HTML page for the exception, and - * while debug > 0, framework errors like Missing Controller will be displayed. When debug = 0, - * framework errors will be coerced into generic HTTP errors. - * - * Options: - * - * - `handler` - callback - The callback to handle exceptions. You can set this to any callback type, - * including anonymous functions. - * - `renderer` - string - The class responsible for rendering uncaught exceptions. If you choose a custom class you - * should place the file for that class in app/Lib/Error. This class needs to implement a render method. - * - `log` - boolean - Should Exceptions be logged? - * - * @see ErrorHandler for more information on exception handling and configuration. - */ - Configure::write('Exception', array( - 'handler' => 'ErrorHandler::handleException', - 'renderer' => 'ExceptionRenderer', - 'log' => true, - 'skipLog' => array( - 'NotFoundException', - ) - )); - -/** - * Application wide charset encoding - */ - Configure::write('App.encoding', 'UTF-8'); - -/** - * To configure CakePHP *not* to use mod_rewrite and to - * use CakePHP pretty URLs, remove these .htaccess - * files: - * - * /.htaccess - * /app/.htaccess - * /app/webroot/.htaccess - * - * And uncomment the App.baseUrl below: - */ - //Configure::write('App.baseUrl', env('SCRIPT_NAME')); - -/** - * Uncomment the define below to use CakePHP prefix routes. - * - * The value of the define determines the names of the routes - * and their associated controller actions: - * - * Set to an array of prefixes you want to use in your application. Use for - * admin or other prefixed routes. - * - * Routing.prefixes = array('admin', 'manager'); - * - * Enables: - * `admin_index()` and `/admin/controller/index` - * `manager_index()` and `/manager/controller/index` - * - */ - Configure::write('Routing.prefixes', array('admin')); - -/** - * Turn off all caching application-wide. - * - */ - Configure::write('Cache.disable', false); - -/** - * Enable cache checking. - * - * If set to true, for view caching you must still use the controller - * public $cacheAction inside your controllers to define caching settings. - * You can either set it controller-wide by setting public $cacheAction = true, - * or in each action using $this->cacheAction = true. - * - */ - //Configure::write('Cache.check', true); - -/** - * Defines the default error type when using the log() function. Used for - * differentiating error logging and debugging. Currently PHP supports LOG_DEBUG. - */ - define('LOG_ERROR', LOG_ERR); - -/** - * Session configuration. - * - * Contains an array of settings to use for session configuration. The defaults key is - * used to define a default preset to use for sessions, any settings declared here will override - * the settings of the default config. - * - * ## Options - * - * - `Session.cookie` - The name of the cookie to use. Defaults to 'CAKEPHP' - * - `Session.timeout` - The number of minutes you want sessions to live for. This timeout is handled by CakePHP - * - `Session.cookieTimeout` - The number of minutes you want session cookies to live for. - * - `Session.checkAgent` - Do you want the user agent to be checked when starting sessions? You might want to set the - * value to false, when dealing with older versions of IE, Chrome Frame or certain web-browsing devices and AJAX - * - `Session.defaults` - The default configuration set to use as a basis for your session. - * There are four builtins: php, cake, cache, database. - * - `Session.handler` - Can be used to enable a custom session handler. Expects an array of callables, - * that can be used with `session_save_handler`. Using this option will automatically add `session.save_handler` - * to the ini array. - * - `Session.autoRegenerate` - Enabling this setting, turns on automatic renewal of sessions, and - * sessionids that change frequently. See CakeSession::$requestCountdown. - * - `Session.ini` - An associative array of additional ini values to set. - * - * The built in defaults are: - * - * - 'php' - Uses settings defined in your php.ini. - * - 'cake' - Saves session files in CakePHP's /tmp directory. - * - 'database' - Uses CakePHP's database sessions. - * - 'cache' - Use the Cache class to save sessions. - * - * To define a custom session handler, save it at /app/Model/Datasource/Session/.php. - * Make sure the class implements `CakeSessionHandlerInterface` and set Session.handler to - * - * To use database sessions, run the app/Config/Schema/sessions.php schema using - * the cake shell command: cake schema create Sessions - * - */ - Configure::write('Session', array( - 'timeout' => 60, // Session timeout, default is 1 hour - 'defaults' => 'php' - )); - -/** - * The level of CakePHP security. - */ - Configure::write('Security.level', 'medium'); - -/** - * A random string used in security hashing methods. - */ - Configure::write('Security.salt', 'Rooraenietu8Eeyo 0. Set to 'force' to always enable - * timestamping regardless of debug value. - */ - //Configure::write('Asset.timestamp', true); - -/** - * Compress CSS output by removing comments, whitespace, repeating tags, etc. - * This requires a/var/cache directory to be writable by the web server for caching. - * and /vendors/csspp/csspp.php - * - * To use, prefix the CSS link URL with '/ccss/' instead of '/css/' or use HtmlHelper::css(). - */ - //Configure::write('Asset.filter.css', 'css.php'); - -/** - * Plug in your own custom JavaScript compressor by dropping a script in your webroot to handle the - * output, and setting the config below to the name of the script. - * - * To use, prefix your JavaScript link URLs with '/cjs/' instead of '/js/' or use JavaScriptHelper::link(). - */ - //Configure::write('Asset.filter.js', 'custom_javascript_output_filter.php'); - -/** - * The classname and database used in CakePHP's - * access control lists. - */ - Configure::write('Acl.classname', 'DbAcl'); - Configure::write('Acl.database', 'default'); - -/** - * Uncomment this line and correct your server timezone to fix - * any date & time related errors. - */ - //date_default_timezone_set('UTC'); - -/** - * Pick the caching engine to use. If APC is enabled use it. - * If running via cli - apc is disabled by default. ensure it's available and enabled in this case - * - * Note: 'default' and other application caches should be configured in app/Config/bootstrap.php. - * Please check the comments in boostrap.php for more info on the cache engines available - * and their setttings. - */ -$engine = 'File'; -if (function_exists('apcu_dec') && (PHP_SAPI !== 'cli' || ini_get('apc.enable_cli'))) { - require_once APP . 'Plugin/ApcuCache/Engine/ApcuEngine.php'; // it is not possible to use plugin - $engine = 'Apcu'; -} - -// In development mode, caches should expire quickly. -$duration = '+999 days'; -if (Configure::read('debug') >= 1) { - $duration = '+10 seconds'; -} - -// Prefix each application on the same server with a different string, to avoid Memcache and APC conflicts. -$prefix = 'myapp_'; - -/** - * Configure the cache used for general framework caching. Path information, - * object listings, and translation cache files are stored with this configuration. - */ -Cache::config('_cake_core_', array( - 'engine' => $engine, - 'prefix' => $prefix . 'cake_core_', - 'path' => CACHE . 'persistent' . DS, - 'serialize' => ($engine === 'File'), - 'duration' => $duration -)); - -/** - * Configure the cache for model and datasource caches. This cache configuration - * is used to store schema descriptions, and table listings in connections. - */ -Cache::config('_cake_model_', array( - 'engine' => $engine, - 'prefix' => $prefix . 'cake_model_', - 'path' => CACHE . 'models' . DS, - 'serialize' => ($engine === 'File'), - 'duration' => $duration -)); - -//require_once dirname(__DIR__) . '/Vendor/autoload.php';