Commit Graph
88 Commits
Author SHA1 Message Date
aditya2548 f8363dd06e [COMPLIANCE] Update Copyright & License Headers 2026-04-06 15:48:57 +05:30
Emilia 66a0e08112 fix(clientcache): sort target names case insensitively (#6428)
* change targets sorted by name to sort case insensitive

* remove print

* switch to collate
2026-02-16 12:17:47 -05:00
Sepehr 8201630b12 feat(clientcache): Implement session sorting in repository (#6348, #6378) 2026-02-03 09:18:16 -08:00
Emilia GrantandSepehr 7f1a993122 feat(clientcache): Add sort parameters to CLI search command (#6362, #6366)
Co-authored-by: Sepehr <sepehr.foroughishafiei@hashicorp.com>
2026-02-03 09:18:16 -08:00
Emilia Grant 4c49331753 feat(clientcache): Implement sorting in targets repository (#6346) 2026-02-03 09:18:16 -08:00
Sepehr 2e9623d462 feat(clientcache): Extend SearchParams and Options with sort support and validation (#6342) 2026-02-03 09:18:16 -08:00
Emilia Grant 614abbe6e8 feat(clientcache): Add sort parameter parsing and validation in daemon handler (#6338) 2026-02-03 09:18:16 -08:00
Emilia GrantandSepehr 11f9a9aac0 feat(clientcache): Define sort types and constants (#6331)
Co-authored-by: Sepehr <sepehr.foroughishafiei@hashicorp.com>
2026-02-03 09:18:16 -08:00
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
Irena Rindos f7c55678e0 chore: remove more dead code (#5640) 2025-04-02 15:09:17 -04:00
Damian Debkowski 1820d43d38 fix(daemon): set correct permissions on cache.db file (#5613) 2025-03-18 12:29:26 -07:00
Johan Brandhorst-SatzkornandMichael Li 262693f47c Restore soft deleted users on authentication (#5549)
* internal/clientcache: restore user on login

A user that previously had its last auth token deleted
(for example, if they logged out), should be restored
again when they successfully authenticate again.

* internal/clientcache: delete keyringless expired auth tokens

Previously, we would only correctly delete auth tokens
that were expired (or deleted) if they were also in the
keyring.

* internal/clientcache: remove tautological condition

At this stage we already know that at is non-nil, because
the case above would have been true if it was nil.

* internal/clientcache: improve error handling

The previous error handling would have ignored API errors that were not ErrUnauthorized or ErrNotFound.
Handle all API errors the same as other unexpected errors.

* internal/clientcache: make errors distinct

These two error conditions are otherwise impossible
to tell apart.

* test(e2e): Update search test to catch bug (#5551)

---------

Co-authored-by: Michael Li <michael.li@hashicorp.com>
2025-02-24 09:16:07 -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
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
Jim ffd0d2a7d3 feat (cache): impl. soft-delete of users in cache (#5173) 2024-10-18 10:33:29 -04:00
Johan Brandhorst-Satzkorn ab922b5786 internal/clientcache/cmd/cache: restart cache on version mismatch (#5165)
Restart the client cache if it is found to be a version below the
version of the CLI during client cache hook execution.
2024-10-09 14:26:33 -04:00
Timothy Messier 632d048f7b lint: Fix linter errors
(cherry picked from commit 51a2b2035f9c6bb51fe8f5f1defeeb514183fecd)
2024-09-24 14:18:54 +00:00
Irena Rindos 2945692bf4 Client cache API paging (#5107)
* internal/clientcache: add -force-reset-schema flag

* clientcache: stream list pages directly to DB

---------

Co-authored-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
(cherry picked from commit ccea8a4ce53f7b0d1105c1c1e4875e443635d96a)
2024-09-24 14:18:53 +00:00
Jeff Mitchell 3a4ee032d9 Paginate targets in cache (#5101)
* Update Go API to support pagination
* Implement pagination of targets in cache

(cherry picked from commit cd25fad42f325fc050b7ea3bec3336780d2b5e16)
2024-09-24 14:18:53 +00:00
Jim 2a87dcad48 fix (cache/db): add indexes for desktop queries (#5091)
(cherry picked from commit bfdbae1f042c4eb1b05e0373e1aaf2db55c9bb3b)
2024-09-24 14:18:53 +00:00
Jim 85afd56266 fix (cache): support for DB debug logging (#5087)
(cherry picked from commit a7fe48b8d827d1bf68ff8eea205428dd5faae381)
2024-09-24 14:18:53 +00:00
Jim 863359aa26 test (cache/search): fix NewTestServer(...) storage (#5081)
Fix ensures that the TestServer returned uses the
correct directory for writing its sqlite files,
which was created via t.TempDir()

(cherry picked from commit 85f91043a164bdacc1c6738ae0e7c50077d55c79)
2024-09-24 14:18:53 +00:00
Jeff Mitchell 829ea02e6f Ensure only one refresh is running for a user/resource at a time (#5054)
This ensures we don't have competing update processes running. When doing the
inline RefreshForSearch, a specific error will be returned so we can hint in
the API that we're in the middle of a refresh.

(cherry picked from commit 54776091e32af2f2f110f2bf10d0617bd5677aba)
2024-09-24 14:18:53 +00:00
Jeff Mitchell b04de5ac4b Add implicit-scopes resource type to cache (#5053)
This allows getting a list of scope IDs known by the cache via cached
targets and sessions. It is not refreshed from the controller. The name
contains `implicit` in case we ever want e.g. `scopes`.

(cherry picked from commit c0a318c58367d8ec55365447f41cf007eab64ce3)
2024-09-24 14:18:53 +00:00
Jim 4d8a7dd39a feat (clientcache): use a persistent cache (#5051)
By default, we will use a persistent cache for the
client cache. This will allow us to keep the cache
across restarts of the server and it will also
reduce the amount of time it takes to start the
server while reducing the amount of memory used.

This change also includes a validation of the cache
schema version. If the schema version is different
from the one expected, the cache will be
reset/recreated.

(cherry picked from commit cf8a51f3834033b7f986a9a7e091ab31c4328415)
2024-09-24 14:18:53 +00:00
Jeff Mitchell 384fc332be Restrict cache results to 250 entries by default (#5049)
A query parameter `max_result_set_size` can be specified to set a
per-request limit, with `-1` meaning all values. If there were more
entries than the max size used for the request, an `incomplete` boolean
is set in the response.

(cherry picked from commit 3cdd07889be5e4e6f21d044cb60fad1face4be08)
2024-09-24 14:18:53 +00:00
Damian Debkowski 9576ed40dc test: improve test to ensure ipv6 compatability (#5113) 2024-09-19 08:55:27 -07:00
Jeff Mitchell b120a03f43 Fix tests (#5114) 2024-09-18 11:09:15 -04:00
Jim 28b465e4b8 refact: to use go-dbw CreateItems, DeleteItems (#4974)
* refact: to use go-dbw CreateItems, DeleteItems

Latest version of go-dbw updated the signature of
CreateItems(...) and DeleteItems(...) on a happy
note this latest version of go-dbw actually does
batch inserts and updates for this functions.

* all: regenerate protos with new protoc-gen-go version
2024-08-01 11:18:53 -04: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 c3f9fde5d7 Wait to select tokens until we know we need to (#4794)
AuthToken selection involves checking to seeing if the one we are picking has been canceled or expired on the boundary controller. If we are only searching locally and not performing a refresh, there is no need to check if the tokens have expired or not.
2024-05-10 09:38:30 -07:00
Todd 7ccc099807 Use the default retry limit across client cache (#4727) 2024-04-25 15:18:23 -07:00
Todd 55cf055285 Fix build and test breakage. (#4659) 2024-04-17 14:02:31 -07:00
Todd adea8e0f14 Change aliases to resolvable aliases in client cache (#4656) 2024-04-17 12:37:42 -07: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 13d07e51fd Don't log resource staleness when no refresh token is recorded (#4503) 2024-03-08 15:48:18 -08:00
Todd d5ae3d8dc6 fixup! Add aliases to the client cache daemon and make them searchable (#4418) 2024-02-29 15:52:27 -08:00
Todd a2ea1f8f90 Add aliases to the client cache daemon and make them searchable (#4418)
* Add aliases to the client cache daemon and make them searchable
2024-02-29 15:52:27 -08:00
Todd 366d9e95aa Add Error logging and hclog.Logger debug logging throughout the daemon (#4384) (#4439)
* Save and assign hclogger throughout the client cache daemon

* Don't event for errors happening outside of the handlers or tickers.

* Hide and ignore -store-debug and expose the -log-level flag
2024-02-22 10:20:48 -08:00
Jeff MitchellandDamian Debkowski 014a5a7aae Vet/race fixes (#4421)
This addresses all found vet/race fixes in community edition.

---------

Co-authored-by: Damian Debkowski <damian.debkowski@hashicorp.com>
2024-02-21 16:32:26 -05: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
ToddandJim eb6d0dbd6a Use the intercepted token always. If the keyring matches, use it from there (#4355)
* Use the intercepted token if present, use it through the keyring if keyring contains it

* fixup! Use the intercepted token if present, use it through the keyring if keyring contains it

* Apply suggestions from code review

Co-authored-by: Jim <jlambert@hashicorp.com>

---------

Co-authored-by: Jim <jlambert@hashicorp.com>
2024-02-06 11:46:28 -08:00
Todd acabfd7f2c boundary daemon add-token to return returns 403 Forbidden when Boundary returns the same (#4345) 2024-02-02 12:24:14 -08:00
ToddandJohan Brandhorst-Satzkorn d6c9db968a Fix calculating uptime after system sleep (#4332)
* Fix calculating uptime after system sleep

* Update internal/clientcache/internal/daemon/status_handler.go

Co-authored-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>

---------

Co-authored-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
2024-01-31 12:31:43 -08:00
Todd 7e7e6369ae pass on the max search refresh timeout to server (#4321) 2024-01-29 15:38:45 -08:00
Todd 0705ed4e68 Do not try to autodiscover tokens when doing token lookups using provided tokens. (#4316) 2024-01-29 10:23:23 -08:00
dde833e8cf Decrease number of flags shown for daemon/search (#4312)
* Decrease number of flags shown for daemon/search
* Update changelog
---------

Co-authored-by: Jeff Mitchell <jeffrey.mitchell@gmail.com>
Co-authored-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
2024-01-26 15:56:41 -08:00
Todd b734c43cda return error when creating table fails (#4305) 2024-01-26 10:46:29 -08:00
Todd e32a25f2a4 No longer enforce version matching between daemon and cli (#4271)
* No longer check version matching between daemon and cli

* Add Log Service Handler and report if the daemon is running in background mode
2024-01-24 16:26:15 -08:00
Todd d0eb670dcf s/Full Fetch/Recheck Support/ in logs and expose filter query param to search command (#4269)
* s/Full Fetch/Recheck Support/  and expose filter query param to command
2024-01-22 17:39:52 -08:00