95 Commits

Author SHA1 Message Date
Paul Lorenz 3187db726a Load revocations when rebuilding the router data model. For #4102
Backport of the BuildAll revocation-load fix (main PR #4103) so the
router-data-model validation reflects revocation presence correctly on this
branch. The test accompanying the main-line change is omitted here because its
test helper does not exist on release-v2.0.x.

- adds BuildRevocations and wires it into InstantStrategy.BuildAll so a rebuilt
  data model includes existing revocations instead of dropping them
- skips already-expired revocations at load time
2026-07-14 17:02:45 -04:00
Paul Lorenz 30256b9918 Enforce api-session and identity revocations on the router. Fixes #3929
Backport to release-v2.0.x of #3927 (main-line fix in PR #3930).

The router's CheckConnections reaper enforced only JWT expiry, so a revoked OIDC
api-session, or a disabled/deleted identity, kept its live circuits and hosted
terminators until the access token expired. The router now enforces the
RouterDataModel revocations directly, tightening access-loss propagation to the
reaper interval.

- adds a Type field to DataState_Revocation and the raft Revocation command
  proto, mirroring rest_model.RevocationTypeEnum (API_SESSION/IDENTITY/JTI) so the
  management API, OIDC producers, sync, and router enforcement share one
  vocabulary; the common.RevocationType* constants are compile-time bound to the
  enum to prevent drift
- adds an IssuedBefore cutoff so an identity revocation invalidates only sessions
  issued before it; a session re-authenticated after the cutoff survives the
  still-lingering revocation. Persists IssuedBefore on the db and model Revocation
  and carries it (plus the Type) through the single and batched raft marshalling
- adds RouterDataModel.IsApiSessionRevoked and IsIdentityRevoked and enforces both
  in CheckConnections, closing a revoked session's connections
- revokes a deleted or disabled identity's live OIDC sessions via an
  IdentityRevocationConstraint in the db package, run as a store pre-commit
  constraint so the revocation is written in the same transaction as the identity
  change and cannot be skipped (self-contained OIDC JWTs aren't otherwise
  reachable). NewIdentityManager installs it with the revocation type and lifetime
- has the OIDC end-session (TerminateSessionFromRequest) revoke the specific
  api-session named by the z_asid claim, with an identity-scoped fallback; sets
  IssuedBefore on the identity fallback and the management revocation API; adds
  RevocationManager.CreateOrReplace, routed through by both the OIDC paths and the
  management revocation API, so a repeat logout/termination/revocation refreshes
  the cutoff rather than colliding on the reused id. Expiry derives from the
  longest configured token duration via a shared common.MaxTokenDuration helper
- adds tests/revocation_enforcement_oidc_test.go covering api-session revocation
  (and a fresh session staying unaffected), identity disable and delete, and the
  identity cutoff (a post-cutoff session surviving the lingering revocation)
- regenerates edge_cmd.pb.go (protoc-gen-go v1.31.0) and edge_ctrl.pb.go
  (v1.36.11) against the release-v2.0.x base, matching each file's existing
  generator version
2026-06-24 15:42:01 -04:00
Paul Lorenz 4df6ae564d Update package paths for newly imported storage and ziti-db-explorer packages 2026-04-16 09:18:55 -04:00
Andrew Martinez dbeb5c9f46 fixes openziti/ziti#3673 purge expired revocations, fix revocation bugs (#3679)
- fixes RevokeToken double-write: adds return after JWTID-keyed revocation
    save, preventing fallthrough write with raw JWT string as unreachable key
  - fixes TerminateSession key mismatch: stores revocation by identityId alone,
    matching the Subject-based lookup in ValidateAccessToken
  - fixes RevocationDelete sync action: passes DataState_Delete instead of
    DataState_Create so routers evict the entry from their data model
  - adds RevocationManager.DeleteExpired: batch-deletes expired revocations in
    batches of 500 until none remain
  - adds RevocationEnforcer: periodic policy runner (every 1 minute) that calls
    DeleteExpired and records metrics

before test fixes
2026-03-11 20:33:38 -04:00
Paul Lorenz e1638173cd Fixes for SDK terminator management. Add support for ziti sdk inspection. Fixes #3609
- removes legacy v1 terminator code path; all terminators now use v2 flow
- refactors edgeTerminator.close() to decouple SDK notification from control plane notification
- adds pending SDK close notification queue with retry when channel is busy
- adds post-create inspect mechanism that verifies SDK still holds the bind after terminator creation
- queues second post-create inspect when establishment takes >30s to catch SDK timeout races
- detects and discards stale reordered binds on the same connection by comparing connIds
- re-establishes replacement terminators when a delete/create race is detected
- eliminates IsEntityPresent pre-filter in removeTerminatorsHandler to prevent raft ordering races
- fixes ValidateTerminators to query identities from the correct manager with the correct filter field
- adds postCreate flag to ValidateTerminatorsV2Request so routers skip redundant SDK inspect
- returns retry-later (nil result) from router validation when inspect is temporarily unavailable
- blocks SyncAllSubscribers until completion and guards RouterDataModel replacement with in-progress flag
- fixes InheritLocalData to enable service access tracking for all subscribed identities
- adds Services.Has check in GetServiceAccessPolicies to prevent false policy grants
- validates policy-to-identity associations in ValidateServicePolicies
- adds `ziti agent tunnel dump-sdk` command for SDK context inspection via IPC agent
- adds `ziti fabric inspect sdk` command to query SDK context through routers
- fixes --expected-per-host CLI flag binding in validate terminators command
- changes bind-access-lost retry hint from NotRetriable to RetryStartOver
- moves trace route response and xgress close handling off channel handler goroutine
- fixes listTerminators test helper to URL-encode filter parameter
- improves sdk-hosting-test validation resilience with login and query retries
- adds terminator_create_flow.md documenting the full lifecycle across SDK, router, and controller
- adds detailed logging for data model sync, service access tracking, and subscriber change detection
2026-03-11 13:10:28 -04:00
Paul Lorenz 90112219a3 Support multi-underlay control channels. Fixes #3550 2026-02-11 14:20:29 -05:00
Paul Lorenz 2ffc6e1151 Update ziti version to 2.0 2026-01-28 12:34:10 -05:00
Paul Lorenz c18a594b56 Clustering coordination fixes
* Allow routers to request current cluster membership information. Fixes #3503
* Get cluster membership information from raft directly, rather than trying to cache it in the DB. Fixes #3501
* Set a router data model timeline when initializing a new HA setup, rather than letting it stay blank. Fixes #3500
* Reduce router data model full state updates. Fixes #3504
2026-01-17 02:03:31 -05:00
Paul Lorenz e0315599db Only send model updates on resubscribe if the RDM index has advanced. Fixes #3469 2025-12-19 14:03:09 -05:00
Paul Lorenz a18073160c remove debug output 2025-12-03 16:30:45 -05:00
Paul Lorenz d37c721c83 Optimize router data model subscription code. Add additional events. Fixes #3359 2025-12-02 11:37:38 -05:00
Andrew Martinez bb5cc51a97 adds posture cache, instance, instance data, and event hooks (#3267)
* adds posture cache, instance, instance data, and event hooks

- reworks router security
- abstracts api session and service sessions
- use connection tracker instead of various maps
- doc
- adds service sessions as always JWTs
- addes token logging fields
- removes multiple connection tracking fields
- adds support for router specific posture data/respones
- adds support for router posture check evaluation
- defer dial/bind posture checking for legacy to controller
- fix double session event emitting
- fix session event missing id
2025-10-15 14:01:56 -04:00
Andrew Martinez e01944aba2 fix #3241 fix unsafe nil fingerprint dereference (#3242)
* fix #3241 fix unsafe nil fingerprint dereference

- panic when a router connects and disconnects quickly or fails to
  authenticate
- add safe access
- add an additional safe deref during connect
2025-09-04 14:45:49 -04:00
Paul Lorenz e647d67325 Update to channel/v4 2025-04-02 15:28:59 -04:00
Paul Lorenz f79f777d33 Fix router data model 'create public key' related errors. Fixes #2932 2025-03-28 23:57:39 -04:00
Paul Lorenz ec57c80ff7 ER/T Hosting HA chaos test and fixes (#2806)
* Add ERT hosting chaos test. Also add ert terminator validation utility. Fixes #2288

* Rework ER/T terminator management based on SDK terminator management code

* Update deps

* Make sdk/ert-terminators into a constant
2025-02-25 17:02:21 -05:00
Paul Lorenz 03870760c3 Ensure restores and migrations work properly with RDM. Add restore from db for HA Clusters. Fixes #2549. Fixes #2649. Fixes #2707 2025-01-31 13:57:43 -05:00
Paul Lorenz 5429ce5064 Separate leader updates from controller cluster member updates 2025-01-09 16:18:34 -05:00
Paul Lorenz 84fba8a3e5 Logging tweaks and add missing code in factory_wrapper 2025-01-08 15:48:45 -05:00
Paul Lorenz a4d66f863b Switch router storage to serialized protobuf, rather than json 2025-01-07 19:23:06 -05:00
Paul Lorenz b9ed77e706 Fix concurrency issues. Add posture check verification. 2025-01-07 19:22:47 -05:00
Paul Lorenz c404a3a5bd Add config/config type tests for router data model 2025-01-07 19:22:47 -05:00
Paul Lorenz d84292cfd9 Fix tests 2025-01-07 19:22:47 -05:00
Paul Lorenz 37a80da89b Add RDM config, including a ctrl side disable flag. Fixes #2596 2025-01-07 19:22:47 -05:00
Paul Lorenz a34478bb06 Fix controller endpoint updates and update deps. Test RDM with HA. 2025-01-07 19:22:46 -05:00
Paul Lorenz 6517a7c22f Move routers to a subscription model where they subcribe to model data from one controller for a limited time. Fixes #2599 2025-01-07 19:21:53 -05:00
Paul Lorenz e16f97a7ea Router data model fixes. Add standard error when no leader is present. Fixes #2232 2025-01-07 19:21:53 -05:00
Paul Lorenz e09c56867c Remove HA config from router. Fixes #2566 2025-01-07 19:21:53 -05:00
Paul Lorenz 29a199ce12 Add router data model chaos test. Fixes #2550 2025-01-07 19:21:53 -05:00
Paul Lorenz 16f0a858e6 Add controller connect events. Fixes #1835. Fixes #2234 2024-11-01 15:21:01 -04:00
Paul Lorenz cccf0c06af Update to channel/v3. Fixes #2390 2024-09-09 12:23:25 -04:00
Paul Lorenz f731405ac0 Re-enable xgress MTU, with 0 disabling chunking. Implement frame when chunked. Fixes #2336 2024-08-21 12:24:00 -04:00
Paul Lorenz 0945427320 Migrated edge router tunneler code to use the router data model. Fixes #2121 2024-07-26 17:06:01 -04:00
Paul Lorenz 77d27ca781 Enhance the router data model with config information, fixes #2010 Add subscription model to router data model, fixes #1990 2024-07-17 14:31:39 -04:00
Paul Lorenz c3b43133d1 Merge fabric and controller model code. Fixes #2205 2024-07-09 16:11:01 -04:00
Andrew Martinez 9cb11be544 fixes standalone OIDC where the server JWT signer token was not added 2024-06-11 14:06:06 -04:00
Paul Lorenz 898e41ae2a Implement router data model changesets. Fixes #1966 2024-04-23 11:56:10 -04:00
Paul Lorenz 32d743ff11 Update router data model with: add service policy type, flesh out identity. Fixes #1950 Fixes #1951 2024-04-17 14:57:20 -04:00
Paul Lorenz d62e3cb71f Use cmap IterCB instead of IterBuffered where possible. Fixes #1902 2024-04-04 21:27:38 -04:00
Andrew Martinez e59f9b8d66 fix LoadOneById name change 2024-03-26 11:00:15 -04:00
Andrew Martinez 8c7b3b2e84 reduces prerms from admin to authenticated on list controllers
- updated public key sync to use controller list data instead of mesh peer
- fixes perms on controller list to not be admin only
2024-03-26 10:55:50 -04:00
Paul Lorenz 3cdb009aea Merge pull request #1853 from openziti/fix-db-validation
Fix validation perf. Fixes #1428. Remove duplicate LoadOneById method.
2024-03-21 13:51:02 -04:00
Paul Lorenz 881ec14b63 Fix validation perf. Fixes #1428. Remove duplicate LoadOneById method. 2024-03-21 10:10:07 -04:00
Paul Lorenz 1e17a70d3f Don't allow session sync to block channel. Fixes #1849 2024-03-20 14:02:18 -04:00
Andrew Martinez a3c3da870f pr changes, fixes revocation events 2024-03-05 09:48:13 -05:00
Andrew Martinez 401de61bbc spelling errors 2024-02-29 10:06:22 -05:00
Andrew Martinez 09542c7728 consolidated ha changes 2024-02-29 09:27:56 -05:00
Paul Lorenz a84369a6e9 Consolidate fabric and edge persistence code. Fixes #1555 2023-12-06 17:36:37 -05:00
Paul Lorenz b270d18faf Add additional logging. Remove unnecessary router lookups. May address #1460 2023-10-31 14:57:06 -04:00
Paul Lorenz f3d67b7f49 Update fabric imports 2023-09-28 23:34:28 -04:00