六月婷婷综合激情-六月婷婷综合-六月婷婷在线观看-六月婷婷在线-亚洲黄色在线网站-亚洲黄色在线观看网站

明輝手游網(wǎng)中心:是一個(gè)免費(fèi)提供流行視頻軟件教程、在線學(xué)習(xí)分享的學(xué)習(xí)平臺(tái)!

SSL連接的案例圖文說(shuō)明教程

[摘要]MySQL 5.7--------SSL連接最佳實(shí)戰(zhàn)1. 背景 * 在生產(chǎn)環(huán)境下,安全總是無(wú)法忽視的問(wèn)題,數(shù)據(jù)庫(kù)安全則是重中之重,因?yàn)樗械臄?shù)據(jù)都存放在數(shù)據(jù)庫(kù)中 * 當(dāng)使用非加密方式連接MySQL數(shù)據(jù)庫(kù)時(shí),在網(wǎng)絡(luò)中傳輸?shù)乃行畔⒍际敲魑牡模梢员痪W(wǎng)絡(luò)中所有人截取,敏感信息可能被泄露。在傳送...
MySQL 5.7--------SSL連接最佳實(shí)戰(zhàn)

1. 背景

* 在生產(chǎn)環(huán)境下,安全總是無(wú)法忽視的問(wèn)題,數(shù)據(jù)庫(kù)安全則是重中之重,因?yàn)樗械臄?shù)據(jù)都存放在數(shù)據(jù)庫(kù)中

* 當(dāng)使用非加密方式連接MySQL數(shù)據(jù)庫(kù)時(shí),在網(wǎng)絡(luò)中傳輸?shù)乃行畔⒍际敲魑牡模梢员痪W(wǎng)絡(luò)中所有人截取,敏感信息可能被泄露。在傳送敏感信息(如密碼)時(shí),可以采用SSL連接的方式。

* 版本小于5.7.6時(shí)按照 MySQL 5.6 SSL配置的方式進(jìn)行。

2. MySQL 連接方式

* socket連接

* TCP非SSL連接

* SSL安全連接

* SSL + 密碼連接 [version > MySQL 5.7.5]

   * SSL + 密碼 + 密鑰連接

3. SSL 簡(jiǎn)介

* SSL指的是SSL/TLS,其是一種為了在計(jì)算機(jī)網(wǎng)絡(luò)進(jìn)行安全通信的加密協(xié)議。假設(shè)用戶的傳輸不是通過(guò)SSL的方式,那么其在網(wǎng)絡(luò)中以明文的方式進(jìn)行傳輸,而這給別有用心的人帶來(lái)了可乘之機(jī)。所以,現(xiàn)在很多網(wǎng)站其實(shí)默認(rèn)已經(jīng)開(kāi)啟了SSL功能,比如Facebook、Twtter、YouTube、淘寶等。

SSL連接的實(shí)例教程

4. 環(huán)境 [ 關(guān)閉SeLinux ]

* system 環(huán)境

[root@MySQL ~]# cat /etc/redhat-release
CentOS release 6.9 (Final)
[root@MySQL ~]# uname -r
2.6.32-696.3.2.el6.x86_64
[root@MySQL ~]# getenforce
Disabled

* MySQL 環(huán)境 [ MySQL 5.7安裝前面篇章已做詳細(xì)介紹 ]

have_openssl 與 have_ssl 值都為DISABLED表示ssl未開(kāi)啟

[root@MySQL ~]# mysql -p'123'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.7.18 MySQL Community Server (GPL)
Copyright (c) 2000, 2017, 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> select version();
+-----------+
version()
+-----------+
5.7.18
+-----------+
1 row in set (0.00 sec)
mysql> show variables like 'have%ssl%';
+---------------+----------+
Variable_name Value
+---------------+----------+
have_openssl DISABLED
have_ssl DISABLED
+---------------+----------+
2 rows in set (0.02 sec)
mysql> show variables like 'port';
+---------------+-------+
Variable_name Value
+---------------+-------+
port 3306
+---------------+-------+
1 row in set (0.01 sec)
mysql> show variables like 'datadir';
+---------------+-------------------+
Variable_name Value
+---------------+-------------------+
datadir /data/mysql_data/
+---------------+-------------------+
1 row in set (0.01 sec)

