Access Management
Strategies for managing team access permissions, role transitions, and security maintenance over time.
Role-Based Access Patterns
Section titled “Role-Based Access Patterns”Standard Role Matrix
Section titled “Standard Role Matrix”| Role | Development | Staging | Production |
|---|---|---|---|
| Junior Dev | ✓ | ✗ | ✗ |
| Senior Dev | ✓ | ✓ | ✗ |
| Team Lead | ✓ | ✓ | ✓ |
| DevOps | ✓ | ✓ | ✓ |
| CI/CD | ✗ | ✓ | ✓ |
Implementation
Section titled “Implementation”[groups]junior-devs = ["alice", "bob"]senior-devs = ["charlie", "dave"]leads = ["admin"]devops = ["admin", "ops-lead"]automation = ["ci-deploy", "monitoring"]
[files.development]access = ["*"]
[files.staging]access = ["senior-devs", "leads", "devops", "automation"]
[files.production]access = ["leads", "devops", "automation"]Access Auditing
Section titled “Access Auditing”Regular Access Review
Section titled “Regular Access Review”# Generate access reportecho "=== Access Audit Report ==="echo "Date: $(date)"echo ""
environments=("development" "staging" "production")for env in "${environments[@]}"; do echo "Environment: $env" access_list=$(grep -A 5 "\[files.$env\]" kiln.toml | grep "access" | cut -d'[' -f2 | cut -d']' -f1) echo " Access: $access_list" echo ""doneAccess Matrix Validation
Section titled “Access Matrix Validation”# Test access for all team membersteam_keys=("alice.key" "bob.key" "charlie.key" "admin.key")environments=("development" "staging" "production")
printf "%-12s" "Member"for env in "${environments[@]}"; do printf "%-12s" "$env"doneecho ""
for key in "${team_keys[@]}"; do member=$(basename "$key" .key) printf "%-12s" "$member"
for env in "${environments[@]}"; do if kiln info --file "$env" --key "keys/$key" --verify 2>/dev/null; then printf "%-12s" "✓" else printf "%-12s" "✗" fi done echo ""doneRole Transitions
Section titled “Role Transitions”Promotion Workflow
Section titled “Promotion Workflow”# Junior to Senior Developermember="alice"kiln rekey --file staging --add-recipient "$member=age1alice...key"
# Update groups in kiln.toml# Move alice from junior-devs to senior-devsSecurity Maintenance
Section titled “Security Maintenance”Key Rotation
Section titled “Key Rotation”# Rotate service account keys quarterlykiln init key --path ./new-ci.key
# Add new keykiln rekey --file production --add-recipient "ci-deploy-new=$(cat ./new-ci.key.pub)"
# Update CI/CD system# Remove old key from configuration manuallyEmergency Access
Section titled “Emergency Access”# Emergency admin access procedurekiln init key --path ./emergency.key --force
# Grant immediate accesskiln rekey --file production --add-recipient "emergency=$(cat ./emergency.key.pub)" --force
# Document in incident logecho "$(date): Emergency access granted - incident #$(git rev-parse --short HEAD)" >> access.logAccess Patterns by Environment
Section titled “Access Patterns by Environment”Development Environment
Section titled “Development Environment”# Open access for collaboration# [files.development]# access = ["*"]
# All team members can:kiln set TEST_VAR "value" --file developmentkiln export --file development --format jsonStaging Environment
Section titled “Staging Environment”# Controlled access for testing# access = ["senior-devs", "leads", "devops"]
# Limited to experienced developerskiln set DATABASE_URL "staging-db-url" --file stagingkiln run --file staging -- ./run-tests.shProduction Environment
Section titled “Production Environment”# Restricted access for operations# access = ["leads", "devops", "automation"]
# Admin and automation onlykiln set API_KEY --file production # Prompts for secure inputkiln run --file production -- ./deploy.shAutomation Access Control
Section titled “Automation Access Control”CI/CD Pipeline Access
Section titled “CI/CD Pipeline Access”[recipients]ci-deploy = "age1ci...key"ci-test = "age1test...key"
[groups]automation = ["ci-deploy", "ci-test"]
[files.staging]access = ["developers", "automation"]
[files.production]access = ["admins", "automation"]Service Account Management
Section titled “Service Account Management”# Monitoring service (read-only pattern)kiln rekey --file production --add-recipient "monitoring=age1monitor...key"
# Deployment service (write access needed)kiln rekey --file production --add-recipient "deploy=age1deploy...key"
# Backup service (read access for backup)kiln rekey --file production --add-recipient "backup=age1backup...key"Access Cleanup
Section titled “Access Cleanup”Departing Team Members
Section titled “Departing Team Members”# Offboarding checklistdeparting_member="bob"
# 1. Export current configurationsfor env in development staging production; do if kiln info --file "$env" --verify 2>/dev/null; then kiln export --file "$env" --format json > "backup-${env}.json" fidone
# 2. Remove from kiln.toml recipients and groups# 3. Re-import configurations (excludes departed member)for env in development staging production; do if [ -f "backup-${env}.json" ]; then kiln set --from-file "backup-${env}.json" --file "$env" fidonePeriodic Access Cleanup
Section titled “Periodic Access Cleanup”# Quarterly access review script#!/bin/bash
echo "Quarterly Access Review - $(date)"echo "================================="
# List all recipientsecho "Current Recipients:"grep -A 20 "\[recipients\]" kiln.toml | grep "=" | cut -d'=' -f1
# Check for unused keysecho ""echo "Checking for unused access..."for env in development staging production; do echo "Environment: $env" # Manual verification neededdone
# Prompt for access changesecho ""echo "Review complete. Update access as needed."Best Practices
Section titled “Best Practices”Access Control Principles
Section titled “Access Control Principles”- Least Privilege: Grant minimum necessary access
- Progressive Access: Start with development, earn staging/production
- Time-Limited: Review and rotate access regularly
- Audit Trail: Document all access changes
Operational Security
Section titled “Operational Security”# Regular security tasks# 1. Monthly access review# 2. Quarterly key rotation# 3. Annual access policy review# 4. Incident-based access audit
# Monitor access patternsecho "Recent environment access:"kiln info --verify | grep -E "(can|cannot) decrypt"