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.

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 MFA policies
EnvironmentAdmin CountDeployer ScopeMFA Required
Production2-3 onlyExperienced devsYes
Staging3-5All developersOptional
Development5+All developersNo
  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

Query audit logs to identify access patterns:

Terminal window
# Find all admin actions in the last 7 days
rack-gateway audit search --role admin --days 7
# Find failed permission checks
rack-gateway audit search --decision deny --days 30
# Find all actions by a specific user
rack-gateway audit search --user developer@example.com --days 90

Configure MFA requirements based on role privileges:

RoleMFA RecommendationStep-Up Auth
AdminRequired alwaysYes, for all actions
DeployerRequired alwaysYes, for env changes
OpsRecommendedYes, for exec
ViewerOptionalNo
CI/CD (token)N/A (token auth)N/A

For sensitive operations, require re-authentication even within an active session:

  • Environment variable changes
  • Application deletion
  • User role changes
  • API token creation
  1. Immediate: Lock the user account

    Terminal window
    # In web UI: Users → Select User → Lock Account
  2. Revoke sessions: Force logout all active sessions

  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