Commit Graph
727 Commits
Author SHA1 Message Date
Johan Brandhorst-Satzkorn 5de0c8c102 internal: ensure schema manager is closed (#5521)
This releases the connection it holds indefinitely
2025-02-06 13:49:49 -08:00
Johan Brandhorst-Satzkorn 40cb9f5c9e Restrict concurrent password hashes (#5437)
* internal/auth/password: add resizable pool

The resizable pool wraps the permit pool with a mutex
to allow it to be resized at runtime.

* internal/auth/password: add concurrency limit

The default concurrency limit is 1, and it can be
set using the SetHashingPermits function.

* internal/cmd/config: allow configuring hashing limits

The new concurrent_password_hash_workers configuration
value can be used to loosen the constraints on the
userpass auth method hashing operation.

* internal/cmd: set password hashing constraints

Sets the password hashing concurrency constraints on
startup and config reload.

* CHANGELOG: add notice about password concurrency limit
2025-01-22 13:31:42 -08: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
Hugo 346ac58fa3 feat(cmd): Default to azure plugin when performing db migration (#5422) 2025-01-08 17:25:13 +00:00
846c849589 Worker Domain Refactor (#5338)
* feat(server): Refactor LookupWorkerByName to be a test method

* feat(server): Split worker tags table

* refact(worker): Export api and config tags

* refact(server): Return worker id from UpsertWorkerStatus

* refact(server): Create ListWorkerStorageBucketUpdates domain function

* refact(server): Use dedicated HCPb-worker list func

* refact(server): Create ConnectionRoute domain function

* refact(handlers): Move worker selection logic to internal/server package

This commit moves all the logic to select a worker to handle a session
to the internal/server package. Most functions were moved to this
package with no changes, however, there are a couple of notable
exceptions:

- Given that we don't use GRPC errors in repos, all errors were adjusted
  to use the internal/errors package instead.
- StorageBucketFilterCredIdFn is now used to prevent the internal/server
  package from importing internal/storage/plugin, which would cause a
  dep cycle. Callers of SelectSessionWorkers must implement this func
  which is responsible for returning a storage bucket's worker filter as
  well as its associated credential id.
- authorizeSessionWithWorkerFilter now receives an
  internal/server.(*Repository) object when called. This is transparent
  to SelectSessionWorkers callers as it is handled internally.

* feat(server): Add FilteredWithFeatures fn and new server options

* refact(server): create new list and lookup worker queries

* test(server): Add WorkerList unit tests

* feat(server): Implement WorkerList randomness using crypto/rand pkg

* chore(db): add index to server_worker table

* refact(server): prefix test method with Test

* refact(server): rename Downstreamers interface to Graph

* chore(server): unexport and rename method

* chore: add doc string to WorkerAddress (#5420)

---------

Co-authored-by: Irena Rindos <irenarindos@users.noreply.github.com>
Co-authored-by: irenarindos <irena.rindos@gmail.com>
2025-01-08 15:18:03 +00:00
Johan Brandhorst-Satzkorn 1a6320794e cmd: propagate keyring reading errors (#5360)
Reading a token from the keyring can sometimes fail for reasons
other than the token not being present in the keyring. This PR
introduces a new error used to indicate that the token requested
could not be found in the keyring and propagates errors from the
keyring up to the caller, so that the caller can act on them.

Additionally, this fixes a bug in the client cache where it would
incorrectly assume that a token had been removed from the
keyring, when in fact there was an error reading from the keyring.
2024-12-23 09:21:18 -08:00
Johan Brandhorst-Satzkorn 10370edf59 internal/commands/server: prevent test panic on timeout (#5249)
Previously, if one of these tests failed to start their servers before
the timeout, there was a risk that the goroutine started to run
the server would invoke t.Errorf after the test itself had concluded.
Replace t.Errorf with fmt.Printf to avoid the panic, and include
the test name for debugging.
2024-11-22 09:57:41 -08:00
Elim Tsiagbey 514bcc19f6 feat(gcp): add GCP plugin (#5229)
Add GCP as a supported plugin for dynamic host catalogs
2024-11-08 11:09:29 -05: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
Hugo ee9f9fb4a1 feat(worker): Support running AWS host plugin 2024-09-30 21:24:18 +01:00
Hugo c3d03f69d8 feat(cmd): Support plugin host catalog worker filter 2024-09-30 21:24:18 +01:00
Jeff Mitchell 62d4f8453b Don't explode grants from the DB (#5104)
This removes the Cartesian product in the DB for GrantsForUser in favor
of returning the actual grant scope information and dealing with it in
application code.

(cherry picked from commit 913cd536823d73994acc4f4d833208c1cc05f91b)
2024-09-24 14:18:53 +00:00
Irena Rindos 35679c6a5b chore(config): remove deprecated controllers field (#5125)
* chore(config): remove deprecated controllers field
2024-09-23 11:45:34 -04:00
Damian Debkowski 79bf12bd23 fix(cmd): resolve make gen issue (#5124) 2024-09-20 13:29:26 -07:00
Damian Debkowski 29efd5e6c6 test: ensure ipv6 compatability (#5110) 2024-09-20 11:30:27 -07:00
Irena Rindos eb33649ded (clientagentcmd): plumb thru env var (#5123)
* (clientagentcmd): plumb thru env var
2024-09-20 12:33:48 -04:00
Ryan Derr 913e6d755f ICU-11661 Add scope name in options slice for authorized-sessions (#5108) 2024-09-13 15:09:38 -05:00
Irena Rindos 83b61275d5 (cmd): unhide client agent commands (#5097) 2024-09-11 11:20:18 -04:00
Jeff Mitchell 66af7dba98 Allow reloading some server timings (#5071)
Allows changing grace period and a few other things timing-related via
HUP instead of just a restart.

Tested manually via config changes and HUP.
2024-09-04 15:40:44 -04:00
Hugo 1c62470ba6 chore(cmd): Move FlagClientAgentPort and flagTargetDefaultPort to uint16 2024-08-21 13:55:58 +01:00
Hugo 3e3f2153c0 feat(cmd): New Uint16 flag type 2024-08-21 13:55:58 +01:00
Hugo bf9dbd818e chore(cmd): Remove IntVar and move to Int64Var 2024-08-21 13:55:58 +01:00
Hugo 3195dcba4e chore(cmd): Remove UintVar and move to Uint64Var 2024-08-21 13:55:58 +01:00
Sorawis Nilparuk (Bo) 350ac90a57 implement configurable getDownstreamWorker timeout (#5007)
* implement configurable getDownstreamWorker timeout

* add parsing test

* typos

* fix tests

* fix worker tests

* 0 is a valid value
2024-08-13 14:27:39 -07:00
Damian Debkowski 4131c4b324 feat(cmd): display remote storage states for workers 2024-07-17 14:23:11 -04:00
Johan Brandhorst-SatzkornandJeff Mitchell c6f3c375f3 api: remove deprecated grant_scope_id field (#4886)
* api: remove deprecated grant_scope_id field

The grant_scope_id field was deprecated in 0.15.0, so we can remove
it for 0.17.0.

* Fix tests

* Fix more tests

* Remove an option and some related code that stuck around

* Fix bats tests

---------

Co-authored-by: Jeff Mitchell <jeffrey.mitchell@gmail.com>
2024-06-17 12:09:33 -07:00
Jeff Mitchell d547e0d459 Add test ability to reinitialize worker auth roots on startup (#4895) 2024-06-17 12:26:55 -04:00
Johan Brandhorst-Satzkorn ec289420d3 clientagentcmd: use "localhost" to call client agent (#4816)
The client agent serves on "localhost:9300" by default. It appears
on some systems this resolves to ::1:9300 and on some systems
127.0.0.1:9300. We should use the same address on the client
as the server to avoid any incompatibilities between systems.
2024-05-22 14:17:30 -07:00
Johan Brandhorst-Satzkorn a1391db090 internal/cmd: rename ferry files to client_agent (#4815)
This was missed in the big rename PR
2024-05-22 13:49:06 -07:00
Johan Brandhorst-SatzkornandRobin Beck e64443c66f Rename daemon CLI command to cache (#4808)
* internal/cmd/wrapper: add deprecation wrapper

The deprecation wrapper can be used to display a warning to callers
when a command is deprecated.

* all: rename daemon to cache

Rename the boundary daemon command to boundary cache. This
avoids confusion with future client/daemons.

* changes daemon to cache in nav

---------

Co-authored-by: Robin Beck <stellarsquall@protonmail.ch>
2024-05-22 11:11:48 -07:00
Todd 6936a5448c update status cli to optionally return some fields (#4810) 2024-05-22 09:51:58 -07:00
Johan Brandhorst-Satzkorn 8ff18f6c3c internal/cmd: rename ferry to client-agent
Renames the ferry command and related flags and env vars to
client-agent following the new naming decision.
2024-05-22 09:51:58 -07:00
Hugo 2983f80eaa fix(cmd): Support account attribute maps 2024-05-20 16:06:35 +01:00
Johan Brandhorst-Satzkorn 111b8fbecf internal/cmd/ferry: add sessions command (#4800) 2024-05-15 13:10:18 -07:00
Irena Rindos 6f09819e9f chore: fix workers tag cmd help strings (#4780) 2024-05-08 11:52:16 -04:00
Michael Milton f7e59d5d04 Add hidden ferry pause and resume commands (#4771)
* Add hidden ferry pause and resume functions

* add check for 200 status

* include pause/resume status in ferry status, fix output

* put error string back to previous state
2024-05-06 17:54:27 -04:00
Kerim Satirli e54519975b adds missing space in mlock warning (#4286) 2024-05-02 17:36:45 -04:00
Todd 3cae272c27 Hide ferry specific flags (#4737) 2024-04-26 13:48:56 -07:00
Todd 0d67b86543 Add ListResolvableAliases to the user service (#4609)
* Add ListResolvableAliases to the user service

There are a few non common ways this method uses our ACL
and grant system. A user is able to list resolvable
aliases for another user if they are granted permission
to do so. That means we had to load the grants for
the user being listed for and not the requester when
determining if an alias is able to resolve to a destination
for which the requested user has permission.

Similarly, the grant hash used for the list pagination
is required to be that of the user being listed and not
the requester.
2024-04-17 08:26:46 -07:00
dani 1a77e4da86 Boundary Plugin MinIO (#4621)
feat(storage): Add storage support for MinIO via new built-in plugin
2024-04-12 11:28:40 -04:00
Elim Tsiagbey 2c140b1e09 feat: Local Storage State API & CLI
- add `local_storage_state` value to API & CLI
2024-04-05 16:47:22 -04:00
Damian Debkowski aea473c77b feat: new worker config for minimumAvailableCapacity 2024-04-05 16:45:52 -04:00
Jeff Mitchell d396a33930 Fix controller-only in dev not showing events (#4594) 2024-04-03 20:56:51 -04:00
Jeff Mitchell 446b790f02 Make WrappableCommand input be a func (#4590)
When wrapper.Wrap was put into place, the argument going into it was no
longer part of a closure but was instead evaluated at function call
time. As a result this would create 197 extra goroutines and
channels on startup - one for each command using wrapper.Wrap. Among
other things this made stack traces much more difficult to parse.
2024-04-03 20:43:20 -04:00
Todd 95c507fad5 Add hidden ferry commands and auto adding tokens to ferry daemon (#4572)
* Add boundary ferry command (#4462)

* Add boundary ferry status (#4463)

* Add sending auth token automatically to ferry daemon (#4465)

* Hide ferry cmds, background error msgs, and dont retry background add-token requests (#4571)
2024-03-25 15:04:13 -07:00
Todd cb1e9b570b Add CLI flags for creating an alias with a target (#4512)
* Add CLI flags for creating an alias with a target

* Add bats tests
2024-03-15 09:36:34 -07:00
Jeff Mitchell 7105270cd5 Make TestServer_ReloadWorkerTags non-parallel
This will hopefully help with flakiness.

Note: this was tested on the Ent side
2024-03-14 14:25:17 -04:00
Jeff Mitchell 19b19d6756 Comment out parallel statements causing test failures (#4528)
It hasn't been investigated why this is happening (getting a number of
403 errors) but for now removing parallel fixes it.
2024-03-13 21:12:26 -04:00
Jeff Mitchell 9408b2b299 Add some more fixes caught by race detector (#4488) 2024-03-07 14:46:10 -05:00
Irena Rindos 5a93a7e9a2 chore(cmd): fix initial alias doc (#4484) 2024-03-05 17:49:27 -05:00