Skip to content

occ maintenance:install fails using MySQL with SSL enabled #19738

Description

@solracsf

Hello everyone,

The installation process fails directly when I enforce SSL for MySQL.

Steps to reproduce

  • Configure MySQL to force SSL connections CREATE USER ... REQUIRE SSL
  • Edit config.php to tell the driver the certificates' location
<?php
$CONFIG = array (
...
  'dbdriveroptions' => array(
    PDO::MYSQL_ATTR_SSL_KEY =>'/etc/xxx',
    PDO::MYSQL_ATTR_SSL_CERT =>'/etc/xxx',
    PDO::MYSQL_ATTR_SSL_CA => '/etc/xxx',
    PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => false,
  ),
...
);

Use occ to install

occ maintenance:install \
       --database "mysql" \
       --database-name "db_name" \
       --database-host=127.0.0.1 \
       --database-user "user" --database-pass "password" \
       --admin-user "user" --admin-pass "password"

Actual behaviour

The installation fails with

Error while trying to create admin user: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [1045] Access denied for user 'USER'@'%' (using password: YES)

and occ maintenance:install modifies the config.php file, turning this part:

  'dbdriveroptions' => array(
    PDO::MYSQL_ATTR_SSL_KEY =>'/etc/xxx',
    PDO::MYSQL_ATTR_SSL_CERT =>'/etc/xxx',
    PDO::MYSQL_ATTR_SSL_CA => '/etc/xxx',
    PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => false,
  ),

into

  'dbdriveroptions' => array(
    1007 => '/etc/xxx',
    1008 => '/etc/xxx',
    1009 => '/etc/xxx',
    1014 => false,
  ),

If I do the installation without enforcing SSL for MySQL, and that I define REQUIRE SSL for SQL user and dbdriveroptions AFTER INSTALLATION , everything works fine.

Expected behaviour

It should connect to mySQL server using SSL options defined in config.php

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions