簡體   English   中英

ECS 容器代理自省 iptables 配置

[英]ECS container agent introspection iptables config

我們有一個容器需要在運行時聯系 ECS 容器代理自省端點。

ecs 任務使用橋接網絡模式。

我們的 Amazon Linux 2 上的默認 iptables 包含以下 INPUT 鏈:

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:51678
ACCEPT     all  --  anywhere             anywhere             state RELATED,ESTABLISHED
ACCEPT     icmp --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere            
ACCEPT     tcp  --  anywhere             anywhere             state NEW tcp dpt:ssh
REJECT     all  --  anywhere             anywhere             reject-with icmp-port-unreachable

我添加了規則ACCEPT tcp -- anywhere anywhere tcp dpt:51678作為允許我們的容器訪問自省端點的嘗試。

但是,它不起作用。

如果我REJECT all -- anywhere anywhere reject-with icmp-port-unreachable我可以訪問 ECS 容器代理自省,完全沒有問題。

從安全的角度來看,將 REJECT 全部刪除感覺很糟糕。 我錯了嗎? 我的嘗試不正確嗎?

https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-agent-introspection.html

如果您想知道,這就是我們在運行時從容器內訪問端點的方式

EC2_INSTANCE_ID=$(curl --silent ${ECS_CONTAINER_METADATA_URI_V4}/taskWithTags | jq -r '.ContainerInstanceTags.instanceid')

非常感謝您的幫助。

我們使用的亞馬遜 Linux 2 base ami 在 iptables 鏈 INPUT 中保存了全部拒絕。

我們的舊亞馬遜 Linux 1 實例在其 iptables 中沒有此規則。

為了解決這個問題,我做了一個 iptables --flush 然后添加了我想要的規則並保存了它們。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM