1. 程式人生 > 實用技巧 >等保稽核 --- MySQL連線控制外掛

等保稽核 --- MySQL連線控制外掛

環境介紹:

系統版本:Centos 7

MySQL版本: 5.7.19(只有5.7.17版本後才有此外掛)

架構: 主從架構

控制外掛:

1). CONNECTION_CONTROL: 控制登入失敗的次數及延遲響應時間
2). CONNECTION_CONTROL_FAILED_LOGIN_ATTEMPTS: 記錄登入失敗的操作日誌

操作過程:

1). 安裝外掛
2). 安裝後配置
3). 增加至配置檔案中

配置說明:

1). connection_control_min_connection_delay = 3000 : 當超過允許失敗的次數時,將會延遲登入,此為最小延遲登入時間
2). connection_control_max_connection_delay = 86400 : 最大延遲登入時間

3). connection_control_failed_connections_threshold = 2 : 允許驗證的次數

一、 安裝外掛

mysql> install plugin connection_control soname 'connection_control.so';
mysql> show plugins;
CONNECTION_CONTROL | ACTIVE | AUDIT | connection_control.so | GPL

mysql> show variables like '%connection_control%';
+-------------------------------------------------+-------+
| Variable_name | Value                      |
+-------------------------------------------------+-------+
| connection_control_failed_connections_threshold | 3
   | | connection_control_max_connection_delay | 86400 | | connection_control_min_connection_delay | 6000 | +-------------------------------------------------+-------+

二、 配置外掛中引數

mysql> set global connection_control_failed_connections_threshold=2;
mysql> set global connection_control_min_connection_delay=3000
;

三、 根據自己環境配置到配置檔案中固定

~]# vim /etc/my.cnf
# 連線控制外掛,重啟後生效;
plugin-load-add = connection_control.so
connection_control_min_connection_delay = 3000
connection_control_max_connection_delay = 86400
connection_control_failed_connections_threshold = 2