2

Running Drupal 7 and trying to enable secure connection between my AWS EC2 and RDS server using SSL.

Php version 5.3.29

I have found some information suggesting the following setup but I'm unsure how to configure this given my own SSL certs and the single certificate bundle I have from amazon?

When I try the below config I get a 500 server error.

Any pointers much appreciated.

$databases = array (
  'default' => 
  array (
    'default' => 
    array (
      'database' => 'database name',
      'username' => 'username',
      'password' => 'password',
      'host' => 'AWS RDS Endpoint',
      'port' => '',
      'driver' => 'mysql',
      'prefix' => '',
      'pdo' => array (
            PDO::MYSQL_ATTR_SSL_KEY => '/path_to_your/client-key.pem',
            PDO::MYSQL_ATTR_SSL_CERT => '/path_to_your/client-cert.pem',
            PDO::MYSQL_ATTR_SSL_CA => '/path_to_your/ca-cert.pem',
                     ),
      ),
  ),
); 
  • What errors do you get ? (in the error log) – CamelCode Mar 8 '16 at 15:18
  • On closer inspection (php.net/manual/en/ref.pdo-mysql.php) those PDO options only 'exist as of PHP 5.3.7' – Danny Browne Mar 8 '16 at 15:26
  • Hmmm.... I'm actually getting a syntax error: unexpected ',' in /sites/default/settings.php on line 236 – Danny Browne Mar 8 '16 at 15:28
4

Figured it out and required SSL via phpmyadmin admin interface for my users.

There are my Drupal database params

$databases = array (
  'default' => 
  array (
    'default' => 
    array (
      'database' => 'database name',
      'username' => 'username',
      'password' => 'password',
      'host' => 'AWS RDS Endpoint',
      'port' => '',
      'driver' => 'mysql',
      'prefix' => '',
      'pdo' => array(
        PDO::MYSQL_ATTR_SSL_CA => '<path to>/rds-combined-ca-bundle.pem',
      ),
  ),
); 
  • 1
    If it would be Azure, PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => false option would also be necessary. I've spent hours, didn't want anyone else does. – Onur Kucukkece Aug 22 '17 at 18:32
  • Well, at least I found it now, but I've certainly just spent hours on this as well... /sadlife – JohannesB May 5 '18 at 15:50
  • 1
    Thanks to Onur kucukece. It doesn't work on AWS as well without the ( PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => false) param – Simon Hanks Oct 11 at 15:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.