3

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',
                     ),
      ),
  ),
); 
3
  • What errors do you get ? (in the error log)
    – CamelCode
    Mar 8, 2016 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' Mar 8, 2016 at 15:26
  • Hmmm.... I'm actually getting a syntax error: unexpected ',' in /sites/default/settings.php on line 236 Mar 8, 2016 at 15:28

1 Answer 1

6

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',
      ),
  ),
); 
4
  • 4
    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. Aug 22, 2017 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, 2018 at 15:50
  • 2
    Thanks to Onur kucukece. It doesn't work on AWS as well without the ( PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => false) param Oct 11, 2019 at 15:10
  • Thanks @SimonHanks for you comment. This actually save my time :) Cheers Mar 23, 2021 at 4:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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