Commit Graph
2179 Commits
Author SHA1 Message Date
Todd 8974606dea Remove auth token when it is not found (#4050) 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 f6b9162953 consistently expect snake case json values in token handler (#4015) 2024-01-05 07:43:20 -08:00
Todd a077be691c Add scope id and target id as searchable fields (#4012) 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 b2fec2e4f0 Store and use refresh tokens in the client cache (#3857)
* Refresh resources using 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
Michael Milton 6ba3676c37 Auth token pagination (#4113)
* Add pagination support for auth tokens

* change analyze count estimate comment

* adjust queries for efficiency and security

* even more efficient queries
2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn 48e8d454a4 internal/credential: use correct resource in tests (#4128) 2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn 6b03363eb8 internal/handlers: add credential library pagination 2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn c6e80dbe32 internal/credential: add library pagination logic 2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn 1337a57674 internal/credential/vault: add pagination logic 2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn fcb47f3772 internal/db: add cred library pagination schema changes 2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn a9e0d6693d internal/credential/static: simplify list parsing (#4112)
Using a struct for the list parsing simplifies the
logic and makes the mapping between the result and
the Go type safer.
2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn 6b2f5fe29f internal/credential: fix comment (#4106) 2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn 9f6ac602ee internal/handlers: add credential pagination support 2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn fa898fe87b internal/credential: add pagination service functions
The new service functions are used for various stages of pagination.
2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn e0092999de internal/credential/static: add pagination support
Refactors ListCredentials and adds the new ListCredentialsRefresh
method to the Repository, supporting pagination
of credentials. Also adds the EstimateCount and
ListDeletedCredentialIds methods used during
pagination.
2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn 497c158b9d internal/db: add migration for static credential table
The static credential table is used rather than the credential
table as all credentials returned by ListCredentials are static
at this time.
2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn a470f4c0c3 internal/credential: add pagination options
The new options are used in future commits for paginating list results.
2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn 71b21c5f39 internal/target: fix sql query nits (#4102)
Consistently use "final" for the final CTE, and put
"and"s on the line before.
2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn 37d4f0e373 internal/target: correct comment (#4091) 2024-01-05 07:43:20 -08:00
Michael Milton 9c3eb16046 Sessions list pagination (#4079)
* Session list pagination refactor

* address pr comments, add explanatory comments, clean up sql queries, move tests into proper files

* fix build error

* fix test error
2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn 575e9641f8 Some pagination tweaks (#4074)
* internal/target: fix some target tests

We had dupes and missing test cases, this fixes them.

* internal/handlers: move listtoken parsing into helper

This significantly simplifies the parsing logic needed in each handler.
2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn acc048a1d1 internal/genapi: correct list response body and map
When using the new auto-pagination logic, we would previously return
the Body and Map of the last response, instead of one corresponding
to the returned result. Correct this by overwriting the Body and Map
after pagination has finished.
2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn af61b688c6 internal/listtoken: remove overzealous validation
Validating that the update time of the last item is after the
create time of the token cannot account for items whose
update time are earlier than the original query because of
the added database transaction timeout buffer. Remove the
check.
2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn 6181f34497 internal/db: move new migrations to new folder 2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn 3b54611d14 api: update api listing
Change from refresh token to list token
2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn 00c4f825c7 handlers/targets: refactor for new pagination design
Refactor the application layer to use the new domain layer
pagination functionality.
2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn eca27b00c9 internal/proto: rename refresh token to list token 2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn e2fd8f9701 internal/proto: refactor list proto definitions
This aligns it more with the new domain use.
2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn f062a8cd75 internal/handlers: add list token helpers
Mostly a rename from refresh token, but also a new helper
for assembling the final list token.
2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn d4d856e712 internal/target: refactor for new pagination design
The new design uses four separate service functions; List,
ListPage, ListRefresh and ListRefreshPage. The first two are
used during the initial pagination phase and the latter two
are used for any subsequent refresh phases.
2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn f0f7e635a0 internal/db: add target schema for pagination design
The new design uses the base table for querying, so the base
table needs to have both create_time and update_time. In this
commit we add the update_time to the target base table. We
also add a number of new indexes to help with looking up targets.
2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn 0657276a0e pagination: refactor for new pagination design
The new design defines 4 distinct functions, List, ListPage, ListRefresh
and ListRefreshPage. The first two are used during the initial
pagination, and the other two are used during refreshing.
2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn 3019038eab refreshtoken: move package to listtoken
The listtoken package encapsulates the logic used for all
types of pagination and refreshing across all list endpoints.
2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn 4e368f154f internal/tests: add target pagination test 2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn 5984f5bba6 handlers/targets: add pagination support 2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn ef3bdfd5eb api: add automatic list pagination
Updates all List endpoints to automatically paginate
through results to preserve backwards compatibility.
Adding support for user controllable pagination could
be considered at a later time.
2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn 9ce5a14ef0 config: add max_page_size variable
The max_page_size variable lets operators control the size of the
pagination pages. This value configures both the maximum permitted
page size and the default page size when none is explicitly provided.

Operators can tweak this option up or down to increase or reduce
the load on the database during pagination.
2024-01-05 07:43:20 -08:00
5bfc8a88b1 Add indexes on update_time (#3974)
* Add indexes on update_time

Co-authored-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Co-authored-by: Michael Gaffney <mike@gaffney.cc>
2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn 43cff11865 internal/db: renumber migration 2024-01-05 07:43:20 -08:00
Johan Brandhorst-Satzkorn 605e44e7ac target: add pagination support
Adds pagination support to the target domain
2024-01-05 07:43:20 -08:00