加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

Docker – 从容器修改主机的IPTABLES

发布时间:2020-12-16 03:33:45 所属栏目:安全 来源:网络整理
导读:我想运行一个带有中央日志和fail2ban服务的docker容器来防止dos / ddos??攻击. 我有一个问题是运行具有这种功能的容器,它也可以修改主机iptables. 有一个项目ianblenke/docker-fail2ban然而它不起作用 赋予容器标志特权只允许我控制此容器上的iptables.有没

我想运行一个带有中央日志和fail2ban服务的docker容器来防止dos / ddos??攻击.

我有一个问题是运行具有这种功能的容器,它也可以修改主机iptables.

有一个项目ianblenke/docker-fail2ban然而它不起作用……

赋予容器标志特权只允许我控制此容器上的iptables.有没有办法通过容器控制主机iptables?

问候.

最佳答案
默认情况下,Docker容器在隔离的网络命名空间内运行,在该命名空间中,它们无法访问主机网络配置(包括iptables).

如果希望容器能够修改主机的网络配置,则需要将–net = host选项传递给docker run.从docker-run(1)手册页:

--net="bridge"
   Set the Network mode for the container
       'bridge': creates a new network stack for the container on the docker bridge
       'none': no networking for this container
       'container:': reuses another container network stack
       'host':  use  the host network stack inside the container.
       Note: the host mode gives the container full access to
       local system services such as D-bus and is therefore
       considered insecure.

您需要同时运行–privileged和–net = host.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读