如何有效防止MySQL Connection Control插件密码暴力破解?
摘要:Connection Control 是 MySQL 8.0 引入的一个安全功能插件,后移植到 MySQL 5.7.17 和 5.6.35 版本。 其核心功能是:当客户端因账号或密码错误连续多次登录失败时,服务端会对该客户端的后续请求进行延
Connection Control 是 MySQL 8.0 引入的一个安全功能插件,后移植到 MySQL 5.7.17 和 5.6.35 版本。
其核心功能是:当客户端因账号或密码错误连续多次登录失败时,服务端会对该客户端的后续请求进行延迟处理,且失败次数越多,延迟时间越长。这一机制能显著增加密码被暴力破解的耗时,从而有效遏制此类攻击。
适用场景:
面向公网开放的 MySQL 服务器。
合规性与安全性要求较高的环境。
插件效果
首先我们看看该插件的效果。
# time mysql -h10.0.0.108 -uroot -p123
ERROR 1045 (28000): Access denied for user 'root'@'10.0.0.75' (using password: YES)
real 0m0.013s
# time mysql -h10.0.0.108 -uroot -p123
ERROR 1045 (28000): Access denied for user 'root'@'10.0.0.75' (using password: YES)
real 0m0.013s
# time mysql -h10.0.0.108 -uroot -p123
ERROR 1045 (28000): Access denied for user 'root'@'10.0.0.75' (using password: YES)
real 0m0.013s
# time mysql -h10.0.0.108 -uroot -p123
ERROR 1045 (28000): Access denied for user 'root'@'10.0.0.75' (using password: YES)
real 0m1.013s
# time mysql -h10.0.0.108 -uroot -p123
ERROR 1045 (28000): Access denied for user 'root'@'10.0.0.75' (using password: YES)
real 0m2.013s
# time mysql -h10.0.0.108 -uroot -p123
ERROR 1045 (28000): Access denied for user 'root'@'10.0.0.75' (using password: YES)
real 0m3.014s
前三次没有延迟,第四次开始延迟 1 秒,之后每次失败都会增加 1 秒的延迟。
