Commit Graph

147 Commits

Author SHA1 Message Date
Paul Lorenz 1ae9b5b121 Validate the API session token when creating circuits via CreateCircuitV3
- requires an API session token on CreateCircuitV3 requests and validates it,
  covering signature, audience, token type, and revocation by token id,
  identity, and api session
- takes the dialing identity from the validated token claims rather than the
  router-supplied identity id, and rejects a request whose asserted identity
  does not match the token subject
- adds the api session id to the log context, matching the V1 and V2 paths
- adds tests for a missing token, an invalid token, and a token belonging to a
  different identity than the one asserted
- notes the advisory in the 2.0.3 release notes
2026-08-20 15:38:27 -04:00
Paul Lorenz 039820510c Merge pull request #4148 from openziti/fix/legacy-session-accept-2.0.x
Accept legacy sessions and signal recovery for invalid service tokens (backport to 2.0.x)
2026-08-13 12:07:56 -04:00
Paul Lorenz e4a4837cb8 Merge pull request #4163 from openziti/fix/leaderless-terminator-retry-2.0.x
Signal retry on leaderless terminator operations (backport to 2.0.x)
2026-08-13 11:06:29 -04:00
Paul Lorenz d231be36b0 Set env on the v1 create-circuit request context. Fixes #4242
- passes appEnv into the legacy v1 handler's request context, so token
  validation no longer makes a nil-interface call and panics the controller
- adds a regression test driving the v1 handler over the control channel with
  JWT-prefixed, opaque, and empty tokens, asserting an error reply comes back
  and the controller keeps serving
2026-08-07 15:30:40 -04:00
Paul Lorenz 8dcc60d319 Add tests for opaque service session token loading
- verifies loadFromBolt accepts a legacy opaque service session token for its owning api session
- verifies loadFromBolt rejects an opaque service session token presented under a different api session with an InvalidSessionError
2026-07-30 10:58:05 -04:00
Paul Lorenz c0bf5b7126 Signal retry on leaderless terminator operations. Fixes #4161
Backport of #4160 to release-v2.0.x.

- adds command.WasLeaderless to classify cluster-has-no-leader dispatch errors as retriable
- replies busy instead of dropping or hard-failing terminator creates when the cluster is briefly leaderless, so the router backs off and requeues promptly rather than waiting for its multi-minute recovery scan
- removes the racy up-front leaderless pre-check in the sdk create handler in favor of classifying the actual dispatch result
- applies the same retriable classification to the ert tunnel create and batch remove terminator handlers
2026-07-24 11:44:37 -04:00
Paul Lorenz 9054e77fff Accept legacy sessions and signal recovery for invalid service tokens. Fixes #4145
- loadFromBolt now accepts a non-JWT (legacy/durable) service session token by
  looking the session up via Session.ReadByToken and verifying it belongs to the
  api session, so a legacy client's existing session keeps working across a
  controller upgrade instead of failing as a malformed JWT
- classifies service-access token validation failures (malformed, expired, bad
  claims, mismatched api session, revoked) as InvalidSession so the client
  re-creates, while revocation-store/datastore read failures remain internalError
  so a transient controller fault does not make clients discard valid sessions
- adds a typed common.InvalidTokenError so ValidateServiceAccessToken can
  distinguish token-level failures from infrastructure failures
2026-07-23 10:56:25 -04:00
Paul Lorenz 82ac2e8060 Rework connect event handling to ensure serialized-per-router handling 2026-04-24 13:22:02 -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
Paul Lorenz f2db0e147d Fix connect events handler goroutine leak. Fixes #3746
- replaces the per-handler goroutine in connectEventsHandler with a shared,
  bounded goroutine pool on AppEnv
- the old design spawned a processEvents goroutine per router connection that
  only exited on application shutdown, leaking a goroutine on every reconnect
- adds ConnectEventsConfig to the controller config with pool tuning options
  (queueSize, minWorkers, maxWorkers, idleTime)
- defaults: queue 16, 0-16 workers, 30s idle timeout
2026-04-02 23:44:43 -04:00
Paul Lorenz 7b4ae12c05 Add CreateCircuitV3 for RDM-authorized circuit creation. Fixes #3721
- adds CreateCircuitV3 message type and handler for routers that have
  already authorized dials locally via RDM, bypassing service session
  tokens in favor of identity ID, service ID, and pre-assigned circuit ID
- renames CreateCircuitRequest/Response to CreateCircuitV2Request/V2Response
  for clarity now that V3 exists
- adds CircuitManager.Reserve to atomically claim circuit IDs before routing,
  preventing collisions on pre-assigned IDs
- extends CreateCircuitParams with GetCircuitId so V3 can supply a
  pre-assigned circuit ID (falls back to UUID generation when empty)
- fixes IsDialableByIdentity which was incorrectly calling IsBindableByIdentity
- extracts V2 handler into its own file create_circuit_v2.go
- adds CreateCircuitV3RequestType/ResponseType (20222/20223) to edge_ctrl protobuf
- registers V3 handler in controller server
2026-03-27 14:41:28 -04:00
Andrew Martinez fb2034245d fixes openziti/ziti#3356 adds www-authenticate headers (#3561)
* fixes openziti/ziti#3356 adds www-authenticate headers

- www-authenticate headers are returned on 401s from API requests
- www-authenticate headers are returned during authentication to signal
  addtional JWT bearer tokens needed (secondary ext jwt)
- adds support for additional headers on API errors
- adds SecurityTokenCtx for centralized security header processing
  (legacy, jwt, etc.)
- adds SecurityCtx for centralized identity, auth policy, MFA handling
- refactors existing JWT authentication methods (oidc, legacy) to use
  centralized processing where possible