5. SSL配置

* 利用自帶工具生成SSL相關(guān)文件

[root@MySQL ~]# /usr/local/mysql/bin/mysql_ssl_rsa_setup --datadir=/data/mysql_data
Generating a 2048 bit RSA private key
..........................................................................+++
.....+++
writing new private key to 'ca-key.pem'
-----
Generating a 2048 bit RSA private key
.......................................................................................................................................................................+++
...+++
writing new private key to 'server-key.pem'
-----
Generating a 2048 bit RSA private key
.....................+++
...........................................+++
writing new private key to 'client-key.pem'
-----
* 查看生成的SSL文件
[root@MySQL ~]# ls -l /data/mysql_data/*.pem
-rw------- 1 root root 1679 Jun 24 20:54 /data/mysql_data/ca-key.pem
-rw-r--r-- 1 root root 1074 Jun 24 20:54 /data/mysql_data/ca.pem
-rw-r--r-- 1 root root 1078 Jun 24 20:54 /data/mysql_data/client-cert.pem
-rw------- 1 root root 1675 Jun 24 20:54 /data/mysql_data/client-key.pem
-rw------- 1 root root 1675 Jun 24 20:54 /data/mysql_data/private_key.pem
-rw-r--r-- 1 root root 451 Jun 24 20:54 /data/mysql_data/public_key.pem
-rw-r--r-- 1 root root 1078 Jun 24 20:54 /data/mysql_data/server-cert.pem
-rw------- 1 root root 1675 Jun 24 20:54 /data/mysql_data/server-key.pem
* 重啟 MySQL 服務(wù)
[root@MySQL ~]# /etc/init.d/mysqld restart
Shutting down MySQL.. SUCCESS!
Starting MySQL. SUCCESS!
* 連接MySQL 查看SSL開(kāi)啟狀態(tài)

have_openssl 與 have_ssl 值都為YES表示ssl開(kāi)啟成功

mysql> show variables like 'have%ssl%';
+---------------+-------+
Variable_name Value
+---------------+-------+
have_openssl YES
have_ssl YES
+---------------+-------+
2 rows in set (0.03 sec)

6. SSL + 密碼連接測(cè)試

* 創(chuàng)建用戶并指定 SSL 連接 [ MySQL 5.7后推薦使用create user 方式創(chuàng)建用戶 ]

mysql> create user 'ssl_test'@'%' identified by '123' require SSL;
Query OK, 0 rows affected (0.00 sec)
* 通過(guò)密碼連接測(cè)試 [ 默認(rèn)采用SSL連接,需要指定不使用SSL連接 ]
[root@MySQL ~]# mysql -h 192.168.60.129 -ussl_test -p'123' --ssl=0
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'ssl_test'@'192.168.60.129' (using password: YES)
* 通過(guò) SSL + 密碼 連接測(cè)試

SSL: Cipher in use is DHE-RSA-AES256-SHA 表示通過(guò)SSL連接

[root@MySQL ~]# mysql -h 192.168.60.129 -ussl_test -p'123' --ssl
mysql: [Warning] Using a password on the command line interface can be insecure.
WARNING: --ssl is deprecated and will be removed in a future version. Use --ssl-mode instead.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 5.7.18 MySQL Community Server (GPL)
Copyright (c) 2000, 2017, 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> \s
--------------
mysql Ver 14.14 Distrib 5.7.18, for linux-glibc2.5 (x86_64) using EditLine wrapper
Connection id: 12
Current database:
Current user: ssl_test@192.168.60.129
SSL: Cipher in use is DHE-RSA-AES256-SHA
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.7.18 MySQL Community Server (GPL)
Protocol version: 10
Connection: 192.168.60.129 via TCP/IP
Server characterset: latin1
Db characterset: latin1
Client characterset: utf8
Conn. characterset: utf8
TCP port: 3306
Uptime: 7 min 34 sec
Threads: 1 Questions: 29 Slow queries: 0 Opens: 112 Flush tables: 1 Open tables: 105 Queries per second avg: 0.063
--------------

