Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Update TLS certs for Amazon RDS instances #2130

Closed
ls-pieter-vanisacker opened this issue Jul 12, 2023 · 1 comment · Fixed by #2131
Closed

Update TLS certs for Amazon RDS instances #2130

ls-pieter-vanisacker opened this issue Jul 12, 2023 · 1 comment · Fixed by #2131

Comments

@ls-pieter-vanisacker
Copy link

It seems like the current version, 3.5.1 is unable to connect successfully to RDS instances using the rds-ca-rsa2048-g1 certificate authority.

Example code:

// get the client
const mysql = require('mysql2');

// create the connection to database
const connection = mysql.createConnection({
  host: 'xyz.c8dqrcnbng7v.eu-west-1.rds.amazonaws.com',
  port: 3306,
  user: 'abc',
  password: 'abc',
  database: 'information_schema',
  ssl: "Amazon RDS"
});

// simple query
connection.query(
  'show tables;',
  function(err, results, fields) {
    console.log(results); // results contains rows returned by server
    console.log(fields); // fields contains extra meta data about results, if available
  }
);

Throws the following:

undefined
undefined
Error: unable to get local issuer certificate
    at TLSSocket.onConnectSecure (node:_tls_wrap:1539:34)
    at TLSSocket.emit (node:events:513:28)
    at TLSSocket._finishInit (node:_tls_wrap:953:8)
    at TLSWrap.ssl.onhandshakedone (node:_tls_wrap:734:12) {
  code: 'HANDSHAKE_SSL_ERROR',
  fatal: true
}
@sidorares
Copy link
Owner

thanks for the report @ls-pieter-vanisacker , I'll check that. Likely a side effect of #2119

Could you try with ssl: { rejectUnauthorized: false, ca: [ copy from https://github.com/sidorares/node-mysql2/blob/af6b6dcc63709956a06a09131ac7cc152a09b3d5/lib/constants/ssl_profiles.js#L8 ] } ?

alexjurkiewicz added a commit to alexjurkiewicz/node-mysql2 that referenced this issue Jul 13, 2023
sidorares pushed a commit that referenced this issue Mar 26, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants