如何获取Amazon MySQL RDS证书

时间:2011-06-24 04:59:44

标签: mysql amazon-rds

Amazon RDS文档(http://aws.amazon.com/rds/faqs/#53)指定“Amazon RDS为每个[MySQL]数据库实例生成SSL证书”。我无法找到有关如何查找证书的任何文档,并且在管理控制台中找不到证书。

证书在哪里?

3 个答案:

答案 0 :(得分:19)

我在这里找到了解决方案:https://forums.aws.amazon.com/thread.jspa?threadID=62110

curl -O https://s3.amazonaws.com/rds-downloads/mysql-ssl-ca-cert.pem

  • 连接到mysql:
mysql -uusername -p --host=host --ssl-ca=mysql-ssl-ca-cert.pem
  • 检查您的连接是否真正加密:
mysql> SHOW STATUS LIKE 'Ssl_cipher';
+---------------+------------+
| Variable_name | Value      |
+---------------+------------+
| Ssl_cipher    | AES256-SHA |
+---------------+------------+
1 row in set (0.00 sec)
  • (可选)强制SSL为特定用户连接到MySQL

mysql> ALTER USER 'username'@'host|%' REQUIRE SSL

答案 1 :(得分:4)

您可以从AWS文档指南本身获取AWS RDS证书文件信息

http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_MySQL.html

从此处下载证书

https://rds.amazonaws.com/doc/mysql-ssl-ca-cert.pem

更新 - 亚马逊更新了SSL证书,您可以从此处下载:https://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem

使用以下命令登录mysql

root@sathish:/usr/src# mysql -h awssathish.xxyyzz.eu-west-1.rds.amazonaws.com -u awssathish -p --ssl-ca=mysql-ssl-ca-cert.pem
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 22
Server version: 5.6.13-log MySQL Community Server (GPL)

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 
mysql> GRANT USAGE ON *.* TO ‘awssathish’@’%’ REQUIRE SSL
Query OK, 0 rows affected (0.02 sec)
mysql> 
mysql> show variables like "%ssl";
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| have_openssl  | YES   |
| have_ssl      | YES   |
+---------------+-------+
2 rows in set (0.00 sec)
mysql> 
mysql> SHOW STATUS LIKE 'Ssl_cipher';
+---------------+------------+
| Variable_name | Value      |
+---------------+------------+
| Ssl_cipher    | AES256-SHA |
+---------------+------------+
1 row in set (0.01 sec)

mysql> exit
Bye

哪里

<强> awssathish.xxyyzz.eu-west-1.rds.amazonaws.com

是RDS的终点,

<强> awssathish

是rds服务器的用户名

答案 2 :(得分:1)

我使用了http://aws-blog.io/2016/rds-over-ssl/ 你必须为该区域获得root pem和pem并将2个文件连接在一起。     https://s3.amazonaws.com/rds-downloads/rds-ca-2015-us-west-2.pem     https://s3.amazonaws.com/rds-downloads/rds-ca-2015-root.pem

合并文件以获得单个rds-ca-2015-us-west-2-bundle.pem文件。 使用--ssl-ca为您的pem文件提供完整路径。