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
RUNstep that relies on the node role, for exampleaws s3 cpwith no credentials of its own, fails. The build's own work does not use IMDS: the source download,FROMpulls withconvox registriescredentials, 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 theaws-nodeDaemonSet 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.ymllabels:includeservice-type: buildis 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
trueorfalse. Any other value is rejected withparam 'build_imds_block_enabled' must be 'true' or 'false' (got "<value>"). - Version: requires Rack version
3.26.1or later and CLI version3.26.1or later. An older CLI rejects the parameter withunknown parameter 'build_imds_block_enabled' for aws provider, so runsudo convox updatefirst. - Downgrade: set
build_imds_block_enabled=falseand let that update finish before downgrading a Rack below3.26.1. A downgrade removes the parameter withNOTICE: removing parameters not supported by version <version>: build_imds_block_enabledbut leaves theconvox-build-imds-blockpolicies in place, so builds stay blocked. To recover, update the Rack back to3.26.1or later and set the parameter tofalse. A Rack managed through the Console keeps the stored value and applies it again on the next update to3.26.1or later. - Providers: AWS only. On GCP, Azure, DigitalOcean, metal and local Racks the CLI rejects the name as an unknown parameter.
See Also
- pod_imds_block_enabled for blocking App pod egress to IMDS
- imds_http_tokens
- imds_http_hop_limit
- karpenter_build_imds_hop_limit for the metadata hop limit on Karpenter build nodes
- network_policy_enable, which shares this parameter's VPC CNI addon configuration