0

有办法安全地让 Docker 容器动态编辑主机 iptables DROP 规则吗?

 2 years ago
source link: https://www.v2ex.com/t/840005
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

V2EX  ›  信息安全

有办法安全地让 Docker 容器动态编辑主机 iptables DROP 规则吗?

  theklf4 · 4 小时 32 分钟前 · 379 次点击
最近服务器经常被 CC 攻击,IP 经常变,手动封一次过几小时换几个 IP 又来了。于是想写一个脚本,每分钟扫描一次 Nginx 日志,发现异常 IP 就调用 iptables DROP (感觉直接 DROP 比返回 403 效果更好,而且我不想让 Nginx 执行 Lua 脚本,感觉不太安全)(另外如果未来加了不能套 Nginx 的自己写协议的服务也能用)但这样必须在主机上以 root 用户身份跑一个脚本,还动态根据包含用户输入的日志内容调用 iptables ,攻击面又增加了,万一用户构造了一个特殊的 payload ,我的程序没有正常过滤,直接拼接进 iptables 命令,攻击者就可以逃逸到主机了,比在容器内让 Nginx 跑 Lua 脚本还不安全。请问有办法安全地让 Docker 容器动态编辑主机 iptables DROP 规则吗?

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK