Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws-ecs-1: constrain ephemeral port range #1051

Merged
merged 1 commit into from
Aug 19, 2020

Conversation

samuelkarp
Copy link
Contributor

Issue number:
#815

Description of changes:
ECS documents a smaller ephemeral port range than is default on Bottlerocket. Constraining our range to the documented ECS range should avoid surprising customers who expect ECS's documented range and have configured their security groups accordingly.

Testing done:

  • Ran containers with docker run locally and saw the correct ephemeral port range being used.
  • Ran a task with "portMappings": [{"containerPort": 80}] and saw the correct ephemeral port range being used.

Terms of contribution:

By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.

ECS documents a smaller ephemeral port range than is default on
Bottlerocket.  Constraining our range to the documented ECS range should
avoid surprising customers who expect ECS's documented range and have
configured their security groups accordingly.

# Constrain ephemeral ports to the range documented for ECS
# https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_PortMapping.html
net.ipv4.ip_local_port_range = 32768 60999
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't see 60999 referenced in the linked docs, is 60999 a value that was chosen over65535?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I copied this without noticing it was different from the ECS documentation, but 60999 is the upper bound I see on Amazon Linux, Debian, and Ubuntu. I can add that to the comments if you want.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should keep this aligned with documented and current usages of the constrained port range: so yes, I'd prefer to see this as 65535.

An example: the current port range used by the CDK is 32768-65535 (though this range might be opened up in the near future).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Discussed offline with @samuelkarp : common distributions are using the kernel's default of 60999
  2. digging into the kernel history on 60999 (and the move to 61000) show no concerns surrounding 65535 nor 60999 (other than for port assignment efficacy)
  3. I'm on board with leaving this at 60999 👍

@samuelkarp samuelkarp merged commit 537efa2 into bottlerocket-os:develop Aug 19, 2020
@samuelkarp samuelkarp deleted the ecs-ephemeral-ports branch August 19, 2020 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants