cloudposse / terraform-aws-eks-node-group

Terraform module to provision a fully managed AWS EKS Node Group
https://cloudposse.com/accelerate
Apache License 2.0
91 stars 128 forks source link

Prevent unexpected privileges escalation #136

Closed gillg closed 1 year ago

gillg commented 1 year ago

what

The current variable input_metadata_http_put_response_hop_limit condition, prevent to protect users of this module, to be protected against privileges escalation. The first intent of IMDSv2 is to prevent containers beeing able to assume an EC2 instance profile. It's not a bad idea at all to prevent that. The good practice then is to use the module cloudposse/eks-iam-role/aws to create a kubernetes service account mapped with IAM permissions throug an OIDC IdP.

references

gillg commented 1 year ago

Does anyone can take a look ? randomly @Gowiem

max-lobur commented 1 year ago

Makes sense, thanks for this. I think we will change default too, but will check regression first

gillg commented 1 year ago

Makes sense, thanks for this. I think we will change default too, but will check regression first

Fine to me, but be careful with the default... ^^ A lot of people will have unexpected permissions not working anymore. It's a breaking change.

max-lobur commented 1 year ago

/test all

max-lobur commented 1 year ago

Both failures unrelated, I will fix in separate PR

xeivieni commented 1 year ago

Any update on this PR ? I would love to see this released 🤗

nitrocode commented 1 year ago

/test test/readme

nitrocode commented 1 year ago

@max-lobur this is odd. It seems like it's trying to revert it back to 2022 instead of using 2023.

It should be using the latest build-harness which grabs rhe current year.

https://github.com/cloudposse/build-harness/blob/c7b01d772017cc78b3902c0a7fcd54f6b6131dca/templates/README.md.gotmpl#L288

-Copyright © 2017-2023 [Cloud Posse, LLC](https://cpco.io/copyright)
+Copyright © 2017-2022 [Cloud Posse, LLC](https://cpco.io/copyright)
nitrocode commented 1 year ago

Oh I see the issue. We just need to run the auto format again on this pr since this pr was submitted in 2022. Now its 2023 and the year should be 2023 in the readme.

Please run make pr/auto-format locally

nitrocode commented 1 year ago

/test all

nitrocode commented 1 year ago

/test test/terratest

nitrocode commented 1 year ago

/test test/terratest

nitrocode commented 1 year ago

/test test/terratest

nitrocode commented 1 year ago

/test test/terratest

nitrocode commented 1 year ago

/test all

nitrocode commented 1 year ago

Thank you @gillg for the contribution!