wordpress建站前端,wordpress导航源码,天津建设,南昌做建网站的接上一篇#xff1a;企业实战_22_MyCatSQL拦截 https://blog.csdn.net/weixin_40816738/article/details/100073474 文章目录1. SQL防火墙_白名单配置2. 白名单测试3. SQL防火墙_黑名单配置4. SQL防火墙_黑名单测试SQL防火墙#xff1a;包括2个标签whitehost/whi… 接上一篇企业实战_22_MyCatSQL拦截 https://blog.csdn.net/weixin_40816738/article/details/100073474 文章目录1. SQL防火墙_白名单配置2. 白名单测试3. SQL防火墙_黑名单配置4. SQL防火墙_黑名单测试SQL防火墙包括2个标签whitehost/whitehostblacklist/blacklist
白名单白名单设置允许访问的ip 和 用户黑名单配置黑名单的列表配置mycat对那些操作进行限制
1. SQL防火墙_白名单配置
# 配置白名单
# 只允许192.168.92.104服务器并且是app_imooc用户的访问mycat
vim /app/mycat/conf/server.xml firewallwhitehosthost host192.168.92.104 userapp_imooc/host/whitehost/firewall注释防火墙标签要在user标签前面
2. 白名单测试
使用app_imooc用户在192.168.92.101服务器登录mycat测试
[rootnode1 ~]# mysql -uapp_imooc -p -h192.168.92.101 -P8066
Enter password:
ERROR 1045 (HY000): Access denied for user app_imooc with host 192.168.92.101
[rootnode1 ~]#使用app_imooc用户在192.168.92.104服务器登录mycat测试
[rootnode4 ~]# mysql -uapp_imooc -p -h192.168.92.101 -P8066
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.29-mycat-1.6.5-release-20180122220033 MyCat Server (OpenCloundDB)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.mysql3. SQL防火墙_黑名单配置
# 配置黑名单
# 不允许删除不写where条件
vim /app/mycat/conf/server.xml
添加内容而下 !-- sql防火墙 配置 --firewallwhitehost!-- 设置允许访问的用户和服务器主机 --host host192.168.43.101 userapp_imooc/host/whitehost!-- 是否开启黑名单校验 --blacklist checktrue!-- 设置mycat对那些操作进行限制 --property namedeleteWhereNoneChecktrue/property/blacklist/firewall4. SQL防火墙_黑名单测试
# 重启启动mycat
mycat stop
mycat start# 使用app_imooc用户在192.168.92.104服务器登录mycat测试
[rootnode4 ~]# mysql -uapp_imooc -p -h192.168.92.101 -P8066
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.29-mycat-1.6.5-release-20180122220033 MyCat Server (OpenCloundDB)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 use imooc_db;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -ADatabase changed
mysql delete from order_master;
ERROR 3012 (HY000): The statement is unsafe SQL, reject for user app_imooc
mysql 从上图可以得出结论黑名单生效了
下一篇企业实战_24_MyCat实现读写分离 https://gblfy.blog.csdn.net/article/details/100103666