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

chore!: DBTP-1072 Change ADDITIONAL_IP_LIST to EGRESS_IPS #179

Conversation

gabelton
Copy link
Contributor

@gabelton gabelton commented Jul 4, 2024

ip-filter expects an ADDITIONAL_IP_LIST env var. Often this list just contains the NAT gateway IPs generated in the vpc module, hence calling the tf modules var by the same name. But sometimes ADDITIONAL_IP_LIST will need to include other IPs and so we should differentiate between the two vars to avoid confusion.

Upgrade path for release notes

If you only need the egress ips, you can update references to <vpc_name>/ADDITIONAL_IP_LIST to <vpc_name>/EGRESS_IPS. However, if your ipfilter sidecar instance needs ADDITIONAL_IP_LIST env var, we recommend manually setting this on a per environment basis with copilot secret init.

@gabelton gabelton requested a review from a team July 4, 2024 15:24
@@ -113,7 +113,7 @@ locals {
resource "aws_ssm_parameter" "combined_nat_gateway_eips" {
# checkov:skip=CKV_AWS_337:Ensure SSM parameters are using KMS CMK. Related ticket: https://uktrade.atlassian.net/browse/DBTP-946
# checkov:skip=CKV2_AWS_34:AWS SSM Parameter should be Encrypted. Related ticket: https://uktrade.atlassian.net/browse/DBTP-946
name = "/${var.arg_name}/ADDITIONAL_IP_LIST"
name = "/${var.arg_name}/EGRESS_IPS"
Copy link
Contributor

Choose a reason for hiding this comment

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

So this is a rename, but the contents have not changed.

I may have misunderstood, but I think @acodeninja said that ADDITIONAL_IP_LIST might contain other things. How would that get populated and where is it used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The offline command just needs to allow these egress ips access behind the maintenance page. ADDITIONAL_IP_LIST, as used by ip-filter, however, may contain more than just these egress ips. So if we used the ADDITIONAL_IP_LIST var for the holding page, we might inadvertently be allowing things to bypass the maintenance page, when we only want them bypassing ip-filter.

I think for now at least we have to go back to the old process of manually creating that ADDITIONAL_IP_LIST secret per env with whatever we need it to contain. But the default could be to just use the EGRESS_IPS var and only create the ADDITIONAL_IP_LIST param if requiring extra ips be whitelisted

Copy link
Contributor

Choose a reason for hiding this comment

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

That makes sense.

Are you confident that this rename is not backwards breaking? I.e. it won't mess up IP Filter.

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 doubt many services will have moved over to this new setup yet, but I'm just testing how it works with creating the new var and whether it replaces the old one or adds another.

Copy link
Contributor

Choose a reason for hiding this comment

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

I doubt many services will have moved over to this new setup yet

We would need to be 100% confident of that. Perhaps worth searching https://github.com/orgs/uktrade/repositories.

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've just tested to confirm, but it definitely destroys the previous var, so it's a breaking change. I've added a release path and will update the docs repo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

docs change here #179

gabelton added 2 commits July 5, 2024 09:09
…I-and-a-frontend-service-in-the-same-environment-and-put-the-frontend-service-behind-the-IP-Filter-I-want-the-api-to-be-able-to-access-the-frontend-service
…I-and-a-frontend-service-in-the-same-environment-and-put-the-frontend-service-behind-the-IP-Filter-I-want-the-api-to-be-able-to-access-the-frontend-service
@gabelton gabelton changed the title chore: change ADDITIONAL_IP_LIST to EGRESS_IPS chore!: change ADDITIONAL_IP_LIST to EGRESS_IPS Jul 5, 2024
@WillGibson WillGibson changed the title chore!: change ADDITIONAL_IP_LIST to EGRESS_IPS chore!: DBTP-1072 Change ADDITIONAL_IP_LIST to EGRESS_IPS Jul 5, 2024
@gabelton gabelton merged commit 0db3962 into main Jul 5, 2024
9 checks passed
@gabelton gabelton deleted the DBTP-1072-As-a-developer-when-I-create-an-API-and-a-frontend-service-in-the-same-environment-and-put-the-frontend-service-behind-the-IP-Filter-I-want-the-api-to-be-able-to-access-the-frontend-service branch July 5, 2024 15:44
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.

2 participants