Commit Graph

42 Commits

Author SHA1 Message Date
Andrew Martinez 948735d86c fixes openziti/ziti#4094 accept first-party certs issued by a separat… (#4140)
* fixes openziti/ziti#4094 accept first-party certs issued by a separate edge signing CA

- adds FirstPartyX509CertValidation and ThirdPartyX509CertValidation usages and an
  intermediates field to the router data model public keys, deprecating
  ClientX509CertValidation
- publishes config CA bundle roots as first-party anchors with their intermediates and
  Ca store entries as third-party anchors; controller certs carry JWT validation only,
  since a controller identity is never a CA and anchors no client cert chains
- builds router first-party and client cert trust pools from the published usages,
  falling back to the deprecated usage against older controllers
- propagates the full signing cert chain between controllers via a new mesh
  SigningCertChainHeader and persists whole chains in controller records
- removes the orphaned InstantStrategy.AddPublicKey, dead since public key sync moved
  to controller list data
- gives each command dispatcher its own decoder registry so multiple in-process
  controllers no longer decode into the last-started controller's managers
- adds a three-controller in-process HA test harness with a split signing PKI,
  cluster formation and first-party cert integration tests
- trusts the edge signing CA when verifying router control channel certs
- adds a variadic additionalRoots parameter to VerifyLeafCertChain, applied to a
  clone of the caller's pool so an identity's live tls.Configs are unaffected
- passes the edge enrollment signing CA bundle as additional roots when admitting
  a router control channel connection, so a deployment whose signing CA sits
  outside the controller's own trust bundle no longer has every router refused
- leaves the fingerprint check bound to the verified leaf, so the wider anchor set
  changes which chains verify, not which routers are admitted
- covers the split-root case and the caller-pool guarantee in common/cert tests
2026-08-26 14:07:31 -04:00
Paul Lorenz 34133bd7d6 Merge pull request #4162 from openziti/fix/leaderless-terminator-retry
Signal retry on leaderless terminator operations
2026-08-13 11:06:12 -04:00
Paul Lorenz d838e209ac Signal retry on leaderless terminator operations. Fixes #4160
- 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:43:33 -04:00
Paul Lorenz d8cedeb8ea Persist cluster id across migration snapshot restore. For #4104
- adds a clusterId field to SyncSnapshotCommand and writes it into the database
  after the migration snapshot restore, so a controller bootstrapped by
  migrating a database ends up with a durable cluster id instead of an empty one
- the snapshot restore replaces the whole FSM database with the migration
  source, which carries no cluster id, so without this the id written during
  bootstrap was silently wiped and the node came up with an empty, non-durable
  cluster id, defeating the mesh cluster-id validation
- persists the raft index after the cluster id in RestoreSnapshot so the index
  remains the completion gate: a failure before it halts (SyncSnapshotCommand is
  a critical command) and replays/retries on restart rather than skipping the
  command with a blank cluster id
- fails RaftRestoreFromBoltDb when the cluster id is blank after bootstrap
- regenerates cmd.pb.go for the new field
2026-07-17 18:07:50 -04:00
Paul Lorenz 11e049a452 Halt on critical-command apply failure instead of advancing. For #4104
- adds a CriticalCommand marker interface for commands that establish base
  state, and marks SyncSnapshotCommand (a full snapshot restore) as critical
- makes BoltDbFsm.Apply halt when a critical command fails to apply, rather
  than logging the error and persisting the advanced raft index; the failed
  apply's in-tx index update is rolled back and left unpersisted, so raft
  replays and retries the command on restart instead of the node running
  caught-up-on-index but empty-on-data
- attaches the command type to all apply log lines so a failure is
  self-contained
2026-07-17 18:07:50 -04:00
Paul Lorenz 86092a8640 Migrate to the sdk-golang v2 module path. For #3884
Bumps the sdk-golang dependency from v1 to the v2 module
(`github.com/openziti/sdk-golang/v2` at v2.0.0-pre1) and updates all
import paths. This is a no-behavior-change precursor that isolates the
dependency migration from the Connect-V2 feature work in #3884.

- Rewrites `github.com/openziti/sdk-golang/...` imports to
  `github.com/openziti/sdk-golang/v2/...` across the main and zititest
  modules.
- Pins both modules to `github.com/openziti/sdk-golang/v2 v2.0.0-pre1`.
- Adapts `edgeXgressConn.AcceptMessage` to the v2 `MsgSink` signature,
  which now takes an `edge.SdkChannel` argument.
- Replaces the removed `edge.Conn.GetRouterId()` with
  `RemoteAddr().String()` in the loop4 traffic-test logging.

