39 Commits

Author SHA1 Message Date
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 1a58248069 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

(cherry picked from commit d8cedeb8ea)
2026-08-06 16:05:41 -04:00
Paul Lorenz 40845be942 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

(cherry picked from commit 11e049a452)
2026-08-06 16:04:16 -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 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