MYSQL数据库mysql通过ssl的方式生成秘钥具体生成步骤

MYSQL数据库mysql通过ssl的方式生成秘钥具体生成步骤,第1张

概述介绍《MYSQL数据库mysql通过ssl的方式生成秘钥具体生成步骤》开发教程,希望对您有用。

《MysqL数据库MysqL通过ssl的方式生成秘钥具体生成步骤》要点:
本文介绍了MysqL数据库MysqL通过ssl的方式生成秘钥具体生成步骤,希望对您有用。如果有疑问,可以联系我们。

-- MysqL ssl 生成秘钥
1 check ssl是否已经开启
MysqL> show variables like '%ssl%';
+---------------+----------+
| Variable_name | Value |
+---------------+----------+
| have_openssl | Disabled |
| have_ssl | Disabled |
| ssl_ca | |
| ssl_capath | |
| ssl_cert | |
| ssl_cipher | |
| ssl_crl | |
| ssl_crlpath | |
| ssl_key | |
+---------------+----------+
9 rows in set (0.00 sec)

2 没有开启,所以打开
在my.cnf末尾端设置ssl 参数,然后重新启动MysqL服务即可
MysqL> show variables like '%ssl%';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| have_openssl | YES |
| have_ssl | YES |
| ssl_ca | |
| ssl_capath | |
| ssl_cert | |
| ssl_cipher | |
| ssl_crl | |
| ssl_crlpath | |
| ssl_key | |
+---------------+-------+
9 rows in set (0.00 sec)

3 通过openssl生成证书的配置,在MysqL db server上生成秘钥
mkdir -p /etc/MysqL/newcerts/
cd /etc/MysqL/newcerts/
3.1 openssl genrsa 2048 > ca-key.pem
3.2 openssl req -new -x509 -nodes -days 1000 -key ca-key.pem > ca-cert.pem
[root@MysqL newcerts]# openssl req -new -x509 -nodes -days 1000 -key ca-key.pem > ca-cert.pem
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a distinguished name or a DN.
There are quite a few fIElds but you can leave some blank
For some fIElds there will be a default value,
If you enter '.',the fIEld will be left blank.
-----
Country name (2 letter code) [XX]:ch
State or Province name (full name) []:shh
Locality name (eg,city) [Default City]:shh
Organization name (eg,company) [Default Company Ltd]:xx
Organizational Unit name (eg,section) []:db
Common name (eg,your name or your server''s hostname) []:MysqL.yest.nos
Email Address []:xx@xx.com
3.3 openssl req -newkey rsa:2048 -days 1000 -nodes -keyout server-key.pem > server-req.pem
[root@MysqL newcerts]# openssl req -newkey rsa:2048 -days 1000 -nodes -keyout server-key.pem > server-req.pem
Generating a 2048 bit RSA private key
.......................................................................................................+++
..........................................................+++
writing new private key to 'server-key.pem'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a distinguished name or a DN.
There are quite a few fIElds but you can leave some blank
For some fIElds there will be a default value,city) [Default City]:ssh
Organization name (eg,your name or your server''s hostname) []:MysqL.yest.nos
Email Address []:xx@xx.com
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:820923
An optional company name []:xx

4 在MysqL db server客户端生成ssl文件
4.1 openssl x509 -req -in server-req.pem -days 1000 -CA ca-cert.pem -CAkey ca-key.pem -set_serial 01 > server-cert.pem
[root@MysqL newcerts]# openssl x509 -req -in server-req.pem -days 1000 -CA ca-cert.pem -CAkey ca-key.pem -set_serial 01 > server-cert.pem
Signature ok
subject=/C=ch/ST=shh/L=ssh/O=ea/OU=db/CN=MysqL.yest.nos/emailAddress=cm@xx.com
Getting CA Private Key
4.2 openssl req -newkey rsa:2048 -days 1000 -nodes -keyout clIEnt-key.pem > clIEnt-req.pem
[root@MysqL newcerts]# openssl req -newkey rsa:2048 -days 1000 -nodes -keyout clIEnt-key.pem > clIEnt-req.pem
Generating a 2048 bit RSA private key
.......+++
........................................................+++
writing new private key to 'clIEnt-key.pem'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a distinguished name or a DN.
There are quite a few fIElds but you can leave some blank
For some fIElds there will be a default value,your name or your server''s hostname) []:MysqL.yest.nos
Email Address []:cx@xx.com
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:820923
An optional company name []:xx
4.3
openssl x509 -req -in clIEnt-req.pem -days 1000 -CA ca-cert.pem -CAkey ca-key.pem -set_serial 01 > clIEnt-cert.pem
[root@MysqL newcerts]# openssl x509 -req -in clIEnt-req.pem -days 1000 -CA ca-cert.pem -CAkey ca-key.pem -set_serial 01 > clIEnt-cert.pem
Signature ok
subject=/C=ch/ST=shh/L=shh/O=ea/OU=db/CN=MysqL.yest.nos/emailAddress=cm@xx.com
Getting CA Private Key

5
[]copy clent.* 3个文件到客户端机器上面/opt/MysqL/ssl/去.

6 登陆验证
MysqL -uxxx -pxxxx --ssl-ca=/opt/MysqL/ssl/ca-cert.pem --ssl-cert=/opt/MysqL/ssl/server-cert.pem --ssl-key=/opt/MysqL/ssl/server-key.pem
conferce:http://www.docin.com/p-151590189.HTML

《MysqL数据库MysqL通过ssl的方式生成秘钥具体生成步骤》是否对您有启发,欢迎查看更多与《MysqL数据库MysqL通过ssl的方式生成秘钥具体生成步骤》相关教程,学精学透。内存溢出PHP学院为您提供精彩教程。

总结

以上是内存溢出为你收集整理的MYSQL数据库mysql通过ssl的方式生成秘钥具体生成步骤全部内容,希望文章能够帮你解决MYSQL数据库mysql通过ssl的方式生成秘钥具体生成步骤所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/sjk/1153800.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-06-01
下一篇2022-06-01

发表评论

登录后才能评论

评论列表(0条)

    保存