Commit Graph
43 Commits
Author SHA1 Message Date
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 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
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 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
Jeff Mitchell b120a03f43 Fix tests (#5114) 2024-09-18 11:09:15 -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 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 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 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 7e7e6369ae pass on the max search refresh timeout to server (#4321) 2024-01-29 15:38:45 -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 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
Todd 0dac9005c1 Boundary auth without a keyring configured behaves like -keyring-type none (#4268) 2024-01-22 16:40:23 -08:00
Todd 30066c06f5 Add log location to the status output (#4260) 2024-01-22 08:42:19 -08:00
Todd b8f4e16ecf Fix flaky log rotation test (#4257)
* Fix flaky log rotation test
2024-01-18 14:44:53 -08:00
Todd 884a0cb1fc Fix daemon synopsis and command grouping (#4249) 2024-01-18 09:54:21 -08:00
Louis Ruch 957cd59d91 test(e2e): Update e2e timeout (#4241) 2024-01-17 09:45:34 -08:00
Todd fa2dc80e36 Close the logfile at test cleanup (#4224) 2024-01-08 10:20:43 -08:00
Johan Brandhorst-Satzkorn 1303f7c363 Fix linter warnings (#4219) 2024-01-05 07:43:22 -08:00
Todd c94a933578 Manually build the socket url (#4205) 2024-01-05 07:43:21 -08:00
Todd e429e91bc4 Do not cache or allow searching for old controllers (#4136)
* Do not cache or allow searching for old controllers

* Identify resourceless responses as coming from supported or unsupported controllers

* Do not report refresh token status info for unsupported controllers
2024-01-05 07:43:21 -08:00
Todd d453a2a48a Check in client wrapper if cache daemon is already in use (#4172) 2024-01-05 07:43:21 -08:00
Todd 6f488d7c59 Evanulate if cache daemon should be skipped after the flags are parsed (#4168) 2024-01-05 07:43:21 -08:00
Todd c74579cead Allow forced refresh attempt when searching (#4077)
* Allow forced refresh attempt when searching
2024-01-05 07:43:20 -08:00
Todd cdc6fb0973 Refresh specific resources before searching when they are stale (#4046)
validate versions for all handlers. Refresh specific user before searching

Pass flags on to the background process

Allow the search refresh timeout to be configured
2024-01-05 07:43:20 -08:00
Todd 9aab26e91b clientcache commands now can output curl strings (#4042) 2024-01-05 07:43:20 -08:00
Todd b71d134e06 Create Client and update Errors for client daemon commands (#4011)
* Create a client cache daemon client

* Fix error formatting for the client cache cmds
2024-01-05 07:43:20 -08:00
Todd 8af20349e7 update mql and clean search flags (#4030) 2024-01-05 07:43:20 -08:00
Todd 9448fc931e Search uses base.Client's token to perform the search (#4006) 2024-01-05 07:43:20 -08:00
Todd ab4ab0e8f9 Handle log rotation (#3948)
* Handle log rotation
2024-01-05 07:43:20 -08:00
Todd 71b09222ae Add status command to the boundary client cache (#3871)
* Add status command to the boundary client cache
2024-01-05 07:43:20 -08:00
Todd 3a7ea64a31 Add skip daemon flag and send recently authed tokens to daemon (#3883)
* Add skip daemon flag and send recently authed tokens to daemon

* Rename flag skip-daemon to skip-cache-daemon

* adding option test

* move common.Options to base.Option

* SocketAddress returns *url.URL, fix search test
2024-01-05 07:43:20 -08:00
Todd 2f7459fa40 Add FullFetch to resource updating ticker (#3947)
* Add full fetch for controllers w/o refresh tokens
2024-01-05 07:43:20 -08:00
Todd 5daef58f54 SQLite allows having 1 set to MaxOpenConnections (#3941)
* let sqlite have a single concurrent connection
2024-01-05 07:43:20 -08:00
Jim fba9d1cdf1 Add client daemon repo, server, and cmd
The commands added are:
boundary daemon start
boundary daemon stop
boundary daemon add-token
boundary daemon status
boundary search

If these actions are performed on a platform that doesn't support sqlite
natively in go an error is returned.

Besides some hooks into the cmd package all the significant logic
resides in internal/clientcache

feat (cmds/authenticate): output the token name when storing token

feat: update go-dbw which now uses pure go sqlite driver

refact (base.Command): export FlagOutputCurlString

Exporting FlagOutputCurlString allows other commands that embed
the base.Command to access the flag as needed

feat: add a cache Repository to manage cache storage

feat: add a "cache" CLI command

This new command will support both managing and searching the
local CLI cache daemon.

feat: start cache daemon as needed when issue CLI commands

Move files to new directories and add persona table (#3526)

* Add persona table and move files to new directories

Client daemon now uses unix sockets and update pathing (#3535)

* Add unix socket listen and dialers with file permissions applied

* Update the pathing to match RFC

Cache refreshing now uses all stored personas. (#3545)

Updating headers for LLB files

Decouple daemon and cache server (#3566)

* Separate daemon from server

* Add persona handler to daemon server (#3579)

Moved search to use mql and added tests for the search command (#3589)

* search uses hashicorp/mql

Windows support for client side daemon (#3618)

* exec.Command for background process

* Log to stderr when in foreground and file always

* Use pid files across platform for start and stop

Requests with version info must match the daemon's version (#3640)

* requests with version info must match daemons

Update dependencies and breakout cgo/pure go sqlite drivers  (#3657)

upgrade go-dbw deps and add cgo build tags

Enable graceful shutdown in windows (#3695)

* Enable graceful shutdown in windows

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

Targets delete when a persona changes address or user id (#3673)

* Handle cache refresh in repo

Add sessions to the client side cache (#3682)

* Add sessions to repository

* Search command supports sessions

* adding session related tests to db and refresh

Change cache schema from personas to tokens+users (#3737)

* Change from personas to tokens+users

* Separate keyring tokens from auth tokens

Add support for keyringless auth tokens (#3765)

* Add support for keyringless auth tokens

Remove expired auth tokens from cache (#3768)

* Remove expired auth tokens from cache

Complete the TODO of checking for inflight tx (#3779)

Delete tokens that the controller says are invalid (#3782)

fix search test with boundary token check (#3799)

Collect resource info in repository_<resource>s.go (#3769)

* Collect resource info in repository_<resource>s.go

* Move search logic into the domain (#3794)

Daemon and search restricted to supported platforms (#3801)

* Daemon and search restricted to supported platforms

Reorganize the clientcache packages (#3814)

* Refactor for self contained domain logic

* Put clientcache stuff under internal
2024-01-05 07:43:20 -08:00