2026-02-24 10:01:36 -05:00
Paul Lorenz 90112219a3 Support multi-underlay control channels. Fixes #3550 2026-02-11 14:20:29 -05:00
Paul Lorenz 45bf527441 Provide more error context to SDKs for terminator errors. Fixes #3524 2026-02-04 14:36:21 -05:00
Paul Lorenz da9ef76d19 Optimize imports 2026-01-28 15:01:35 -05:00
Paul Lorenz 2ffc6e1151 Update ziti version to 2.0 2026-01-28 12:34:10 -05:00
Paul Lorenz 284a08b1af Remove support for create terminator v1. Fixes #3516 2026-01-26 10:25:39 -05:00
Andrew Martinez 25dda7f994 adds error response for token update if API Session IDs do not match (#3440)
fixes #3437 adds error response for token update if API Session IDs do not match
- updates all token updates to add structured errors
- added an upfront API Session ID check on token updates in order to
  provide an error

adds fix for #3444 ensure api session types are checked to avoid nil ref

Identities may have mixed authentication modes if the credentials are
being shared. While not recommended, it is possible. This can cause
situations where API Session are not of a uniform type. During token
updates for OIDC, legacy API Sessions must be ignored.

- ignores legacy API Sessions during token update for a specific
  identity
- adds error messages for unlikely scenarios that indicate systemic
  failures
2025-12-16 09:26:46 -05:00
Paul Lorenz ffe6e16b76 Separate raft command submission limiting from in-flight limiting. Fix some create terminator error handling. Fixes #3318 2025-12-03 17:01:28 -05:00
Andrew Martinez d02d25c031 fix openziti/ziti#3354 sdk/env details not distributed (#3394)
* fix openziti/ziti#3354 sdk/env details not distributed
2025-11-26 10:54:10 -05:00
Paul Lorenz 8bedd3af1d Clean up connect events tests and remove global XG registry. Fixes #3345 2025-10-29 14:46:52 -04: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 423dff3d92 fix #3236 SDK/ENV info is not saved on OIDC auth (#3137) 2025-08-05 09:51:00 -04:00
Paul Lorenz 10f4ad046d Fix race condition on terminator create 2025-07-23 15:00:25 -04:00
Paul Lorenz 5902631861 ids used by circuits and ingress/egress can conflict in an HA setup. Fixes #3124 2025-06-18 11:24:16 -04:00
Paul Lorenz 981df8269d Support xgress flow control from the SDK. Fixes #2986 2025-04-30 10:27:43 -04:00
Andrew Martinez 0e61edb2f9 fix #2984 identity/router enrollment do not return full chains (#2990)
* fix #2984 identity/router enrollment do not return full chains

- router extend via REST/ctrl now return full chains
- identity extend via REST now return full chains
- updates tests to allow for chain lengths
- modifies verification to look at the first cert in the chain (leaf)
- modifies edge routers to not start extension if new certs can't be
  saved
- adds network-jwt tests
2025-04-11 11:27:57 -04:00
Paul Lorenz e647d67325 Update to channel/v4 2025-04-02 15:28:59 -04:00
Andrew Martinez 78605a0955 fix #2865 remove fingerprint checks from controller (#2866)
* fix #2865 remove fingerprint checks from controller

- on their own fingerpint checking does not provide any additional
  security as the underlying certificate is not verified
- fingerprint based checking will not work with spiffeid generated
  certificates or x509 claims
- routers still support sending fingerprints for old controller support
2025-03-04 10:21:38 -05: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 3c9861ca3b Update deps and changelog. Update for SDK changes 2025-02-10 15:35:17 -05:00
Paul Lorenz d84292cfd9 Fix tests 2025-01-07 19:22:47 -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 32eddd61ca HA SDK terminators test. Fixes #2217. Fixes #2533 2024-11-12 18:45:08 -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 0945427320 Migrated edge router tunneler code to use the router data model. Fixes #2121 2024-07-26 17:06:01 -04:00
Paul Lorenz c3b43133d1 Merge fabric and controller model code. Fixes #2205 2024-07-09 16:11:01 -04:00
Paul Lorenz a0245e5cd3 Allow ER/T to intercept services w/out sessions when in HA mode. Fixes #1942 2024-04-16 15:11:00 -04:00
Andrew Martinez 36ced919ae Merge branch 'main' into ha-staging 2024-03-14 08:38:57 -04:00
Paul Lorenz fab81e4cd4 Add terminator chaos testing and fix issues found. Fixes #1794 Fixes #1369 2024-03-12 10:31:36 -04:00
Andrew Martinez 09542c7728 consolidated ha changes 2024-02-29 09:27:56 -05:00
Andrew Martinez 935c89bb7d fixes 1354 adds hostname/domain to env info 2024-02-22 14:32:00 -05:00
Paul Lorenz 744ae68bbd Fix controller crash. Fixes #1736 2024-02-08 21:55:48 -05:00
Paul Lorenz 3aace85a97 Refactor terminator state machine to be more like links state machine. Fixes #1733 Fixes #1734 2024-02-08 21:55:48 -05:00
Paul Lorenz 26c6263fa3 Fix terminator id race condition. Fixes #1685 2024-01-19 11:31:32 -05:00
Paul Lorenz a84369a6e9 Consolidate fabric and edge persistence code. Fixes #1555 2023-12-06 17:36:37 -05:00
Paul Lorenz db6554ee06 Implement idempotency for sdk terminators. Fixes #1446 2023-12-01 15:44:05 -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 3523b34b2c Fix panic when router version info isn't set by ensuring it is set and making sure we get the right version. Fixes #1423 2023-10-11 13:55:50 -04:00