@@ -197,9 +197,12 @@ Day 0+: Automatic Token Renewal:
197197Container Restart:
198198 vault-init: Check if Vault is sealed
199199 ↓
200- If unsealed: Regenerate secret_id only
200+ If unsealed: Validate existing secret_ids
201201 ↓
202- vault-agent: Re-authenticate with new secret_id
202+ If valid: Reuse existing secret_id (no churn)
203+ If invalid: Mint new secret_id and write to disk
204+ ↓
205+ vault-agent: Re-authenticate with secret_id
203206 ↓
204207 New token issued and cached
205208```
@@ -413,8 +416,9 @@ Connected Services:
413416 - GUI (React Frontend)
414417
415418Token Lifecycle:
416- - Default Lease: 768h (32 days)
417- - Auto-renewal: Before expiration
419+ - Token type: periodic (token_period 20m, no max-TTL)
420+ - Auto-renewal: Every ~13 minutes (~2/3 of period)
421+ - Re-auth: only on agent restart (never in steady state)
418422```
419423
420424#### Agent 2: vault-agent-cron
@@ -429,8 +433,9 @@ Connected Services:
429433 - CronManager (Python worker)
430434
431435Token Lifecycle:
432- - Default Lease: 768h (32 days)
433- - Auto-renewal: Before expiration
436+ - Token type: periodic (token_period 30m, no max-TTL)
437+ - Auto-renewal: Every ~20 minutes (~2/3 of period)
438+ - Re-auth: only on agent restart (never in steady state)
434439```
435440
436441#### Agent 3: vault-agent-llm
@@ -445,8 +450,9 @@ Connected Services:
445450 - LLM Orchestration Service (FastAPI)
446451
447452Token Lifecycle:
448- - Default Lease: 1h (shorter for higher security)
449- - Auto-renewal: Every ~45 minutes
453+ - Token type: periodic (token_period 1h, no max-TTL)
454+ - Auto-renewal: Every ~40 minutes (~2/3 of period)
455+ - Re-auth: only on agent restart (never in steady state)
450456```
451457
452458### Token Caching and Auto-Renewal
@@ -464,29 +470,31 @@ T=0: Initial Authentication
464470 ├─► POST /v1/auth/approle/login
465471 │ Body: { role_id, secret_id }
466472 │
467- └─► Receives: { token, ttl : 3600s, renewable: true }
473+ └─► Receives: { token, period : 3600s, renewable: true } ← periodic token, no max-TTL
468474 │
469475 └─► Cache token in: /agent/llm-token/token
470476
471477
472- T=45min : Proactive Renewal (75% of TTL )
478+ T≈40min : Proactive Renewal (~2/3 of period )
473479 vault-agent monitors expiration
474480 │
475481 ├─► POST /v1/auth/token/renew-self
476482 │ Header: X-Vault-Token: <current_token>
477483 │
478- └─► Receives: { token, ttl : 3600s } (same token, extended )
484+ └─► Receives: { token, period : 3600s } (same token, period reset )
479485 │
480486 └─► Update cache: /agent/llm-token/token
487+ │
488+ └─► Repeats forever — a periodic token never hits a max-TTL,
489+ so steady-state operation never needs approle/login again.
481490
482491
483- T=59min: Renewal Failed (fallback)
484- If renewal fails:
492+ On agent restart only:
493+ vault-agent re-reads role_id + secret_id from disk
485494 │
486- ├─► Re-authenticate from scratch
487- │ POST /v1/auth/approle/login
495+ ├─► POST /v1/auth/approle/login (secret_id must still be valid)
488496 │
489- └─► New token issued and cached
497+ └─► New periodic token issued and cached
490498
491499
492500Application Request (anytime):
@@ -856,15 +864,16 @@ Step 12: Check Vault Seal Status
856864 └─► GET /v1/sys/seal-status
857865 └─► If unsealed: Skip unseal steps
858866
859- Step 13: Regenerate Secret IDs Only
860- └─► POST /v1/auth/approle/ role/ gui-service/secret-id
861- └ ─► POST /v1/auth/approle/role/cron-manager-service/secret-id
862- └ ─► POST /v1/auth/approle/role/llm-orchestration-service/secret-id
863- └─► Write new secret_ids to /agent/credentials/
867+ Step 13: Validate and Reconcile Secret IDs
868+ └─► For each role ( gui, cron-manager, llm-orchestration):
869+ ├ ─► Test existing on-disk secret_id via AppRole login
870+ ├ ─► If valid: Reuse (no change to credential file)
871+ └─► If invalid/missing: Mint new secret_id and write to disk
864872
865873Note: role_ids remain unchanged (static identifiers)
866874Note: Existing secrets and policies preserved
867875Note: RSA keypair NOT regenerated (preserved)
876+ Note: Stable secret_ids across restarts reduce credential churn
868877
869878═══════════════════════════════════════════════════════════════════
870879COMPLETION
@@ -1128,13 +1137,14 @@ Startup Order:
11281137vault-init Behavior:
11291138 - Detects Vault already initialized
11301139 - Skips initialization steps
1131- - Regenerates secret_ids only
1132- - Updates credential files
1140+ - Validates existing secret_ids (reuses if still valid)
1141+ - Mints new secret_ids only if existing ones are invalid
11331142
11341143Result:
1135- All services start with fresh credentials
1144+ All services start with validated credentials
11361145 Existing secrets preserved
11371146 No manual intervention needed
1147+ Stable secret_ids reduce unnecessary credential churn
11381148```
11391149
11401150### Token Regeneration Strategy
@@ -1143,22 +1153,23 @@ Result:
11431153Current Implementation:
11441154
114511551. On Every Container Restart:
1146- └─► vault-init regenerates secret_ids
1147- └ ─► Vault agents get new tokens
1148- └─► Old tokens remain valid until expiration
1156+ └─► vault-init validates existing secret_ids
1157+ ├ ─► If valid: Reuse ( agents continue with same credentials)
1158+ └─► If invalid: Mint new secret_id, agents re-authenticate
11491159
115011602. Token Lifecycle:
1151- └─► Issue: vault-agent authenticates
1161+ └─► Issue: vault-agent authenticates (periodic token, token_period per role)
11521162 └─► Use: Application makes requests
1153- └─► Renew: vault-agent extends TTL
1154- └─► Expire: Automatic renewal failed
1155- └─► Re-issue: vault- agent re-authenticates
1163+ └─► Renew: vault-agent renews within the period (~2/3 of period)
1164+ └─► No max-TTL: renewal continues indefinitely
1165+ └─► Re-issue: only on agent restart, via secret_id login
11561166
115711673. Security Benefits:
1158- Short-lived tokens (1 hour for LLM, 32 days for others)
1159- Automatic rotation on agent restart
1160- No manual token management
1161- Compromised tokens have limited lifetime
1168+ Periodic tokens (period 1h LLM, 30m Cron, 20m GUI), renewed continuously
1169+ Steady-state operation never re-runs approle/login (a stale secret_id
1170+ cannot strand a running agent)
1171+ Stable secret_ids (no unnecessary churn on restart)
1172+ Compromised tokens limited to one un-renewed period
11621173```
11631174
11641175### Audit Logging Capabilities
0 commit comments