-
-
Notifications
You must be signed in to change notification settings - Fork 329
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
feat!: add custom egress rules to docker-autoscaler security group #1222
base: main
Are you sure you want to change the base?
feat!: add custom egress rules to docker-autoscaler security group #1222
Conversation
Hey @ikarlashov! 👋 Thank you for your contribution to the project. Please refer to the contribution rules for a quick overview of the process. Make sure that this PR clearly explains:
With submitting this PR you confirm that you hold the rights of the code added and agree that it will published under this LICENSE. The following ChatOps commands are supported:
Simply add a comment with the command in the first line. If you need to pass more information, separate it with a blank line from the command. This message was generated automatically. You are welcome to improve it. |
…Don't provision docker-machine security group when docker-autoscaler is used. Signed-off-by: Yevgen Karlashov <[email protected]>
b2e2ef5
to
bfa1b36
Compare
Signed-off-by: Yevgen Karlashov <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your work to improve this module. I noticed the major change, but I think we can go on as it is easy to handle for the users.
variables.tf
Outdated
default = [ | ||
{ | ||
cidr_blocks = ["0.0.0.0/0"] | ||
ipv6_cidr_blocks = ["::/0"] | ||
prefix_list_ids = null | ||
from_port = 0 | ||
protocol = "-1" | ||
security_groups = null | ||
self = null | ||
to_port = 0 | ||
description = "Allow all egress traffic for Docker-autoscaler runner workers." | ||
} | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: any specific reason for this default? As you already wrote, it might introduce a vulnerability.
suggestion: get rid of this default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left it for lazy people who don't care about setting specific egresses and just want to have an ability to use the module right away. I.e. to pull docker images from Internet.
I can remove it, no problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe as a compromise solution we can set default to "Allow Egress to All for port 443 only"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me, yes.
Signed-off-by: Yevgen Karlashov <[email protected]>
Signed-off-by: Yevgen Karlashov <[email protected]>
…r manager and Runner workers ASGs Signed-off-by: Yevgen Karlashov <[email protected]>
…cker-autoscaler workers' ASG Signed-off-by: Yevgen Karlashov <[email protected]>
Signed-off-by: Yevgen Karlashov <[email protected]>
Signed-off-by: Yevgen Karlashov <[email protected]>
Signed-off-by: Yevgen Karlashov <[email protected]>
It would be nice to allow traffic within runner-manager ASG and Docker-autoscaler workers ASG. Basically add this to
But if I add it, terraform doesn't detect any changes for runner's SG. |
Signed-off-by: Yevgen Karlashov <[email protected]>
Perhaps it is already in place? |
…ler SG rules Signed-off-by: Yevgen Karlashov <[email protected]>
Signed-off-by: Yevgen Karlashov <[email protected]>
Signed-off-by: Yevgen Karlashov <[email protected]>
Signed-off-by: Yevgen Karlashov <[email protected]>
Signed-off-by: Yevgen Karlashov <[email protected]>
Signed-off-by: Yevgen Karlashov <[email protected]>
Signed-off-by: Yevgen Karlashov <[email protected]>
Signed-off-by: Yevgen Karlashov <[email protected]>
Signed-off-by: Yevgen Karlashov <[email protected]>
Signed-off-by: Yevgen Karlashov <[email protected]>
…ress rule Signed-off-by: Yevgen Karlashov <[email protected]>
Signed-off-by: Yevgen Karlashov <[email protected]>
If you don't set |
Signed-off-by: Yevgen Karlashov <[email protected]>
Signed-off-by: Yevgen Karlashov <[email protected]>
Shouldn't we add this egress rule automatically? Otherwise the applied result doesn't work. |
Signed-off-by: Yevgen Karlashov <[email protected]>
If I add:
the rule will be added to SG upon the first run and removed upon the 2nd. And so on. I've tested multiple times. This won't work at all:
If we leave the default egress values of So the only way to add the rule to runner-manager's SG is to refactor security-group resource by removing all And that will be another breaking change. What do you think? |
Sounds good to me as these inline |
Signed-off-by: Yevgen Karlashov <[email protected]>
Signed-off-by: Yevgen Karlashov <[email protected]>
Signed-off-by: Yevgen Karlashov <[email protected]>
Signed-off-by: Yevgen Karlashov <[email protected]>
Signed-off-by: Yevgen Karlashov <[email protected]>
Signed-off-by: Yevgen Karlashov <[email protected]>
Alright. I think it's ready for another round of review (: |
Signed-off-by: Yevgen Karlashov <[email protected]>
Add custom egress rules to docker-autoscaler security group and remove condition to provision unused docker-machine security group.
Description
By default, the module provisions a security group for Docker Autoscaler workers with egress rules that allow ALL traffic. Unlike ingress rules, egress rules are not customizable, which poses a significant security concern. This PR introduces the ability to customize egress rules for the Docker Autoscaler workers' security group by declaring a separate variable for docker-autoscaler egress rules.
var.runner_worker_docker_autoscaler_asg
becomes bulky and hard to read. Considering the complexity of the ingress rules structure, it makes sense to create a separate variablevar.runner_worker_docker_autoscaler_ingress_rules
for ingress rules. This way we will follow variable convention for existing security group rules variables, i.e.var.runner_worker_docker_machine_extra_egress_rules
. In the result of the change:var.runner_worker_docker_autoscaler_asg.sg_ingresses
is removed and its content should be moved tovar.runner_worker_docker_autoscaler_ingress_rules
.Adding
var.runner_networking_ingress_rules
to manage Ingress rules for runner-manager SG.Changed runner-manager Egress rules' var name and its spec.
var.runner_networking_egress_rules
has migrated tovar.runner_manager_egress_rules
with a new spec.Additionally, PR removes the condition that provisions an unused security group intended solely for Docker Machine setup.
Migrations required
Yes
var.runner_worker_docker_autoscaler_asg.sg_ingresses
tovar.runner_worker_docker_autoscaler_ingress_rules
.var.runner_networking_egress_rules
migrated tovar.runner_manager_egress_rules
with a new spec.Verification