diff options
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | app/ServiceProvider/DatabaseProvider.php | 10 | ||||
-rw-r--r-- | app/common.php | 51 | ||||
-rw-r--r-- | app/constants.php | 3 | ||||
-rw-r--r-- | composer.json | 2 | ||||
-rw-r--r-- | composer.lock | 56 | ||||
-rw-r--r-- | config.default.php | 9 | ||||
-rw-r--r-- | doc/config.markdown | 9 | ||||
-rw-r--r-- | doc/mysql-configuration.markdown | 25 |
9 files changed, 107 insertions, 59 deletions
@@ -12,6 +12,7 @@ New features: Improvements: +* Added support for Mysql SSL connection * Improve web page title on the task view * Unify task drop-down menu between different views * Improve LDAP user group membership synchronization diff --git a/app/ServiceProvider/DatabaseProvider.php b/app/ServiceProvider/DatabaseProvider.php index d323807d..26662b8a 100644 --- a/app/ServiceProvider/DatabaseProvider.php +++ b/app/ServiceProvider/DatabaseProvider.php @@ -10,6 +10,13 @@ use PicoDb\Database; class DatabaseProvider implements ServiceProviderInterface { + /** + * Register provider + * + * @access public + * @param Container $container + * @return Container + */ public function register(Container $container) { $container['db'] = $this->getInstance(); @@ -83,6 +90,9 @@ class DatabaseProvider implements ServiceProviderInterface 'database' => DB_NAME, 'charset' => 'utf8', 'port' => DB_PORT, + 'ssl_key' => DB_SSL_KEY, + 'ssl_ca' => DB_SSL_CA, + 'ssl_cert' => DB_SSL_CERT, )); } diff --git a/app/common.php b/app/common.php index aed07a50..fa95773b 100644 --- a/app/common.php +++ b/app/common.php @@ -2,16 +2,17 @@ require __DIR__.'/../vendor/autoload.php'; -// Automatically parse environment configuration (Heroku) -if (getenv('DATABASE_URL')) { - $dbopts = parse_url(getenv('DATABASE_URL')); - - define('DB_DRIVER', $dbopts['scheme']); - define('DB_USERNAME', $dbopts["user"]); - define('DB_PASSWORD', $dbopts["pass"]); - define('DB_HOSTNAME', $dbopts["host"]); - define('DB_PORT', isset($dbopts["port"]) ? $dbopts["port"] : null); - define('DB_NAME', ltrim($dbopts["path"], '/')); +$dbUrlParser = new PicoDb\UrlParser(); + +if ($dbUrlParser->isEnvironmentVariableDefined()) { + $dbSettings = $dbUrlParser->getSettings(); + + define('DB_DRIVER', $dbSettings['driver']); + define('DB_USERNAME', $dbSettings['username']); + define('DB_PASSWORD', $dbSettings['password']); + define('DB_HOSTNAME', $dbSettings['hostname']); + define('DB_PORT', $dbSettings['port']); + define('DB_NAME', $dbSettings['database']); } $config_file = implode(DIRECTORY_SEPARATOR, array(__DIR__, '..', 'config.php')); @@ -30,18 +31,18 @@ require __DIR__.'/constants.php'; require __DIR__.'/check_setup.php'; $container = new Pimple\Container; -$container->register(new Kanboard\ServiceProvider\HelperProvider); -$container->register(new Kanboard\ServiceProvider\SessionProvider); -$container->register(new Kanboard\ServiceProvider\LoggingProvider); -$container->register(new Kanboard\ServiceProvider\DatabaseProvider); -$container->register(new Kanboard\ServiceProvider\AuthenticationProvider); -$container->register(new Kanboard\ServiceProvider\NotificationProvider); -$container->register(new Kanboard\ServiceProvider\ClassProvider); -$container->register(new Kanboard\ServiceProvider\EventDispatcherProvider); -$container->register(new Kanboard\ServiceProvider\GroupProvider); -$container->register(new Kanboard\ServiceProvider\RouteProvider); -$container->register(new Kanboard\ServiceProvider\ActionProvider); -$container->register(new Kanboard\ServiceProvider\ExternalLinkProvider); -$container->register(new Kanboard\ServiceProvider\AvatarProvider); -$container->register(new Kanboard\ServiceProvider\FilterProvider); -$container->register(new Kanboard\ServiceProvider\PluginProvider); +$container->register(new Kanboard\ServiceProvider\HelperProvider()); +$container->register(new Kanboard\ServiceProvider\SessionProvider()); +$container->register(new Kanboard\ServiceProvider\LoggingProvider()); +$container->register(new Kanboard\ServiceProvider\DatabaseProvider()); +$container->register(new Kanboard\ServiceProvider\AuthenticationProvider()); +$container->register(new Kanboard\ServiceProvider\NotificationProvider()); +$container->register(new Kanboard\ServiceProvider\ClassProvider()); +$container->register(new Kanboard\ServiceProvider\EventDispatcherProvider()); +$container->register(new Kanboard\ServiceProvider\GroupProvider()); +$container->register(new Kanboard\ServiceProvider\RouteProvider()); +$container->register(new Kanboard\ServiceProvider\ActionProvider()); +$container->register(new Kanboard\ServiceProvider\ExternalLinkProvider()); +$container->register(new Kanboard\ServiceProvider\AvatarProvider()); +$container->register(new Kanboard\ServiceProvider\FilterProvider()); +$container->register(new Kanboard\ServiceProvider\PluginProvider()); diff --git a/app/constants.php b/app/constants.php index 7ee3f16d..94086fa9 100644 --- a/app/constants.php +++ b/app/constants.php @@ -34,6 +34,9 @@ defined('DB_PASSWORD') or define('DB_PASSWORD', ''); defined('DB_HOSTNAME') or define('DB_HOSTNAME', 'localhost'); defined('DB_NAME') or define('DB_NAME', 'kanboard'); defined('DB_PORT') or define('DB_PORT', null); +defined('DB_SSL_KEY') or define('DB_SSL_KEY', null); +defined('DB_SSL_CERT') or define('DB_SSL_CERT', null); +defined('DB_SSL_CA') or define('DB_SSL_CA', null); // Database backend group provider defined('DB_GROUP_PROVIDER') or define('DB_GROUP_PROVIDER', true); diff --git a/composer.json b/composer.json index 61f0218c..6ac627a1 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "eluceo/ical": "0.8.0", "erusev/parsedown" : "1.6.0", "fguillot/json-rpc" : "1.1.0", - "fguillot/picodb" : "1.0.8", + "fguillot/picodb" : "1.0.10", "fguillot/simpleLogger" : "1.0.0", "fguillot/simple-validator" : "1.0.0", "paragonie/random_compat": "@stable", diff --git a/composer.lock b/composer.lock index 1c736f1d..c250a227 100644 --- a/composer.lock +++ b/composer.lock @@ -4,21 +4,21 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "715601e3833e0ee04d8d00d266302f8b", - "content-hash": "ef38cdd1e92bd2cd299db9c6d429d24f", + "hash": "d3e42867a9978b7e3f2dbf0861e73519", + "content-hash": "3f031c0bd8d109e424d67a4d59cde8e3", "packages": [ { "name": "christian-riesen/base32", - "version": "1.3.0", + "version": "1.3.1", "source": { "type": "git", "url": "https://github.com/ChristianRiesen/base32.git", - "reference": "fde061a370b0a97fdcd33d9d5f7b1b70ce1f79d4" + "reference": "0a31e50c0fa9b1692d077c86ac188eecdcbaf7fa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ChristianRiesen/base32/zipball/fde061a370b0a97fdcd33d9d5f7b1b70ce1f79d4", - "reference": "fde061a370b0a97fdcd33d9d5f7b1b70ce1f79d4", + "url": "https://api.github.com/repos/ChristianRiesen/base32/zipball/0a31e50c0fa9b1692d077c86ac188eecdcbaf7fa", + "reference": "0a31e50c0fa9b1692d077c86ac188eecdcbaf7fa", "shasum": "" }, "require": { @@ -59,7 +59,7 @@ "encode", "rfc4648" ], - "time": "2016-04-07 07:45:31" + "time": "2016-05-05 11:49:03" }, { "name": "christian-riesen/otp", @@ -239,16 +239,16 @@ }, { "name": "fguillot/picodb", - "version": "v1.0.8", + "version": "v1.0.10", "source": { "type": "git", "url": "https://github.com/fguillot/picoDb.git", - "reference": "672a819ba2757a9e22a3572a230e735e84bcf625" + "reference": "99a9d271b08236c3035781db039ab7da25ff668d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fguillot/picoDb/zipball/672a819ba2757a9e22a3572a230e735e84bcf625", - "reference": "672a819ba2757a9e22a3572a230e735e84bcf625", + "url": "https://api.github.com/repos/fguillot/picoDb/zipball/99a9d271b08236c3035781db039ab7da25ff668d", + "reference": "99a9d271b08236c3035781db039ab7da25ff668d", "shasum": "" }, "require": { @@ -272,7 +272,7 @@ ], "description": "Minimalist database query builder", "homepage": "https://github.com/fguillot/picoDb", - "time": "2016-03-27 20:15:25" + "time": "2016-05-06 22:49:08" }, { "name": "fguillot/simple-validator", @@ -574,16 +574,16 @@ }, { "name": "swiftmailer/swiftmailer", - "version": "v5.4.1", + "version": "v5.4.2", "source": { "type": "git", "url": "https://github.com/swiftmailer/swiftmailer.git", - "reference": "0697e6aa65c83edf97bb0f23d8763f94e3f11421" + "reference": "d8db871a54619458a805229a057ea2af33c753e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/0697e6aa65c83edf97bb0f23d8763f94e3f11421", - "reference": "0697e6aa65c83edf97bb0f23d8763f94e3f11421", + "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/d8db871a54619458a805229a057ea2af33c753e8", + "reference": "d8db871a54619458a805229a057ea2af33c753e8", "shasum": "" }, "require": { @@ -623,20 +623,20 @@ "mail", "mailer" ], - "time": "2015-06-06 14:19:39" + "time": "2016-05-01 08:45:47" }, { "name": "symfony/console", - "version": "v2.8.4", + "version": "v2.8.5", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "9a5aef5fc0d4eff86853d44202b02be8d5a20154" + "reference": "48221d3de4dc22d2cd57c97e8b9361821da86609" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/9a5aef5fc0d4eff86853d44202b02be8d5a20154", - "reference": "9a5aef5fc0d4eff86853d44202b02be8d5a20154", + "url": "https://api.github.com/repos/symfony/console/zipball/48221d3de4dc22d2cd57c97e8b9361821da86609", + "reference": "48221d3de4dc22d2cd57c97e8b9361821da86609", "shasum": "" }, "require": { @@ -683,20 +683,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2016-03-17 09:19:04" + "time": "2016-04-26 12:00:47" }, { "name": "symfony/event-dispatcher", - "version": "v2.8.4", + "version": "v2.8.5", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "47d2d8cade9b1c3987573d2943bb9352536cdb87" + "reference": "81c4c51f7fd6d0d40961bd53dd60cade32db6ed6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/47d2d8cade9b1c3987573d2943bb9352536cdb87", - "reference": "47d2d8cade9b1c3987573d2943bb9352536cdb87", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/81c4c51f7fd6d0d40961bd53dd60cade32db6ed6", + "reference": "81c4c51f7fd6d0d40961bd53dd60cade32db6ed6", "shasum": "" }, "require": { @@ -743,7 +743,7 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2016-03-07 14:04:32" + "time": "2016-04-05 16:36:54" }, { "name": "symfony/polyfill-mbstring", @@ -808,7 +808,7 @@ "packages-dev": [ { "name": "symfony/stopwatch", - "version": "v2.8.4", + "version": "v2.8.5", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", diff --git a/config.default.php b/config.default.php index 5656a770..49988a3b 100644 --- a/config.default.php +++ b/config.default.php @@ -50,6 +50,15 @@ define('DB_NAME', 'kanboard'); // Mysql/Postgres custom port (null = default port) define('DB_PORT', null); +// Mysql SSL key +define('DB_SSL_KEY', null); + +// Mysql SSL certificate +define('DB_SSL_CERT', null); + +// Mysql SSL CA +define('DB_SSL_CA', null); + // Enable LDAP authentication (false by default) define('LDAP_AUTH', false); diff --git a/doc/config.markdown b/doc/config.markdown index c1f08b99..2f88d306 100644 --- a/doc/config.markdown +++ b/doc/config.markdown @@ -87,6 +87,15 @@ define('DB_NAME', 'kanboard'); // Mysql/Postgres custom port (null = default port) define('DB_PORT', null); + +// Mysql SSL key +define('DB_SSL_KEY', null); + +// Mysql SSL certificate +define('DB_SSL_CERT', null); + +// Mysql SSL CA +define('DB_SSL_CA', null); ``` LDAP settings diff --git a/doc/mysql-configuration.markdown b/doc/mysql-configuration.markdown index 6bfb209d..9d60271c 100644 --- a/doc/mysql-configuration.markdown +++ b/doc/mysql-configuration.markdown @@ -1,5 +1,5 @@ -How to use Mysql or MariaDB instead of Sqlite -============================================= +Mysql/MariaDB Configuration +=========================== By default Kanboard use Sqlite to stores its data. However it's possible to use Mysql or MariaDB instead of Sqlite. @@ -8,7 +8,7 @@ Requirements ------------ - Mysql server -- The PHP extension `pdo_mysql` installed (Debian/Ubuntu: `apt-get install php5-mysql`) +- The PHP extension `pdo_mysql` installed Note: Kanboard is tested with **Mysql >= 5.5 and MariaDB >= 10.0** @@ -47,11 +47,26 @@ Note: You can also rename the template file `config.default.php` to `config.php` For the first time, Kanboard will run one by one each database migration and this process can take some time according to your configuration. -To avoid any issues or potential timeouts you can initialize the database directly by importing the SQL schema: +To avoid any potential timeout you can initialize the database directly by importing the SQL schema: ```bash mysql -u root -p my_database < app/Schema/Sql/mysql.sql ``` -The file `app/Schema/Sql/mysql.sql` is a sql dump that represents the last version of the database. +The file `app/Schema/Sql/mysql.sql` is a SQL dump that represents the last version of the database. +SSL configuration +----------------- + +These parameters have to be defined to enable the Mysql SSL connection: + +```php +// Mysql SSL key +define('DB_SSL_KEY', '/path/to/client-key.pem'); + +// Mysql SSL certificate +define('DB_SSL_CERT', '/path/to/client-cert.pem'); + +// Mysql SSL CA +define('DB_SSL_CA', '/path/to/ca-cert.pem'); +``` |