Skip to content

The Auth Model ​

Every person who uses Keel has their own IAM user. Its stored access key can do almost nothing on its own: it can assume one Keel role, and only with an MFA code, which yields an eight-hour STS session.

SSO-only accounts

The free core uses IAM access keys with MFA-gated role assumption. If your company's AWS account only allows SSO, or a service control policy blocks creating IAM users, keel auth setup will be denied. Evaluate Keel in a personal or sandbox account instead. SSO through IAM Identity Center is on the Pro roadmap.

Access levels ​

Keel enforces three access levels via IAM roles with least-privilege policies:

LevelIAM RolePermissions
Adminkeel-adminProvision, destroy, manage team, require MFA. Not IAM bootstrap — see below
Developerkeel-developerDeploy, exec, scale, config vars, logs, CodeBuild
Viewerkeel-viewerRead-only: status, logs, dashboard, apps list

Commands check access levels at the start of execution: keel up and keel destroy require Admin, keel deploy requires Developer, keel logs works for all roles including Viewer.

One-time setup ​

An account administrator runs keel auth setup once. The guided flow:

  1. Accepts AWS credentials that can create IAM users, roles, and policies. Keel holds them in memory for the duration of setup.
  2. Creates the three roles, their least-privilege policies and assume policies, and the team table.
  3. Creates an IAM user under /keel/ that can assume keel-admin.
  4. Enrolls an MFA device for the new user.
  5. Verifies the new identity and switches Keel to it.
  6. Requires MFA for all Keel role assumptions.

The elevated credentials are used only for setup. Keel retains the restricted IAM user credentials, which require an MFA code to assume a Keel role.

Keep your original AWS credentials safe

They are the way back in if you lose your MFA device — the first admin has nobody else who can reset it for them.

bash
keel auth setup             # admin, one time; needs a terminal for the MFA step
keel auth setup --dry-run   # preview every policy document without touching AWS
keel auth login             # start a session — prompts for a one-time code
keel auth whoami            # check identity and access level

Re-run keel auth setup after upgrading Keel to publish new versions of its policies. The command preserves MFA enforcement and existing device enrollment. It requires elevated credentials because keel-admin cannot modify Keel's own policies.

Credential handling ​

Keel stores two credentials per app+environment in ~/.keel/contexts/<app>/:

FileWhat it isLifetime
base_credentialsA long-lived IAM user access key, stored in plaintext at 0600Until rotated or the user is revoked
credentialsAn STS session from assuming a Keel role8 hours

The base key can assume one keel-* role and read its own MFA device. Once MFA is enforced, role assumption also requires a one-time code, so the base key alone cannot access your infrastructure.

  • Sessions do not refresh automatically. Run keel auth login again after a session expires.
  • Keel generates the MFA secret on the member's machine, displays it once, and does not transmit it or write it to the debug log.
  • keel auth logout clears the session; --purge also removes the base key.
  • OpenTofu receives credentials through environment variables.
  • Application containers use rotating ECS task-role credentials instead of IAM user keys.
  • Every service has its own runtime IAM role and security group.

How access is enforced ​

LayerRole
IAM assume policy on the member's userThe enforcement point — grants exactly one keel-* role
MFA condition on the role's trust policyMakes the access key insufficient on its own
keel-mfa-enroll-policyHeld only between team add and team activate, never alongside an assume policy
keel-team DynamoDB tableRoster and audit trail (who added whom, when, current status)
Cached STS credentialsWhat Keel's access check inspects on every privileged command

Because the assume policy allows a single role, a member cannot escalate by editing their local config or passing a different --role. Admins can only ever attach one of the three Keel assume policies, or the MFA enrollment policy, to a Keel-managed user — the keel-admin policy constrains iam:AttachUserPolicy with an iam:PolicyARN condition, so keel auth team cannot be used to grant arbitrary permissions.

keel-admin also cannot rewrite Keel's own IAM. It holds read-only access over role/keel-* and policy/keel-* — since policy/keel-* includes keel-admin-policy itself, write access there would let an admin session publish a new version of its own policy granting everything. Changing those documents is a bootstrap act, done by keel auth setup with elevated credentials. The one exception is iam:UpdateAssumeRolePolicy, which keel auth mfa enforce needs; it cannot grant permissions, only change who may assume.

A CI identity ​

A workflow has no second factor, so it cannot use the MFA-gated roles, and storing a long-lived access key in CI secrets is exactly what the rest of the model exists to avoid. keel auth ci setup creates an OIDC provider and a keel-ci role that GitHub Actions assumes with no stored key:

bash
keel auth ci setup --repo acme/shop --branches main   # elevated key, like 'keel auth setup'
keel auth ci check                                    # read the live trust policy back

The trust policy's subject condition is the entire security boundary, so Keel writes an exact list of repository and branch (or GitHub environment) subjects and refuses a wildcard. keel auth ci check exits 2 if the live policy is wider than that. The role's permissions are an explicit subset of developer: it can deploy, but holds no exec, no config writes, and nothing admin. keel auth mfa status lists it beside the human roles, marked exempt from MFA.

Ambient AWS credentials are used only when KEEL_CI=1 is set, so a laptop with an admin AWS_PROFILE cannot bypass the MFA-gated login. See Deploying from CI for the workflow that uses the role.

What this does not protect against ​

MFA makes an exfiltrated key useless — a copy in a backup, a chat message, or terminal scrollback. It does not protect a machine that is already compromised: something running as you can wait for a legitimate login and take the session from credentials, which is plaintext on disk for the life of the session.

keel-admin can create infrastructure roles, attach AWS-managed policies to them, and pass those roles to ECS tasks. Code deployed through Keel can therefore use permissions beyond those granted directly to the admin session. The model prevents direct escalation from a Keel admin session to account administrator; it does not remove the authority needed to deploy infrastructure.

Keel — the missing platform layer for AWS.