简体   繁体   中英

Connect laravel 5 to AWS RDS with SSL

I was reading this question and this article .

'your_connection' => array(
  'driver'  => 'mysql',
  'host'    => $host,
  'database'  => $database,
  'username'  => $username,
  'password'  => $password,
  'charset'   => 'utf8',
  'collation' => 'utf8_unicode_ci',
  'prefix'  => '',
  'options' => array(
    PDO::MYSQL_ATTR_SSL_KEY => $cert_base . '/client-key.pem',
    PDO::MYSQL_ATTR_SSL_CERT => $cert_base . '/client-cert.pem',
    PDO::MYSQL_ATTR_SSL_CA => $cert_base . '/ca-cert.pem'
  ),
),

From what I understand, PDO::MYSQL_ATTR_SSL_CA , is can be downloaded from here

I am not sure PDO::MYSQL_ATTR_SSL_KEY and PDO::MYSQL_ATTR_SSL_CERT

I read something like this

openssl genrsa 2048 > ca-key.pem
openssl req -sha1 -new -x509 -nodes -days 3650 -key ca-key.pem > ca-cert.pem

It seems that is what I need to do, could anyone confirm?

To connect to AWS RDS via SSL in Laravel you only need to do a few things.

Download the rds-combined-ca-bundle.pem file from:

https://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem

Then place it in your configuration like this:

'options' => array(    
    PDO::MYSQL_ATTR_SSL_CA => $cert_base . '/rds-combined-ca-bundle.pem'
 ),

It doesn't require the other two keys to connect.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM