Linux MySQL5.7等保问题整改:数据库未配置登录失败处理功能,未配置非法登录策略和登录超时自动退出功能。
等保问题整改:数据库未配置登录失败处理功能,未配置非法登录策略和登录超时自动退出功能。
·
文章目录
Linux MySQL5.7等保问题整改
问题:数据库未配置登录失败处理功能,未配置非法登录策略和登录超时自动退出功能
整改建议:建议数据库设置登录失败处理功能参数,至少满足登录失败次数超过5次采取非法登录锁定措施,登录远超时时间不大于10分钟,如安装CONNECTION_CONTROL和CONNECTION_CONTROL_FAILED_LOGIN_ATTEMPTS插件,可在命令行中输入。
install plugin CONNECTION_CONTROL soname 'connection_control.so';
INSTALL PLUGIN CONNECTION_CONTROL_FAILED_LOGIN_ATTEMPTS SONAME 'connection_control.so';
一、Linux登录MySQL数据库并查看是否开启登录失败和超时功能参数
mysql -u root -p
mysql> show variables like '%connection_control%';
Empty set (0.00 sec)
mysql> install plugin CONNECTION_CONTROL soname 'connection_control.so';
Query OK, 0 rows affected (0.16 sec)
mysql> install plugin CONNECTION_CONTROL_FAILED_LOGIN_ATTEMPTS soname 'connection_control.so';
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye
[root@localhost ~]#
二、修改配置文件my.cnf
vim /etc/my.cnf
#英文状态下输入:i 进入编辑模式
[mysqld]
connection-control-failed-connections-threshold=5
connection-control-min-connection-delay=300000
# 按ESC键 输入:wq 保存退出
三、重启MySQL服务,查看是否生效
# 重启MySQL服务
systemctl restart mysqld.service
# 登录MySQL
mysql -uroot -p
# 查看
show variables like '%connection_control%';
[root@localhost ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.36-log MySQL Community Server (GPL)
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
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> show variables like '%connection_control%';
+-------------------------------------------------+------------+
| Variable_name | Value |
+-------------------------------------------------+------------+
| connection_control_failed_connections_threshold | 5 |
| connection_control_max_connection_delay | 2147483647 |
| connection_control_min_connection_delay | 300000 |
+-------------------------------------------------+------------+
3 rows in set (0.01 sec)
mysql>
四、完成
更多推荐
已为社区贡献2条内容
所有评论(0)