Open amrishparmar opened 3 years ago
A possible approach to address this request would be to leverage network attribute internal
, so ECS integration knows network is not designed for connectivity from the Internet. Would then need to inspect the (existing) security group to guess the adequate CidrIp
to be set.
Ran into this issue as well, we are using a named security group which whitelists IP address that should have access to my application ( internal use case).
Example Docker Compose File:
x-aws-vpc: "vpc-0245e260761f4ecc4"
version: "3.9"
services:
streamlit-app:
image: 739988996933.dkr.ecr.us-east-1.amazonaws.com/aw-streamlitapp:v1
ports:
- target: 8501
x-aws-protocol: http
deploy:
resources:
limits:
cpus: '0.5'
memory: 2048M
x-aws-policies:
- "arn:aws:iam::aws:policy/AmazonSageMakerFullAccess"
networks:
default:
external: true
name: sg-0ab458e44ca80883e
This also creates a section as mentioned above in the cloud formation template of :
Default8501Ingress:
Properties:
CidrIp: 0.0.0.0/0
Description: streamlit-app:8501/ on default network
FromPort: 8501
GroupId: sg-0ab458e44ca80883e
IpProtocol: "-1"
ToPort: 8501
Type: AWS::EC2::SecurityGroupIngress
Tried using the internal
flag to true, when doing this and get an error of WARNING networks.internal: unsupported attribute
Also tried to set external: false
and neither produce the results desired.
We would like a way to not have the ingress of our security group modified if possible.
I really need this
Not sure how to add labels, but this is a security issue. I get random scrapes on my containers.
Description
We are trying to set up a web service inside of a VPC, but we don't want to expose it to the public internet, so we set up a security group with the correct inbound/outbound rules. The problem is that the compose CLI (via the CF template it generates) modifies the existing security group to add 0.0.0.0/0 on port 80 thereby exposing the application to anyone.
Steps to reproduce the issue:
HTTP, TCP, Port 80, 10.0.0.0/16
Create a basic docker-compose config (which includes the relevant VPC and the security group created in previous step):
docker compose up
Describe the results you received:
HTTP, TCP, Port 80, 10.0.0.0/16
andHTTP, TCP, Port 80, 0.0.0.0/0
Describe the results you expected:
HTTP, TCP, Port 80, 10.0.0.0/16
Additional information you deem important (e.g. issue happens only occasionally):
The relevant section that creates the unwanted rule (show by
docker compose convert
) is the followingOutput of
docker version
:Output of
docker context show
:You can also run
docker context inspect context-name
to give us more details but don't forget to remove sensitive content.Output of
docker info
:Additional environment details (AWS ECS, Azure ACI, local, etc.): AWS ECS