Commit Graph
1960 Commits
Author SHA1 Message Date
irenarindos 0ef523ba77 Remove column cascade 2022-05-11 12:38:19 -04:00
Todd b83f4ece39 Manual merge of main into llb-byow. 2022-05-09 14:45:30 -07:00
Todd d8a443e238 Merge branch 'main' into llb-byow
# Conflicts:
#	internal/daemon/controller/handlers/targets/target_service.go
#	internal/daemon/controller/handlers/workers/multihop_service.go
#	internal/daemon/controller/handlers/workers/worker_proxy_service.go
#	internal/daemon/controller/handlers/workers/worker_service.go
#	internal/daemon/worker/status.go
#	internal/daemon/worker/worker.go
2022-05-09 14:14:52 -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
Jeff Mitchell 2a8e179692 Update against changes from merge 2022-05-09 14:39:15 -04:00
Jeff Mitchell ab4d542fad Add multihop auth support (#32) 2022-05-09 13:50:53 -04:00
irenarindos 8579a248d4 refactor(servers): minor sql adjustments to worker and controller tables 2022-05-09 13:30:05 -04:00
irenarindos 9e27605213 refact(servers): Split server table into worker and controller 2022-05-09 13:30:01 -04:00
Jeff Mitchell f748af7b02 Initial BYOW auth PoC (#29) 2022-05-09 13:28:17 -04:00
Johan Brandhorst-Satzkorn 8ed560fc3e Add memory profile build target (#1960)
* fix(cmd): Add profiling build imports

It seems like this file has been bitrotted since last used,
and it was missing some imports. This was discovered
by running goimports on the code.

* Add build-memprof Makefile target
2022-05-09 10:16:10 -04:00
Todd 687dd1bda6 Move the session cleanup job logic into the session package. (#2060)
* Move the session cleanup job logic into the session package.

This is part of a broader effort to more narrowly define the purpose of the internal/server directory to be for interacting with servers themselves.  Future changes will continue to remove things from this directory until the purpose of the directory is clearly working primarily with the boundary servers resource.
2022-05-05 10:29:30 -07:00
Johan Brandhorst-Satzkorn 780d913596 chore: Add .git-blame-ignore-revs (#2059)
This lets us ignore large changes in blame. Use it
to ignore the Protobuf file formatter commit.

See https://docs.github.com/en/repositories/working-with-files/using-files/viewing-a-file#ignore-commits-in-the-blame-view
for more information.
2022-05-04 12:14:07 -04:00
Jeff Mitchell 957fe19846 Bump to Go 1.18 (#2036) 2022-05-04 12:14:00 -04:00
Johan Brandhorst-Satzkorn f69fbf2255 feat(proto): Format protobuf files with buf (#2033)
Formats all protobuf files with buf format. This ensures
a consistent style across all our protobuf files, similar
to gofumpt.
2022-05-04 11:10:21 -04:00
claire labry 0fb9b35498 Add config key to the promote-staging event (#2054) 2022-05-03 20:35:49 -07:00
Johan Brandhorst-Satzkorn 95c5063500 chore: Prepare for next release 2022-05-03 17:27:14 -04:00
bc86b4e9e9 Docs Changes for v0.8.0 (#2024)
* added new metrics doc

* Minor format fixes

* Use table to list metrics

* Update website/content/docs/operations/index.mdx

Co-authored-by: Robin Beck <stellarsquall@users.noreply.github.com>

* fixed sentence

* added worker proxy http

* Update website/content/docs/operations/metrics.mdx

Co-authored-by: Todd <github@quaddi.com>

* Update based on the changes in draft

* remove WIP note

* Update website/content/docs/operations/metrics.mdx

Co-authored-by: Todd <github@quaddi.com>

* Update website/content/docs/operations/metrics.mdx

Co-authored-by: Todd <github@quaddi.com>

* Update website/content/docs/operations/index.mdx

Co-authored-by: Todd <github@quaddi.com>

* Removed invalid metrics

* Update header level

* added code styling for "ops" listener and port 9203 description

* added health endpoint document

* resolved cherry-pick confict for 5edac3a7418f80e7d528f2fa7a461b1125c11806

* Incorporate review feedback

* removed bad reference to metrics

* added Other section for boundary_build_info

* fixed typo

* Update website/content/docs/operations/health.mdx

Co-authored-by: Loann Le <84412881+taoism4504@users.noreply.github.com>

* Update website/content/docs/operations/metrics.mdx

Co-authored-by: Loann Le <84412881+taoism4504@users.noreply.github.com>

* Update website/content/docs/operations/health.mdx

Co-authored-by: Loann Le <84412881+taoism4504@users.noreply.github.com>

* Update website/content/docs/operations/health.mdx

Co-authored-by: Loann Le <84412881+taoism4504@users.noreply.github.com>

* Update website/content/docs/operations/health.mdx

Co-authored-by: Loann Le <84412881+taoism4504@users.noreply.github.com>

* Update website/content/docs/operations/health.mdx

Co-authored-by: Loann Le <84412881+taoism4504@users.noreply.github.com>

* Changed release notes structure

Removed the empty "Releases" folder and now it goes straight to "Release Notes"

* Update website/content/docs/operations/health.mdx

Co-authored-by: Loann Le <84412881+taoism4504@users.noreply.github.com>

* Incorporate review feedback

* Update website/content/docs/operations/index.mdx

Co-authored-by: Loann Le <84412881+taoism4504@users.noreply.github.com>

* added tutorial link

* Update website/content/docs/operations/metrics.mdx

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

* Update website/content/docs/operations/metrics.mdx

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

* Update website/content/docs/operations/metrics.mdx

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

* Update website/content/docs/operations/metrics.mdx

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

* Update website/content/docs/operations/metrics.mdx

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

* Update website/content/docs/operations/metrics.mdx

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

* 0.8 Release Notes

Added release notes page for 0.8

* corrected sensitive info redaction note

* cleaned up visibility overview

Co-authored-by: taoism4504 <loann@hashicorp.com>
Co-authored-by: Yoko Hyakuna <yoko@hashicorp.com>
Co-authored-by: Loann Le <84412881+taoism4504@users.noreply.github.com>
Co-authored-by: Todd <github@quaddi.com>
Co-authored-by: Timothy Messier <tim.messier@gmail.com>
Co-authored-by: XingLu Wang <xinglu.wang@hashicorp.com>
Co-authored-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
2022-05-03 16:24:04 -04:00
Johan Brandhorst-Satzkorn f39553abb3 chore: Release prep for v0.8.0 2022-05-03 10:33:36 -04:00
Zed 93ed076fdb Bump version and update changelog for 0.8.0 release (#2053) 2022-05-03 10:19:04 -04:00
Haotian 636901145e chore(metrics): update changelog for metrics (#2051) 2022-05-02 14:42:57 -07:00
Zed 9292fffa86 Bump version in preparation for 0.8.0 release (#2050) 2022-05-02 17:23:24 -04:00
Irena Rindos ca2599ead4 Merge pull request #2046 from hashicorp/irindos-session-transition-trigger
fix(session): Update session state transition trigger
2022-05-02 16:13:56 -04:00
irenarindos c6764e85d9 fix(session): Update session state transition trigger 2022-05-02 15:58:41 -04:00
Timothy Messier b74fb95a78 Merge pull request #2049 from hashicorp/llb-listing-speedups
Listing Session and Targets Performance Improvements

Improve response time for `GET` requests to:

- `/v1/targets`
- `/v1/sessions`

These endpoints now perform authorization checks prior to retrieving the
full resources from the database.

This also includes a bug fix for retrieving sessions that could result
in incomplete results when there is a large number (10k+) of sessions.
2022-04-29 17:05:43 -04:00
Timothy Messier 075ac87a58 chore(changelog): Add entries for session and target list improvements 2022-04-29 16:50:21 -04:00
Timothy Messier f00af362dc fix(session): Include where clause with order and limit
When applying the limit and order by, the where clause also needs to be
applied to yield the correct results. This can be seen with an example.

Assuming a data set where there are 100 sessions, with 10 sessions
belonging to a user with id `u_user1` and 90 sessions belonging to
`u_user2`. If the constructed query is like:

    select *
    from
        (select public_id from session limit 10) s,
        session_list ss
    where
        s.public_id = ss.public_id
        and s.user_id = 'u_user1'
    order by create_time asc;

The initial sub-query with the limit could return sessions only
belonging to `u_user2`, then it would apply the where clause and exclude
all of the rows.

Instead if the query is:

    with
    session_ids as (
        select public_id
        from sessions as s
        where
            s.user_id = 'u_user1'
        order by create_time asc
        limit 10
    )
    select *
    from session_list
    where
        session_list.public_id in (select * from session_ids)
    order by create_time asc;

The CTE applies the where clause ensuring that only sessions for
`u_user1` are used for the final select from the view.
Note that the CTE is use primarily for readability.

This also adds an index on `session (create_time)` to aide the query
planner in performing the order by.
2022-04-29 16:33:44 -04:00
Jeff Mitchell 4cf2a87e8d Update targets to new listing method (#2045)
This uses the prefetch method to fetch resource IDs and validate them
for authz by the user before then fetching the full list of targets.
2022-04-29 16:33:44 -04:00
Johan Brandhorst-Satzkorn 21b0d584ad feat(dbtest): Add benchmark dump generator
Generate dumps ahead of time so that they can
be used for benchmarks without prohibitive
startup costs.

Fixes https://hashicorp.atlassian.net/browse/ICU-4039
2022-04-29 16:33:44 -04:00
Johan Brandhorst-Satzkorn e864652b33 feat(sessions): Add list benchmarks
The list benchmark tests uses pre-created database
dumps to run its benchmarks. This benchmark
will be used to guide optimizations around listing
of sessions.

Fixes https://hashicorp.atlassian.net/browse/ICU-4042
2022-04-29 16:33:44 -04:00
Johan Brandhorst-Satzkorn 5d042c7ec7 feat(dbtest): Mount DB dumps and create templates
Mount the benchmark dump directory when running
the test database and create a new script for creating
templates from the dumps. This makes it easy to create
pre-populated databases for benchmark tests.

Fixes https://hashicorp.atlassian.net/browse/ICU-4040
2022-04-29 16:33:44 -04:00
Johan Brandhorst-Satzkorn 9e424db0a3 test(session): Ignore unique error on session create
Sometimes when creating a lot of sessions concurrently we
can run into a unique constraint error in the warehouse triggers
in the database. Simply retrying the call will allow the
session creation to succeed.
2022-04-29 16:33:44 -04:00
Johan Brandhorst-Satzkorn 7f9b294a7e refact(all): Use testing.TB for test helpers
Our test helper packages were not possible to use
with benchmarks. This refactor switches to testing.TB
to allow both tests and benchmarks to use the helpers.
2022-04-29 16:33:44 -04:00
Johan Brandhorst-Satzkorn a7a2c82931 feat(dbtest): Add docker-load Makefile target
The new docker-load target uses docker buildx to build
a local image of each of the Dockerfiles, and load them
into the local docker socket image store.
2022-04-29 16:33:43 -04:00
Jeff Mitchell b41e983503 Reorder authz check for sessions (#2042)
* Reorder session authz checks

This implements a mechanism for service handlers to pass a repo
satisfying an interface into the scope IDs listing function. The purpose
of this interface is to allow the same function to perform authorization
checking against resources rather than requiring service handlers to
fetch all resources in the determined set of scopes and then perform
this checking. While this could be done in each service handler, this
approach centralizes the logic, which has the nice benefit of removing
some boilerplate from service handler list functions that have adapted
to it.

Tests haven't changed, which is expected -- the function should return
exactly what was being returned before, simply faster.
2022-04-29 16:33:43 -04:00
Jeff Mitchell 0f961eb5f6 Bump Go to latest 1.17 (#2041) 2022-04-29 08:33:36 -04:00
Todd a1cf3234ed url.PathEscape resource ids in the sdk before sending building a request. (#2035) 2022-04-27 08:13:46 -07:00
Johan Brandhorst-Satzkorn 89196f2ce7 Remove old migration code & Avoid db test image confusion (#2038)
* refact(dbtest): Remove old migration code

This is no longer needed, so we can clean up this
script a bit.

* refact(dbtest): Change test image env var

The existing environment variable clashes with
the one used in the top level Makefile. The new
name prevents confusing behavior when setting
the env var and creating the test database from
the root of the repository.
2022-04-25 17:39:23 -04:00
Todd 5603652d33 Make the {id} regexp less strict for identifying the "path" label value. (#2034)
Previously we were matching what boundary considers an id, but that is determined after requests are routed by grpc-gateway.
This changes the regexp to match any path segment to try to behave the same way that grpc-gateway would when assigning values
to the {id} variable declared in the protobuf.
2022-04-21 14:29:31 -07:00
Carlos Alcaide Corvo 960ed6a80f Update from v2 to v3 all gh actions (#2030) 2022-04-21 09:57:29 -07:00
Johan Brandhorst-Satzkorn a1c656ca94 fix(event): Remove wrapper validation (#2032)
The wrapper is sometimes unset at the time when the
audit config is validated, so it is impossible for us
to validate that a valid wrapper is configured. The wrapper
is configured by later setup steps because of a dependency
on the eventer in our KMS setup.
2022-04-20 17:42:39 -04:00
Carlos Alcaide Corvo 1342bd0183 Refactor build ci worfklow to decouple UI build (#1975)
Refactor build workflow to stop building the UI and consuming UI artifacts
2022-04-20 11:04:36 -07:00
Johan Brandhorst-Satzkorn 243a4c4616 Merge llb-audit-events into main
Classify fields for all api and cluster protobuf messages.
Before classification, audit events would be completely redacted.
Now events will contain unredacted values according to classification.
Audit events are now no longer considered a WIP.
2022-04-20 14:02:34 -04:00
Timothy Messier 3be5c44907 feat(target): Classify resources for audit events 2022-04-20 13:32:32 -04:00
Timothy Messier c8be4a9890 refact(target): Switch subtype attributes to oneof
This updates the target resources to use a oneof for attributes. This
allows requests to the targets service to leverage the new
subtypes.AttributeTransformerInterceptor so that attributes are strongly
typed prior to the service handler.
2022-04-20 13:32:32 -04:00
Johan Brandhorst-Satzkorn 8c452b0991 feat(authmethods): Add classification to all fields 2022-04-20 13:32:32 -04:00
Timothy Messier 2ade7f34a8 feat(users): Classify resources for audit events 2022-04-20 13:32:32 -04:00
Timothy Messier 006fa3a85a feat(session): Classify resources for audit events 2022-04-20 13:32:32 -04:00
Timothy Messier 38a3960047 feat(role): Classify resources for audit events 2022-04-20 13:32:32 -04:00
Timothy Messier 4599e64cab feat(event): Remove BOUNDARY_DEVELOPER_ENABLE_EVENTS env var 2022-04-20 13:32:32 -04:00
Timothy Messier 1af803780c feat(controller): Reorder interceptor stack
The new `subtype.AttributeTransformerInterceptor` can return an error if
it fails to transform the attributes. This is mainly if invalid
attribute fields were included for a particular subtype. This error case
used to be checked in the grpc service handler functions. However, now
that it is happening in the interceptor, the `errorInterceptor` needs to
be moved up in the stack so that it will process the response of the new
transformation interceptor.

The `errorInterceptor` used to be after the `auditRequestInterceptor`
and prior to the `auditResponseInterceptor`, meaning that the
`auditResponseInterceptor` would have access to the result of the
`errorInterceptor`. But it seems the `auditRequestInterceptor` does not
use or need any of the headers set by the `errorInterceptor` so it
should be safe to move the `errorInterceptor`. This is important since
the `subtype.AttributeTransformerInterceptor` needs to be before the
audit interceptors in the stack to properly transform requests/responses
so they can be audited with the complete classification information.
2022-04-20 13:32:32 -04:00