For openziti/sdk-golang#936.
2026-06-23 15:43:39 -04:00
Paul Lorenz 1c122af490 Rewrite channel/v4 imports to channel/v5. For #3983
- moves the channel dependency to channel/v5 v5.0.10 and sdk-golang to v1.9.0 in the root and zititest modules
- mechanically rewrites every channel/v4 import path to channel/v5

This is the import-path-only step; the API-level changes the switch requires land in the following commit. This commit does not build on its own.
2026-06-18 12:51: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 6b869cea9d Add support for ctrlChanListener on router to the model. Fixes #3635 2026-03-07 00:00:51 -05:00
Paul Lorenz 46cd641c71 Use success rate for adaptive rate limiter window sizing. Fixes #3636
- replaces queue-position-based window adjustment with an exponentially
  decaying success rate histogram to drive grow/shrink decisions
- introduces AdaptiveRateLimitTrackerConfig with configurable
  successThreshold, increaseFactor, decreaseFactor,
  increaseCheckInterval, and decreaseCheckInterval
- grows window by increaseFactor when success rate exceeds threshold,
  shrinks by decreaseFactor when it falls below
- renames LoadAdaptiveRateLimiterConfig to a Load method on the config
- adds currentSize and currentWindow to Success/Backoff/Failed debug logs
- updates controller TLS handshake, raft, and router ctrl rate limiters
  to use the new AdaptiveRateLimitTrackerConfig
2026-03-05 18:35:57 -05: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 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 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 e647d67325 Update to channel/v4 2025-04-02 15:28:59 -04: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 32eddd61ca HA SDK terminators test. Fixes #2217. Fixes #2533 2024-11-12 18:45:08 -05:00
Paul Lorenz fb809263b3 Simplify raft bootstrapping and controller initialization. Fixes #2212 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 ff8d70e418 Move rate limiter logging to debug 2024-04-09 19:48:25 -04:00
Paul Lorenz 8f4f9944f5 Add TLS handshake rate limiter. Fixes #1904 2024-04-09 17:25:35 -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
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 8423a8dd6a Fix link management race conditions found by chaos testing. Fixes #1709 2024-01-29 17:23:51 -05:00
Paul Lorenz 04873a250d Add auth rate limiter. Fixes #1657. Also add links fablab stress test. 2023-12-21 09:48:04 -05:00
Paul Lorenz 9bed8a14a8 Add optional command rate limiter. Fixes #1445 2023-10-23 13:45:49 -04:00
Paul Lorenz f3d67b7f49 Update fabric imports 2023-09-28 23:34:28 -04:00
Paul Lorenz cdfd037da9 Move protobuf definitions to common 2023-08-10 19:38:48 -04:00
Paul Lorenz 23110fccb2 Implement entity change events. Fixes openziti/fabric#562 2023-04-25 11:38:03 -04:00
Paul Lorenz f0b83d0010 Track raft index in Db. Let's us start without rerunning all cmds at startup. Fixes #677. Fixes openziti/fabric#582 2023-04-25 11:32:35 -04:00
Paul Lorenz d1d0fe781b Update for storage API changes. 2023-04-25 11:32:33 -04:00
Paul Lorenz abb0eb96fb Add more raft configuration options. Fixes openziti/fabric#597
Add more raft config knobs
Refactor peer handles to be consistent with other handlers
Allow inspect to work across controllers
Add config and clusterconfig inspect support
2023-02-15 23:47:57 -05:00
Paul Lorenz b5bae84325 Fix some handler removal. Only propagate crud terminator events on leader by default. Fixes openziti/fabric#573 2023-01-04 09:53:36 -05:00
Paul Lorenz e0f5092a08 Use one port for ctrl channel to router and controllers. Allow syncing existing DB to raft. Fixes #471. Fixes openziti/fabric#479. 2022-08-22 12:09:07 -04:00
Paul Lorenz 521c5d2be1 Fixes for command encoding and decoding 2022-08-11 11:24:23 -04:00
Paul Lorenz 0e07f211be Add flags to create/update commands. allows some lightweight logic specialization (eg priveleged vs non-priveleged updates) 2022-07-29 10:53:39 -04:00
Paul Lorenz 858642bc38 Move UpdatedFields to fabric. Start moving model layer to generics 2022-07-27 11:33:24 -04:00
Paul Lorenz 3d49022f4a Update for foundation changes 2022-07-01 14:29:12 -04:00
Paul Lorenz b26fcf8909 Fix copyright 2022-06-29 16:59:46 -04:00
Paul Lorenz a64c626cb4 Controller -> Manager for entity managers 2022-06-02 22:53:22 -04:00
Paul Lorenz eaa75d48c6 Initial support for distributed model via RAFT 2022-06-02 22:49:55 -04:00