Some checks failed
		
		
	
	Build Test Deploy / docs (push) Has been cancelled
				
			Build Test Deploy / deploy (push) Has been cancelled
				
			Build Test Deploy / build-test (push) Has been cancelled
				
			Build Test Deploy / authority-container (push) Has been cancelled
				
			Docs CI / lint-and-preview (push) Has been cancelled
				
			
		
			
				
	
	
	
		
			3.6 KiB
		
	
	
	
	
	
	
	
			
		
		
	
	
			3.6 KiB
		
	
	
	
	
	
	
	
Authority Signing Key Rotation Playbook
Status: Authored 2025-10-12 as part of OPS3.KEY-ROTATION rollout.
Use together withdocs/11_AUTHORITY.md(Authority service guide) and the automation shipped underops/authority/.
1. Overview
Authority publishes JWKS and revocation bundles signed with ES256 keys. To rotate those keys without downtime we now provide:
- Automation script: ops/authority/key-rotation.sh
 Shell helper that POSTS to/internal/signing/rotate, supports metadata, dry-run, and confirms JWKS afterwards.
- CI workflow: .gitea/workflows/authority-key-rotation.yml
 Manual dispatch workflow that pulls environment-specific secrets, runs the script, and records the result. Works across staging/production by passing theenvironmentinput.
This playbook documents the repeatable sequence for all environments.
2. Pre-requisites
- Generate a new PEM key (per environment)
openssl ecparam -name prime256v1 -genkey -noout \ -out certificates/authority-signing-<env>-<year>.pem chmod 600 certificates/authority-signing-<env>-<year>.pem
- Stash the previous key under the same volume so it can be referenced in signing.additionalKeysafter rotation.
- Ensure secrets/vars exist in Gitea
- <ENV>_AUTHORITY_BOOTSTRAP_KEY
- <ENV>_AUTHORITY_URL
- Optional shared defaults AUTHORITY_BOOTSTRAP_KEY,AUTHORITY_URL.
 
3. Executing the rotation
Option A – via CI workflow (recommended)
- Navigate to Actions → Authority Key Rotation.
- Provide inputs:
- environment:- staging,- production, etc.
- key_id: new- kid(e.g.- authority-signing-2025-dev).
- key_path: path as seen by the Authority service (e.g.- ../certificates/authority-signing-2025-dev.pem).
- Optional metadata: comma-separatedkey=valuepairs (for audit trails).
 
- Trigger. The workflow:
- Reads the bootstrap key/URL from secrets.
- Runs ops/authority/key-rotation.sh.
- Prints the JWKS response for verification.
 
Option B – manual shell invocation
AUTHORITY_BOOTSTRAP_KEY=$(cat /secure/authority-bootstrap.key) \
./ops/authority/key-rotation.sh \
  --authority-url https://authority.example.com \
  --key-id authority-signing-2025-dev \
  --key-path ../certificates/authority-signing-2025-dev.pem \
  --meta rotatedBy=ops --meta changeTicket=OPS-1234
Use --dry-run to inspect the payload before execution.
4. Post-rotation checklist
- Update authority.yaml(or environment-specific overrides):- Set signing.activeKeyIdto the new key.
- Set signing.keyPathto the new PEM.
- Append the previous key into signing.additionalKeys.
- Ensure keySource/providermatch the values passed to the script.
 
- Set 
- Run stellaops-cli auth revoke exportso revocation bundles are re-signed with the new key.
- Confirm /jwkslists the newkidwithstatus: "active"and the previous one asretired.
- Archive the old key securely; keep it available until all tokens/bundles signed with it have expired.
5. Development key state
For the sample configuration (etc/authority.yaml.sample) we minted a placeholder dev key:
- Active: authority-signing-2025-dev(certificates/authority-signing-2025-dev.pem)
- Retired: authority-signing-dev
Treat these as examples; real environments must maintain their own PEM material.
6. References
- docs/11_AUTHORITY.md– Architecture and rotation SOP (Section 5).
- docs/ops/authority-backup-restore.md– Recovery flow referencing this playbook.
- ops/authority/README.md– CLI usage and examples.