Skip to main content

Module container

Module container 

Source
Expand description

What a container agent is given so its AWS SDK and CLI find the broker (spec §4): a config file with one credential_process profile per grant, mounted read-only, and up to four environment variables. The file is the same for every agent (who may have which grant is srv’s decision on each request, not the file’s), so there is one folder, not one per agent: no agent name is ever a folder name.

Nothing here is a security boundary (an agent can unset the variables or write its own config): srv decides on every request. The file is a convenience that makes aws, cdk and the SDKs ask the right place, and it holds names and one command, never a secret.

Constants§

CONTAINER_AWS_DIR
Where the config folder is mounted, read-only, in the container.

Functions§

config_dir
The host folder to mount, with the config freshly written, or None when this host shares no AWS (or the folder can’t be written: the container then has no AWS, as before).
env_for
The variables a container’s exec gets when policy shares grants. AWS_PROFILE is the policy’s default grant, so a bare aws s3 ls uses it; without one, a profile is named per command.
exec_env
The variables to add to a container exec’s environment: none when nothing is shared, and none when the config folder can’t be written, so they never point the SDK at a file the container doesn’t have.
render_into
Write the AWS config under root (container-aws/config) if it differs from what is there, and return the folder. A new file replaces the old one in one step, so a container reading the mount never sees half of it.