43 Commits
Author SHA1 Message Date
shadowdaoandClaude Sonnet 5.5 962d708fdd Rename Go module paths to repo.anhonesthost.net/CyberCoveLLC/threshold
Rename root, api and sdk module paths (imports, go.mod, go_package,
ldflags, build scripts, buf configs) and regenerate protobuf/gateway
code with the project's pinned toolchain. Wire identifiers unchanged.
api gets a local replace for sdk; root/api/sdk require v0.1.0.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-12 10:33:41 -07:00
Chandrasekhar Gadde 963ea30274 Memory leak fix for worker session management by immediately removing closed connections 2026-04-24 17:26:03 +05:30
aditya2548 f8363dd06e [COMPLIANCE] Update Copyright & License Headers 2026-04-06 15:48:57 +05:30
429247f407 [COMPLIANCE] Update Copyright Headers (#6282)
* [COMPLIANCE] Update Copyright and License Headers

* chore: make gen to generate files with copyright headers

* chore: update missed copyright headers

---------

Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
Co-authored-by: Justin Nguyen <justin.nguyen@hashicorp.com>
2026-01-28 11:05:07 -06:00
Johan Brandhorst-SatzkornandDamian Debkowski ec0a3f964b Worker status refactor (#5417)
* oss: feat(proto): statistics rpc added to server coordination service

* oss: feat(session): add update statistics status service

* oss: feat(handlers): add Statistics method to worker service server

* oss: feat(worker): add statistics ticking

* oss: internal/proto: define the new RoutingInfo RPC

* oss: internal/server: repository changes for RoutingInfo RPC

* oss: internal/daemon: add RoutingInfo handler to worker service

The new RoutingInfo RPC is used to get information from the worker
that is used to make routing decisions on the controller. It also
handles the initial request from the worker.

* oss: feat(db): server_worker_session_info table

* oss: feat(proto): session info rpc for server coordination service

* oss: feat(server): worker session info request data type

* oss: feat(worker): session info ticker

* oss: feat(handler): server coordination handler for session info

* oss: feat(session): utilize session info request time for session cleanup

* oss: proto: fix some gotags comments

Some of these fields were missing comments, while others had
incorrectly formatted comments.

* oss: worker: send connection status to server

This is required for the correct tracking of orphaned connections

* oss: internal/daemon/worker: add function to wait for Statistics RPC

* oss: internal/daemon/worker: add routing info RPC

The new RoutingInfo RPC replaces part of the Status RPC,
namely the part which is used by the controller and worker
to perform decisions around the establishment of new sessions
and new worker connections.

* oss: internal/daemon/worker: remove unnecessary error check

* oss: internal/daemon/worker: lock access to config and upstreams

The new confLock protects access to the conf value and to the
addressReceivers slice.

* oss: worker: replace Status RPC with RoutingInfo

* oss: worker: deprecate the Status RPC and related types

The Status RPC and related messages have been replaced
by the RoutingInfo/SessionInfo/Statistics RPCs. The controller
will continue to support the Status RPC until two new minor
versions have been released.

* oss: internal/event: add default deny for new worker RPCs

* oss: internal/daemon/worker: allow RPC interval to be set

The new SessionInfo/RoutingInfo/Statistics RPCs run at
long intervals, which make some of our cluster tests take
a long time to complete. This allows their interval to be
configured in tests.

* oss: all: use TestWorkerRPCInterval in slow tests

This should speed up these tests significantly.

* oss: internal/tests/cluster: reset sys eventer in test

---------

Co-authored-by: Damian Debkowski <damian.debkowski@hashicorp.com>
2025-01-09 10:26:37 -08:00
Damian Debkowski 868d7b8a2d test(daemon): remove tests with multihop (#5397) 2024-12-30 12:21:52 -08:00
Damian Debkowski 98bb4c8c31 test(cluster): split tests between parallel and sequential packages (#5390) 2024-12-20 13:53:37 -08:00
Johan Brandhorst-Satzkorn 20f11ab01b Revert "internal/daemon: speed up multi-worker tests (#5370)" (#5386)
Unfortunately, this started causing the enterprise tests to break in
an unexpected way. Reverting to spend some more time testing the changes.
2024-12-19 09:29:48 -08:00
Johan Brandhorst-Satzkorn 862a30c389 internal/daemon: speed up multi-worker tests (#5370)
Instead of sleeping, we can poll for the desired state. Also,
run shutdowns in parallel.
2024-12-17 09:18:27 -08:00
daniandDamian Debkowski 62c41191ff [fix] allow IPv6 controllers, workers, and targets (#5221)
Co-authored-by: Damian Debkowski <damian.debkowski@hashicorp.com>
2024-11-01 13:27:40 -04:00
Jeff MitchellandDamian Debkowski 35cef97bd4 Linter fixes PR 3 (#4415)
* Linter fixes

* fix(bsr): update test to register TEST protocol once

---------

Co-authored-by: Damian Debkowski <damian.debkowski@hashicorp.com>
2024-02-16 08:30:16 -05:00
Jeff Mitchell 9332179a01 Remove the deprecated old KMS worker auth mechanism (#3935)
This has been superceded by the nodeenrollment-based KMS worker auth
mechanism. This commit only removes the ability to connect with this
mechanism; some upgrade logic will remain intact for a bit and
can be removed later.
2024-01-12 11:58:12 -05:00
Irena Rindos 9733a250fa refact(event): move observability/event to event (#3704) 2023-09-12 08:15:34 -04:00
hashicorp-copywrite[bot]andJohan Brandhorst-Satzkorn 29da0bcb92 [COMPLIANCE] License changes (#3567)
* Adding explicit MPL license for sub-package.

This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository.

* Adding explicit MPL license for sub-package

This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository.

* Updating the license from MPL to Business Source License

Going forward, this project will be licensed under the Business Source License v1.1. Please see our blog post for more details at https://hashi.co/bsl-blog, FAQ at www.hashicorp.com/licensing-faq, and details of the license at www.hashicorp.com/bsl.

* Update copyright file headers to BUS-1.1

* Rerun make gen

This will pick up the last of the license changes

* Revert "Rerun make gen"

This reverts commit dbe0968bffd92745d8663c6940debae098395a6b.

* Remove copywrite from generation script

The current version of copywrite is not sophisticated enough
to only apply the copywrite changes to certain subdirectories,
so to avoid accidentally relicensing our api and sdk modules,
we will stop running the copywrite script until such time
that it can do the right thing.

* License protobuf API as MPL

The protobuf API files are used to generate the SDK,
since we want the SDK to be MPL, the protobuf files
must also be MPL. This extends to all protobuf files
whose sources end up in the SDK directory, including:

- internal/proto/controller/api
- internal/proto/controller/custom_options
- internal/proto/plugin

It also includes the generated service directory in
internal/gen/controller/api/services, since they are
generated from the protobuf sources used for the SDK.

* Change website license file name

This makes the naming scheme consistent with the rest
of the repository.

* Add note on licensing to README

* Set copywrite license to BUSL

* Revert "Add note on licensing to README"

This reverts commit 4d865a91a7a4f11605f0dc4609355d7e3c3cfffe.

---------

Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
Co-authored-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
2023-08-11 10:31:53 -07:00
Jeff Mitchell 8322916fb4 Remove all deprecated Err/Wrap/E calls (#3286) 2023-06-14 21:55:24 -04:00
Jeff Mitchell 929ede1c18 Modify some tests to expose error cases that weren't being exposed (#3302) 2023-06-09 11:13:15 -04:00
Louis Ruch 798a1f952a feat(storage): Add support for storage plugins 2023-05-31 12:18:12 +00:00
Louis Ruch 52fbc6410c feat(storage): Add interface, options and errors 2023-05-31 12:18:09 +00:00
Jeff Mitchell e8559d142a Fix worker auth rotation test (#3243)
Most of the changes here are changes or enhancements that are useful for
tests. The crux of the issue was that I had pulled up one var to the
package level so it could be read from tests, but that var was not being
reset between tests. It's not even used in tests anymore, so I put it
back to function-local.
2023-05-24 23:33:51 -04:00
Jeff Mitchell d5ad1f078a Fix test timing (#3241) 2023-05-24 15:37:22 -04:00
Jeff Mitchell 5716a30813 Update nodeenrollment to fix TLS issue; add debug (#3231)
* Add more logging to worker auth rotation and test flags

This makes it much easier to figure out when and why rotation is
happening and control it for tests/debugging.

* Update auth rotation logic

Because we were looking at validity period of client certs, which may
not have matched the actual rotation interval, it was possible (mostly
in test scenarios) for the rotation to happen multiple times on the
roots before we actually hit the worker rotation interval.

This changes how the interval is calculated by looking at the difference
between not-after values on the certs to understand the rotation
interval being used by the controller. We then use that as the starting
point for calculating a next-rotation time.
2023-05-19 17:18:26 -04:00
Jim a4f54cb98f refactor (events): QOL fix: turn off events for tests. (#3163) 2023-04-14 20:01:14 -04:00
Jeff MitchellandIrena Rindos bdf7bf7702 Do not allow PKI-KMS workers to have names updated via API (#3143)
Do not allow PKI-KMS workers to have names updated via API

This would cause their public IDs to change, which we do not want.

Descriptions are also disallowed, since those come from the config file.

This also adds logic to allow upgrading from old KMS method to new, with
a test.

Co-authored-by: Irena Rindos <irenarindos@users.noreply.github.com>
2023-04-03 17:44:41 -04:00
Jeff Mitchell 163ce184b8 KMS-PKI Workers (#3101)
This adds a new mechanism for worker authentication that uses the
third-party arbitration of the original KMS flow by leveraging
recently-added capabilities in nodeenrollment to support a registration
wrapper. This allows for workers to be registered to the system with
just a name and a matching wrapper, while at the same time allowing
these workers to be used for private Vault access and multi-hop as they
contain per-worker encryption keys and support rotation.

Nodes using this mode will generate and rotate credentials in-memory
(using another recently added nodeenrollment capability) so will have a
new set of keys on every startup. This has the side effect of ensuring
that there is never a conflict or re-use of these credentials.

Note that the normal test worker flow was using the now-deprecated KMS
method; there is still a test that uses this (explicitly) but all other
tests using test workers that did not specify a specific PKI flow now
actually use this mechanism. This means there is fairly decent test
coverage in a general sense, plus the specific tests updated/added for
this feature.

This also adds a new KMS type that can be used to have
distinct KMSes for upstream authentication vs. accepting from
downstream.
2023-03-30 16:20:28 -04:00
Johan Brandhorst-Satzkorn 3c29308673 chore: Add license headers to all files 2023-02-03 15:54:27 -08:00
Irena Rindos a403b3904c initial commit (#2735) 2023-01-09 12:35:13 -05:00
Irena Rindos 173e1587d0 Append initial worker upstreams if current upstreams are unresponsive (#2698)
* Append initial worker upstreams if current upstreams are unresponsive
2022-12-12 13:48:28 -05:00
Jeff MitchellandTodd 0c96c6ff6c Split grace period into multiple config values (#2578) (#2603)
Co-authored-by: Todd <github@quaddi.com>
2022-11-10 13:14:57 -05:00
Todd 2f68c604c5 Add test helper for creating a multihop worker setup (#2513)
* Add test helper for creating a multihop worker setup.
2022-10-03 13:35:35 -07:00
Jeff Mitchell 090b2b28f8 Clean up some dev config kms code (#2321)
* Clean up some dev config kms code

Although it didn't matter in the combined state, the KMS for auth
storage was not actually being set properly if only a worker was being
instantiated.
2022-08-05 12:12:07 -04:00
Jeff Mitchell 8800ec9c94 Reorganize logic to allow a poison pill (#2317) 2022-08-03 19:29:17 -04:00
Jeff Mitchell 4bd249d347 Fix some missing net.JoinHostPort calls (#2305) 2022-07-29 12:08:37 -04:00
Todd 155c5f578b Create session manager for workers to use to interact with sessions (#2235) 2022-07-06 13:37:49 -07:00
Jeff Mitchell 32d04b9ce7 Allow a worker to use KMS auth but accept PKI for proxy (#2206)
This essentially worked for non-dev mode before but would create storage
directories that weren't actually used or needed, and it didn't work in
dev mode because it made assumptions about the presence of a worker auth
kms or not. This fixes those behaviors.
2022-06-15 22:39:52 -04:00
Jeff Mitchell 9a4545e59e Fix eventing and worker name setup (#2204)
* Don't automatically create worker names, as this is now invalid for
  PKI workers
* Fix a check in dev that clears out name/description in exactly the
  wrong cases
* Change eventing setup to use a hostname-based ID instead of the name
  (which could change on every start anyways)
2022-06-15 20:01:03 -04:00
Haotian 40ba275759 feat(worker): add 'initial_upstreams' field to worker config to prepare to replace 'controllers' field. Update worker config description on website. 2022-06-13 15:45:03 -07:00
Jeff Mitchell d1b3b2441f Add node rotation (#2142) 2022-06-07 14:26:33 -04:00
Jeff Mitchell 4117841cf9 Use persistent storage for worker auth credentials (#2139) 2022-06-05 22:50:44 -04:00
Haotian 631c174f47 feat(worker): implements WorkerAuthStorage wrapper for worker credential encryption (#2076)
* Adds WorkerAuthStorage wrapper for worker credential encryption using nodeenrollment library.

* Adds AuthStoragePath field in worker config and dev mode to specify directory to store credentials.
2022-06-03 13:25:58 -07:00
HaotianandTodd 1830605a7e refact(servers) Update api for new worker and controller server tables (#2101)
* Discontinue support for old Server message in ServerCoordinationService. Split message into ServerWorkerStatus and UpstreamServer (which currently contains controller addresses). Remove unnecessary fields. Modify workerStatusServer to use new fields.

Co-authored-by: Todd <github@quaddi.com>
2022-06-03 11:59:02 -07:00
Todd 731a45eba6 Merge the worker_status table with the worker table (#2111) 2022-06-01 13:25:29 -07:00
Todd 472d7d520a Remove the server_id from session table, change it to worker_id on session_connection (#2070)
* Remove the server_id from session table, change it to worker_id on session_connection

This is step 1 in updating the worker table.  The worker is becoming a public resource so it must have
a public id.  We drop the server_id column on the session_connection table and add the worker_id column
so we can use the wt_public_key type.  Since db migrations are applied while the controller is offline,
it should be safe to assume all session connections are not in a running state, thus allowing us to null
out all the worker ids in the session_connection table.

For now we don't have very good enforcement of the wt_public_id constraints, since the id is currently
defined in the worker config, but this will soon change and the worker's id will be generated by the
controller.
2022-05-16 15:14:12 -07:00
Todd b58dada40d Move the server daemons into their own package (#2061)
* Move the server daemons into their own package

With this change the internal/server package now is dedicated to the server domain (workers and controllers) and not to the server daemons.
The hope is that this will make it easier to keep the daemons decoupled from the representation of the servers in the database.
2022-05-09 12:45:10 -07:00