MySQL等保测评整改:连接控制插件connection_control安装及策略配置

作者:Chengda Zhang(张成达)

Oracle ACE Associate: Database

在平台的运行环境中,会根据等保测评要求,进行登录失败采取必要的措施,如:登录失败5次锁定帐户等,配置登录连接超时处理功能。本文将介绍如何安装连接控制插件以及设置相应的策略。
一、查询插件是否安装
show plugins;

二、安装插件
在mysql5.7后mysql/data/lib/plugin目录默认增加了connection_control.so插件,安装即可:

install plugin connection_control soname "connection_control.so"; 
#登录错误次数限制插件
install plugin connection_control_failed_login_attempts soname 'connection_control.so';
 #为了把错误次数记录到表中


三、设置插件
查询一下安装状态
show variables like "%connection_control%";
解释:
connection_control_failed_connections_threshold :连续失败最大次数3次,0表示不开启
connection_control_max_connection_delay :超过最大失败次数之后阻塞登录最大时间(毫秒)
connection_control_min_connection_delay :超过最大失败次数之后阻塞登录最小时间(毫秒)

修改配置命令:
set global connection_control_max_connection_delay=2147483647;
set global connection_control_failed_connections_threshold=5;
set global connection_control_min_connection_delay=600000;


四、修改my.cnf配置文件
[mysqld]
plugin-load-add = connection_control.so
connection-control = FORCE
connection-control-failed-login-attempts = FORCE
connection_control_min_connection_delay = 600000
connection_control_max_connection_delay = 2147483647
connection_control_failed_connections_threshold    = 5

五、查询插件状态
show status like "%connection_control%";

Connection_control_delay_generated:表示连接控制的使用次数(可用户判断是否存在暴力登录尝试)
重新配置connection_control_failed_connections_threshold变量,该表记录会被删除(重置)

六、查询各账号登录失败次数

use information_schema;
select * from connection_control_failed_login_attempts;

如果使用不存在的用户登录,则该表记录用户名为空,但会记录具体登录的IP。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值