7. SSL + 密碼 + 密鑰連接

* 創(chuàng)建用戶并指定 X509 [ SSL+密鑰 ] 連接 [ MySQL 5.7后推薦使用create user 方式創(chuàng)建用戶 ]

mysql> create user 'X509_test'@'%' identified by '123' require X509;
Query OK, 0 rows affected (0.00 sec)
* 通過(guò)密碼連接測(cè)試
[root@MySQL ~]# mysql -h 192.168.60.129 -uX509_test -p'123' --ssl=0
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'X509_test'@'192.168.60.129' (using password: YES)
* 通過(guò) SSL +密碼 連接測(cè)試
[root@MySQL ~]# mysql -h 192.168.60.129 -uX509_test -p'123' --ssl
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'X509_test'@'192.168.60.129' (using password: YES)
* 通過(guò) SSL + 密碼+密鑰連接測(cè)試

  SSL: Cipher in use is DHE-RSA-AES256-SHA 表示通過(guò)SSL連接

[root@MySQL ~]# mysql -h 192.168.60.129 -uX509_test -p'123' --ssl-cert=/data/mysql_data/client-cert.pem --ssl-key=/data/mysql_data/client-key.pem
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 21
Server version: 5.7.18 MySQL Community Server (GPL)
Copyright (c) 2000, 2017, 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> \s
--------------
mysql Ver 14.14 Distrib 5.7.18, for linux-glibc2.5 (x86_64) using EditLine wrapper
Connection id: 21
Current database:
Current user: X509_test@192.168.60.129
SSL: Cipher in use is DHE-RSA-AES256-SHA
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.7.18 MySQL Community Server (GPL)
Protocol version: 10
Connection: 192.168.60.129 via TCP/IP
Server characterset: latin1
Db characterset: latin1
Client characterset: utf8
Conn. characterset: utf8
TCP port: 3306
Uptime: 18 min 27 sec
Threads: 1 Questions: 40 Slow queries: 0 Opens: 118 Flush tables: 1 Open tables: 111 Queries per second avg: 0.036
--------------

以上就是SSL連接的實(shí)例教程的詳細(xì)內(nèi)容,更多請(qǐng)關(guān)注php中文網(wǎng)其它相關(guān)文章!


學(xué)習(xí)教程快速掌握從入門到精通的SQL知識(shí)。




主站蜘蛛池模板: 日本a级片免费看 | 片成年免费观看网站黄 | 亚洲日韩中文字幕一区 | 日本最新免费网站 | 欧美一级鲁丝片免费看 | 欧美亚洲国产精品久久高清 | 日韩在线免费 | 天天干 夜夜操 | 亚洲美女综合 | 四虎中文字幕 | 视频一区二区三区欧美日韩 | 亚洲精品有码在线观看 | 青娱娱乐盛宴免费一二区 | 欧美综合国产精品日韩一 | 亚洲精品老司机 | 日本久久免费大片 | 性8成人有声小说在线播放 性 色 黄 一级 | 夜久久| 亚洲是色 | 日本亚洲最大的色成网站www | 天堂在线观看中文字幕 | 日本视频免费在线 | 深夜免费在线观看 | 亚州黄网 | 亚洲欧美综合色区小说 | 五月婷婷六月激情 | 清纯制服被啪啪护士 | 天天狠狠弄夜夜狠狠躁·太爽了 | 香蕉网站狼人久久五月亭亭 | 日本免费色 | 四虎影视国产884a精品亚洲 | 日韩理论片在线观看电视 | 四虎在线最新永久免费播放 | 亚洲男人的天堂网站 | 亚洲第一页视频 | 日韩精品一区二区三区中文在线 | 中文字幕一区二区三区免费视频 | 手机在线观看亚洲国产精品 | 欧洲一区麻豆文化传媒 | 日韩一级免费毛片 | 天天弄天天模 |