Skip to content

RBAC Best Practices

This guide covers recommended patterns for managing roles and permissions in Rack Gateway.

Start Restrictive

Begin with Viewer role and upgrade only when needed. It’s easier to add permissions than to remove them.

Just-In-Time Access

Grant elevated access temporarily when needed, then revoke. Use API tokens with limited scope for automation.

User TypeRecommended RoleRationale
New team memberViewerObserve first, learn the system
Developer (feature work)DeployerDeploy but not delete
On-call engineerOpsDebug without deploy access
CI/CD pipelineCI/CD (token)Minimal automation scope
Platform adminAdminFull access when needed
External auditorViewerRead-only compliance review

Rack Gateway’s role hierarchy naturally separates concerns:

Anti-patterns to avoid:

  • Making everyone an Admin “for convenience”
  • Giving Deployer access to all engineers regardless of responsibility
  • Using personal credentials in CI/CD pipelines
Use CaseRecommended RoleWhy
CI/CD deploymentCI/CDLimited scope, requires approval
Monitoring/alertingViewerRead-only access to status
Automated testingViewerJust needs to list/read
Emergency scriptsOpsRestart capability only
  1. Create with specific purpose

    Name tokens descriptively: ci-production-deploy, monitoring-datadog, emergency-restart

    Terminal window
    rack-gateway api-token create --name "ci-production-deploy" --role cicd
  2. Set appropriate role

    Always use the minimum required role. CI/CD tokens should use the cicd role, not deployer.

  3. Store securely

    • Use secrets management (AWS Secrets Manager, HashiCorp Vault)
    • Never commit tokens to git
    • Rotate tokens periodically
  4. Monitor usage

    Review token activity in audit logs. Investigate tokens that haven’t been used in 90+ days.

  5. Revoke when no longer needed

    Delete tokens immediately when pipelines are decommissioned. Give short-lived tokens an expiry (--expires-at).

DoDon’t
Use CI/CD role for pipelinesUse Deployer role for automation
Name tokens descriptivelyUse generic names like “token-1”
Rotate tokens quarterlyKeep tokens indefinitely
Use separate tokens per environmentShare tokens across staging/production
Audit unused tokens monthlyIgnore token activity

Deploy separate gateway instances for each environment:

Production Gateway → Production Rack
Staging Gateway → Staging Rack
Development Gateway → Dev Rack

Benefits:

  • Complete isolation between environments
  • Different admin sets per environment
  • Independent audit trails
  • Separate settings (session timeout, step-up window, deploy approvals)
EnvironmentAdmin CountDeployer Scope
Production2-3 onlyExperienced devs
Staging3-5All developers
Development5+All developers

Keep MFA required everywhere: every gateway requires it for all users by default (mfa_require_all_users), and the CLI requires every user to be enrolled whatever that setting says.

  1. Monthly: Token audit

    • Review all API tokens
    • Identify unused tokens (>30 days)
    • Verify token roles match current needs
  2. Quarterly: Role review

    • Review all user roles
    • Identify users who changed teams
    • Downgrade inactive users to Viewer
  3. Annually: Full access audit

    • Document all admin users
    • Review role assignments vs job functions
    • Update for organizational changes

Use the Audit Logs page (admins) to find access patterns. It filters by user, status (for example denied for refused requests), action type, resource type, free text and time range, and exports the results as CSV. The same filters work on the API:

Terminal window
# Requests refused in the last 30 days
curl -b "session_token=$TOKEN" \
"https://gateway.example.com/api/v1/audit-logs?status=denied&range=30d"
# Everything one user did since July 1, as CSV
curl -b "session_token=$TOKEN" \
"https://gateway.example.com/api/v1/audit-logs/export?user=developer@example.com&start=2026-07-01T00:00:00Z"

range takes 15m, 1h, 24h (the default), 7d, 30d or all; start and end set a custom range.

MFA requirements belong to permissions, not roles: the same action needs the same MFA whoever performs it. Writes such as restarts, exec and env changes need a recent step-up; deleting apps, changing users or API tokens and approving deploys need MFA on the request itself. See MFA Requirements for the full list. API tokens can’t do MFA, so give them only the permissions their pipeline needs.

  1. Immediate: Lock the user account (web UI: Users → the user → Lock). Locking signs them out of every session, and their API tokens stop working while they’re locked

  2. Check sessions: Confirm on the user’s page that no sessions remain

  3. Audit: Review all actions by the user in last 30 days

  4. Remediate: Change any secrets the user had access to

  5. Investigate: Determine how the compromise occurred

  6. Restore: Unlock account after re-verification

  1. Immediate: Delete the token

    Terminal window
    # In web UI: API Tokens → Select Token → Delete
  2. Audit: Review all actions by the token

  3. Update: Generate new token with fresh credentials

  4. Rotate: Update all systems using the old token

  5. Investigate: Determine how the token was exposed

Implementation:

  • Base role: Viewer for all engineers
  • On-call: Temporary upgrade to Ops
  • Escalation: Temporary upgrade to Deployer for hotfixes

Different teams may need different access levels:

TeamBase RoleNotes
PlatformAdminManages infrastructure
BackendDeployerFull deploy access
FrontendDeployerFull deploy access
QAViewerRead-only for testing
SecurityAdminAudit and review

For external contractors:

  1. Start with Viewer role
  2. Upgrade to specific role only for duration of engagement
  3. Immediately downgrade when engagement ends
  4. Audit all actions during engagement

Before going to production:

  • No more than 3 admin users
  • CI/CD uses dedicated tokens with CI/CD role
  • MFA enabled for all admin and deployer users
  • API tokens have descriptive names
  • Audit logging configured with retention policy
  • Access review process documented
  • Incident response runbook created
  • Unused tokens identified and deleted