build_imds_block_enabled

Description

The build_imds_block_enabled parameter blocks build pods from reaching the EC2 instance metadata service (IMDS) at 169.254.169.254, so a Dockerfile RUN step cannot read the node role credentials, the region, or anything else from IMDS. App pods keep their current access.

Pod With build_imds_block_enabled=true
Build pods from convox build, convox deploy, Console and workflow builds, in the App namespace or in the separate build namespace used under Pod Security enforce Cannot reach 169.254.169.254
Service, convox run, Timer and Resource pods Unchanged
System and Rack pods Unchanged

Builds still reach the internet, DNS, in-cluster Services, the Rack API and the EKS Pod Identity endpoint 169.254.170.23.

Before each build pod starts, the Rack creates a NetworkPolicy named convox-build-imds-block in the namespace the build runs in. The policy selects pods labeled service-type: build and allows all egress except 169.254.169.254/32. If the policy cannot be created, the build fails instead of running without it.

This parameter is available on AWS Racks only and requires Rack version 3.26.1 or later.

Default Value

The default value is false. With the default, builds and the VPC CNI addon configuration are unchanged.

Use Cases

  • Builds from untrusted source: keep Dockerfile steps away from the node role while App pods that still read node credentials keep working.
  • Racks with Pod Security enforce: builds there run in a separate build namespace that pod_imds_block_enabled does not cover. This parameter blocks them wherever they run.

Setting the Parameter

$ convox rack params set build_imds_block_enabled=true -r rackName
Updating parameters... OK

Before enabling, review the following:

  • A RUN step that relies on the node role, for example aws s3 cp with no credentials of its own, fails. The build's own work does not use IMDS: the source download, FROM pulls with convox registries credentials, and the image push keep working.
  • On a Rack where neither pod_imds_block_enabled nor network_policy_enable is already true, enabling this parameter changes the VPC CNI addon configuration, which rolls the aws-node DaemonSet on every node. The roll takes several minutes and does not restart App pods. If VPC CNI network policy enforcement was not already on, it turns on for the whole cluster, and NetworkPolicy objects applied by hand become enforced at the same time.
  • A Service whose convox.yml labels: include service-type: build is treated as a build and blocked too. Do not use that label on Services.

To turn it off:

$ convox rack params set build_imds_block_enabled=false -r rackName
Updating parameters... OK

Setting false removes every convox-build-imds-block policy when the Rack API restarts with the new value. VPC CNI network policy enforcement stays on, and the change does not roll aws-node again.

Viewing Current Configuration

$ convox rack params -g security -r rackName

The parameter is listed in both the security and the build parameter groups, once it has been set.

Relation to pod_imds_block_enabled

Pod pod_imds_block_enabled=true build_imds_block_enabled=true
Build pod in the App namespace (the default) Blocked Blocked
Build pod in the separate build namespace, on a Rack with pod_security_mode set to enforce Not blocked Blocked
Service, convox run, Timer and Resource pods Blocked Not blocked

The two parameters are independent and can be set together in one command.

Additional Information

  • Validation: must be true or false. Any other value is rejected with param 'build_imds_block_enabled' must be 'true' or 'false' (got "<value>").
  • Version: requires Rack version 3.26.1 or later and CLI version 3.26.1 or later. An older CLI rejects the parameter with unknown parameter 'build_imds_block_enabled' for aws provider, so run sudo convox update first.
  • Downgrade: set build_imds_block_enabled=false and let that update finish before downgrading a Rack below 3.26.1. A downgrade removes the parameter with NOTICE: removing parameters not supported by version <version>: build_imds_block_enabled but leaves the convox-build-imds-block policies in place, so builds stay blocked. To recover, update the Rack back to 3.26.1 or later and set the parameter to false. A Rack managed through the Console keeps the stored value and applies it again on the next update to 3.26.1 or later.
  • Providers: AWS only. On GCP, Azure, DigitalOcean, metal and local Racks the CLI rejects the name as an unknown parameter.

See Also