legion-crypt 1.5.42 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +71 -0
- data/CLAUDE.md +12 -11
- data/lib/legion/crypt/lease_manager.rb +5 -831
- data/lib/legion/crypt/settings.rb +7 -0
- data/lib/legion/crypt/vault/auth/jwt.rb +28 -0
- data/lib/legion/crypt/vault/auth/kerberos.rb +60 -0
- data/lib/legion/crypt/vault/auth/ldap.rb +29 -0
- data/lib/legion/crypt/vault/auth.rb +50 -0
- data/lib/legion/crypt/vault/client.rb +9 -2
- data/lib/legion/crypt/vault/cluster.rb +47 -115
- data/lib/legion/crypt/vault/entity.rb +3 -4
- data/lib/legion/crypt/vault/leases.rb +871 -0
- data/lib/legion/crypt/vault/session.rb +405 -0
- data/lib/legion/crypt/vault.rb +16 -21
- data/lib/legion/crypt/version.rb +1 -1
- data/lib/legion/crypt.rb +105 -119
- metadata +7 -6
- data/lib/legion/crypt/kerberos_auth.rb +0 -119
- data/lib/legion/crypt/ldap_auth.rb +0 -48
- data/lib/legion/crypt/token_renewer.rb +0 -318
- data/lib/legion/crypt/vault/jwt_auth.rb +0 -99
- data/lib/legion/crypt/vault/kerberos_auth.rb +0 -53
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d004e86a701b8740daa5e5c17fb2baf29314a878832696023d2c8a66088aafc3
|
|
4
|
+
data.tar.gz: 04cac6ad63d92b54bbbcae9664d58a6252ccfce29418e9b3ea9f76c1758bb4d8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9530a7a4ce7b6088b9bb8c1dcc03f217fe6ecfd1fb982b3f8e10f0a3833995edba6a0f22b0d856dc6e618541831a04c65e090da2b5dce080a31352c72c2011a1
|
|
7
|
+
data.tar.gz: 2b31abb97158b140da701acc58ff481b6ee183885ea14b7589eab1efba1db980001a3d4124242a16d3b24e687c0bcb941872429c9642ddbadb2061007160d741
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,76 @@
|
|
|
1
1
|
# Legion::Crypt
|
|
2
2
|
|
|
3
|
+
## [1.6.0] - 2026-11-13
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- `Legion::Crypt::Vault::Session` — one per Vault cluster. Composes a token
|
|
7
|
+
strategy (`Vault::Auth`) and a `Vault::Leases`, owns a single maintenance
|
|
8
|
+
thread, and drives the full re-authentication handoff: re-authenticate, re-issue
|
|
9
|
+
every dynamic-secret lease under the new token, reconnect consumers, and commit
|
|
10
|
+
(revoking the old token) or roll back to the previous token and leases on
|
|
11
|
+
failure.
|
|
12
|
+
- `Legion::Crypt::Vault::Auth` (module) and the `Kerberos`, `LDAP`, and `JWT`
|
|
13
|
+
token strategies. Each issues a grant from its Vault auth method and treats the
|
|
14
|
+
login `auth` response as the source-of-truth grant, reading per-cluster config
|
|
15
|
+
from `Legion::Settings`. Kerberos can re-authenticate from the ticket cache;
|
|
16
|
+
LDAP and JWT require a fresh login once the token is unusable.
|
|
17
|
+
- `Legion::Crypt::Vault::Leases` — the dynamic-secret lease lifecycle
|
|
18
|
+
(acquisition, 50% renewal on its own thread, reissue under a replaced token,
|
|
19
|
+
settings-reference publication, consumer reconnect, and revocation), moved from
|
|
20
|
+
the former `LeaseManager` implementation. It is built without a Vault client so
|
|
21
|
+
it can hold `lease://` settings references whether or not Vault is enabled.
|
|
22
|
+
- Spec coverage for `Vault::Session` (start, login, renewal policy, handoff
|
|
23
|
+
commit + rollback, stop), `Vault::Leases` (acquire / reissue / revoke),
|
|
24
|
+
`LeaseManager` without Vault, and the three `Vault::Auth` strategies.
|
|
25
|
+
|
|
26
|
+
### Changed
|
|
27
|
+
- `Legion::Crypt.start` now creates one `Vault::Session` per configured cluster
|
|
28
|
+
(or a single session for the default cluster); `Legion::Crypt.shutdown` stops
|
|
29
|
+
them. The token, lease, and re-authentication lifecycle now lives in the
|
|
30
|
+
per-cluster session rather than a process-wide coordinator on `Legion::Crypt`.
|
|
31
|
+
- `Legion::Crypt::LeaseManager` is now the `Singleton` subclass of
|
|
32
|
+
`Vault::Leases`: the one process-wide lease object, present from load. The
|
|
33
|
+
default cluster's session supplies its client and starts lease acquisition and
|
|
34
|
+
renewal once it has a token, with or without static lease definitions. This
|
|
35
|
+
preserves the `Legion::Crypt::LeaseManager.instance` contract that
|
|
36
|
+
legion-settings (lease:// resolution) and legion-data (consumer reconnects)
|
|
37
|
+
depend on, including when Vault is disabled or unreachable.
|
|
38
|
+
- The Vault token is renewed only when Vault's last auth response reported it
|
|
39
|
+
renewable. A non-renewable Kerberos token is replaced by re-authentication at
|
|
40
|
+
75% of its TTL; non-renewable LDAP/JWT tokens run to expiry and require a new
|
|
41
|
+
login. A static configured token is adopted after a health check, is never
|
|
42
|
+
revoked on shutdown, and is renewed only if its configuration says renewable.
|
|
43
|
+
- Tokens minted by LDAP and JWT logins are now revoked on shutdown, as Kerberos
|
|
44
|
+
tokens already were.
|
|
45
|
+
- Named clusters keep the top-level `crypt.vault.connected` flag current on
|
|
46
|
+
grant publication and disconnect, since LegionIO and extensions read it directly.
|
|
47
|
+
- Shutdown revokes tracked sessions and leases before the Vault tokens they
|
|
48
|
+
depend on. A token or lease that could not be revoked is reported as incomplete
|
|
49
|
+
cleanup instead of a completed stop.
|
|
50
|
+
- Authentication, renewal, re-authentication, and grant-installation failures
|
|
51
|
+
log at ERROR. A failed LDAP login is reported once, by `ldap_login_all`.
|
|
52
|
+
|
|
53
|
+
### Removed
|
|
54
|
+
- The process-wide grant coordinator on `Legion::Crypt`
|
|
55
|
+
(`install_vault_grant`, `retire_vault_grant`, `revoke_rejected_vault_grant`,
|
|
56
|
+
`stop_token_renewers`, `vault_auth_generation`) and the `Vault::Cluster`
|
|
57
|
+
cluster-connect helpers (`connect_all_clusters`, `connect_vault_cluster`), both
|
|
58
|
+
superseded by the per-session `Vault::Session`.
|
|
59
|
+
- The module-based `Legion::Crypt::Vault::KerberosAuth` and
|
|
60
|
+
`Legion::Crypt::Vault::JwtAuth`, the standalone token-renewer actor, and the
|
|
61
|
+
body of `Legion::Crypt::LeaseManager` (now `Vault::Leases`).
|
|
62
|
+
|
|
63
|
+
### Compatibility
|
|
64
|
+
- The public `Legion::Crypt` surface consumed by the daemon and other gems
|
|
65
|
+
(`start`, `shutdown`, `read`/`write`/`get`/`delete`/`exist?`,
|
|
66
|
+
`vault_connected?`, `kerberos_principal`, `ldap_login`/`ldap_login_all`,
|
|
67
|
+
`cluster_secret`, `fetch_bootstrap_rmq_creds`, `revoke_bootstrap_lease`,
|
|
68
|
+
`swap_to_identity_creds`, `dynamic_rmq_creds?`) is unchanged, so no LegionIO or
|
|
69
|
+
cross-gem changes are required.
|
|
70
|
+
- `Legion::Crypt.vault_client` remains public for now; de-publicizing it (and
|
|
71
|
+
extending per-session lease management beyond the default cluster) are
|
|
72
|
+
follow-ups.
|
|
73
|
+
|
|
3
74
|
## [1.5.42] - 2026-11-08
|
|
4
75
|
|
|
5
76
|
### Changed
|
data/CLAUDE.md
CHANGED
|
@@ -7,21 +7,19 @@ Core encryption, secrets management, JWT, and HashiCorp Vault integration for Le
|
|
|
7
7
|
```
|
|
8
8
|
Legion::Crypt
|
|
9
9
|
├── Cipher # AES-256-GCM encryption; legacy CBC decryption; RSA key pair
|
|
10
|
-
├── Vault # read/write/connect
|
|
10
|
+
├── Vault # read/write/connect through Vault::Client
|
|
11
11
|
│ ├── Client # core-owned HTTP client using Faraday and Legion::JSON
|
|
12
|
-
│ ├── Cluster # client selection, caching,
|
|
12
|
+
│ ├── Cluster # client selection, caching, grant publication, connected flags
|
|
13
13
|
│ ├── Operation # bounded operations and shared shutdown deadlines
|
|
14
14
|
│ ├── Entity # entity and alias lookup
|
|
15
|
-
│ ├──
|
|
16
|
-
│ ├──
|
|
17
|
-
│
|
|
15
|
+
│ ├── Session # one per cluster: token lifecycle, renew/re-auth handoff, stop
|
|
16
|
+
│ ├── Auth # login strategies: Auth::Kerberos (SPNEGO), Auth::LDAP, Auth::JWT
|
|
17
|
+
│ ├── Leases # dynamic-secret leases: acquire, renew at 50% TTL, reissue, revoke
|
|
18
|
+
│ └── Renewer # legacy Every actor for KV session renewal
|
|
18
19
|
├── JWT # issue/verify/decode (HS256 cluster-secret or RS256 RSA)
|
|
19
20
|
├── JwksClient # external JWKS endpoint, 1hr TTL cache, thread-safe
|
|
20
21
|
├── ClusterSecret # shared AES key distributed across nodes
|
|
21
|
-
├── LeaseManager #
|
|
22
|
-
├── KerberosAuth # SPNEGO acquisition through the optional lex-kerberos helper
|
|
23
|
-
├── LdapAuth # cluster-scoped LDAP login and token maintenance
|
|
24
|
-
├── TokenRenewer # 75% TTL renewal; Kerberos-only re-auth; retry backoff
|
|
22
|
+
├── LeaseManager # Singleton Vault::Leases; cross-gem contract, exists without Vault
|
|
25
23
|
├── Ed25519 # key gen, sign, verify, Vault storage
|
|
26
24
|
├── PartitionKeys # HKDF per-tenant key derivation, AES-256-GCM
|
|
27
25
|
├── TLS # TLS configuration and Vault-backed material resolution
|
|
@@ -33,7 +31,9 @@ Legion::Crypt
|
|
|
33
31
|
└── MockVault # in-memory mock for local dev
|
|
34
32
|
```
|
|
35
33
|
|
|
36
|
-
Vault components live under `lib/legion/crypt/vault
|
|
34
|
+
Vault components live under `lib/legion/crypt/vault/`. Only what other gems reach by path or constant stays directly under `Legion::Crypt`: `LeaseManager` (legion-settings, legion-data) and `MockVault` (LegionIO).
|
|
35
|
+
|
|
36
|
+
Vault is optional. With it disabled or unreachable, boot continues, `LeaseManager.instance` still answers, and `lease://` references stay unresolved until a session acquires the lease and settings are resolved again.
|
|
37
37
|
|
|
38
38
|
## Key Design Decisions
|
|
39
39
|
|
|
@@ -41,7 +41,8 @@ Vault components live under `lib/legion/crypt/vault/`: `client.rb`, `cluster.rb`
|
|
|
41
41
|
- HS256 (cluster secret) for intra-cluster tokens; RS256 (RSA keypair) for externally-verifiable tokens
|
|
42
42
|
- `JwksClient` caches keys for one hour, shares concurrent refreshes, and throttles repeated unknown-key refreshes.
|
|
43
43
|
- Vault connectivity uses the core client; the `vault` gem is not required. Kerberos SPNEGO acquisition requires the optional `lex-kerberos` helper, and authentication preserves the configured Vault namespace.
|
|
44
|
-
- JWT/LDAP
|
|
44
|
+
- A Vault token is renewed only when Vault's last auth response said it is renewable. JWT/LDAP never fall back to Kerberos: expiry or terminal rejection requires login again. Kerberos grants alone re-authenticate automatically, at 75% TTL when not renewable.
|
|
45
|
+
- Lease renewal runs on the `Leases` thread, separate from the session's token thread, and only for the default cluster.
|
|
45
46
|
|
|
46
47
|
## Framework Contracts
|
|
47
48
|
|