Commit Graph
1983 Commits
Author SHA1 Message Date
Timothy Messier e79714e93f feat(session): Add include_termianted option to list endpoint 2022-06-09 19:28:04 +00:00
Timothy Messier d741034829 perf(session): Change list behavior around terminated sessions
It was determined that it is a more common use case for users to request
non-terminated sessions (i.e. sessions in `pending`, `active`, or
`canceling` when requesting sessions. Notably, end users would need
non-terminated sessions to:

- Establish a new connection to a session.
- Terminate a session

So now by default a list request to `/v1/sessions` will *not* include
terminated sessions.

To still enable use cases where terminated sessions are needed, this
adds a new query parameter to include the terminated session:
`/v1/sessions?include_terminated=true`.

Note that this query parameter is considered experimental and subject to
change.
2022-06-09 19:28:04 +00:00
Timothy Messier 32070678dc perf(session): Remove connections from session list endpoint
Including the nested connection information in the session list response
had a negative impact on performance as it created a significant
multiplier on the number of rows that needed to be fetched from the
database.

It was also determined that this information was used by neither the
admin ui nor the desktop client.

Note that nested connection information can still be retrieved via a
read request for a specific session.
2022-06-09 19:28:04 +00:00
Timothy Messier 5b0abe2e27 feat(session): Add migration to delete terminated sessions
There is a new periodic job that will delete terminated sessions that
are older than one hour. However, since until now terminated sessions
were not deleted, the first time the job runs there could be a large
number of sessions that need deleted. This could have a negative impact
on a running cluster. To mitigate the operational risk, this adds a
migration to perform an initial delete while the cluster is offline.
2022-06-09 19:28:04 +00:00
Timothy Messier f9eab71a4a feat(session): Add periodic job to delete terminated sessions 2022-06-09 19:28:04 +00:00
Timothy Messier de2421cc25 feat(session): Add repository method to delete terminated sessions
This will delete sessions that have been in the termianted state for
longer than the given threshold.
2022-06-09 19:28:03 +00:00
Timothy Messier a4d0e3c7f8 refact(session): Rename files with job to use a prefix
This makes it so jobs will all be naturally grouped together in file
listing.
2022-06-09 19:28:03 +00:00
Johan Brandhorst-Satzkorn 8fdc07d5a5 test: Use tparse to simplify test failure analysis (#2149)
The tparse library adds a nice summary of the test output,
which should hopefully make it easier to find errors in the tests
2022-06-09 13:02:55 -04:00
Johan Brandhorst-Satzkorn e7273d65c2 Bump Go version to v1.18.3 (#2158)
* chore: Bump Go version

Go 1.18.3 has some security patches over 1.18.1.

See https://go.dev/doc/devel/release#go1.18.minor

* Fix formatting

This was missed in a recent PR
2022-06-09 11:43:39 -04:00
Jeff Mitchell d6362f9e5e Restrict anonymous user capabilities (#2156) 2022-06-09 11:30:01 -04:00
Gabriel SantosandJohan Brandhorst-Satzkorn 3521c21cd5 fix: Refuse to start if max_open_connections is below 5 (#2097)
* server refuses to start if max_open_connections is below 5

* suggested changes - Update internal/db/db.go

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

Co-authored-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
2022-06-09 10:13:55 -04:00
Jim 0425384b49 feature (events): add TestWithoutEventing(t) (#2137) 2022-06-07 12:23:01 -04:00
Jim 6ceda0e595 feature (errors): add support fmt specifier with operands to WithMsg(...) (#2126) 2022-06-03 10:38:32 -04:00
Timothy Messier 2a5aaea8b2 chore(changelog): Add note about audit logs (#2066) 2022-05-31 10:25:55 -04:00
modrake 463fdd2172 add codeowners to protect release dirs (#2108) 2022-05-27 14:06:42 -07:00
Johan Brandhorst-Satzkorn b20939ecb4 fix(cmd): Fix build error (#2107)
This seems to have been missed when #2094 was
reviewed and merged.

Blame: ec608b79da
2022-05-25 15:40:36 -04:00
Timothy Messier 1ce4ea9af5 chore(docker): Add dockerignore file to reduce context size (#2022)
Since the Dockerfile is now at the repository root, when running
building a docker image, the entire repository was being added to the
context sent to the docker daemon. However, only the compiled binary and
a few configs in `.release/docker` are needed to build the docker
images.

This ignore file will only send necessary fields into the context. This
helps speed up the docker image building.

For example, when building the dev image, without the ignore file:

    Sending build context to Docker daemon  2.043GB

And with this ignore file:

    Sending build context to Docker daemon  130.7MB

See:
    https://docs.docker.com/engine/reference/builder/#dockerignore-file
2022-05-25 14:34:53 -04:00
Johan Brandhorst-Satzkorn ec608b79da fix(cmd): Respect DB max open connections (#2094)
Both the init and migrate commands were ignoring
the configured max_open_connections database
setting. This fix ensures that both commands
respect the limits.
2022-05-23 08:21:15 -04:00
Timothy Messier c2d632f1a2 test(targets): Prevent panic due to non-deterministic order (#2086)
This test was using the third element in the result from a list request
to craft the input for the next assertion. However, one of the test
targets that is created does not have a default port set. Since the
target list call is not ordered, sometimes this element could be the
third element and a panic would result when default port interface was
converted to a float64.

This fixes the panic like:

    --- FAIL: TestList (1.31s)
    panic: interface conversion: interface {} is nil, not float64 [recovered]
            panic: interface conversion: interface {} is nil, not float64

    goroutine 1694 [running]:
    testing.tRunner.func1.2({0x14b2320, 0xc002f486f0})
        /prefix/usr/lib/go/src/testing/testing.go:1389 +0x24e
    testing.tRunner.func1()
        /prefix/usr/lib/go/src/testing/testing.go:1392 +0x39f
    panic({0x14b2320, 0xc002f486f0})
        /prefix/usr/lib/go/src/runtime/panic.go:838 +0x207
    github.com/hashicorp/boundary/internal/tests/api/targets_test.TestList(0xc000f81380)
        /go/src/github.com/hashicorp/boundary/internal/tests/api/targets/target_test.go:193 +0x174b
    testing.tRunner(0xc000f81380, 0x2b933a8)
        /prefix/usr/lib/go/src/testing/testing.go:1439 +0x102
    created by testing.(*T).Run
        /prefix/usr/lib/go/src/testing/testing.go:1486 +0x35f
    FAIL    github.com/hashicorp/boundary/internal/tests/api/targets    5.742s
    FAIL

Refs: #2003
2022-05-18 09:45:31 -04:00
Carlos Alcaide Corvo d7adc2cb5e Update UI version to consume the new renamed UI artifacts (#2080) 2022-05-17 16:32:36 -07:00
Louis Ruch 6f4cee88bf fix(vault_store): Correctly return expected errors (#2081)
* fix(vault_store): Correctly return errors
2022-05-17 12:20:01 -07:00
Carlos Alcaide Corvo ce0507ee99 Update UI artifacts consumption (#2074)
Update UI artifacts consumption to allow UI editions
2022-05-16 12:05:32 -07:00
irenarindos ff9470d7df Update changelog for 0.8.1 2022-05-16 15:03:45 -04:00
Jim 6635778765 chore (kms): upgrade extras/kms dep which no longer directly deps on sqlite (#2078) 2022-05-15 12:56:32 -04:00
Jeff Mitchell e84a2e639f Revert downgrade of go-kms-wrapping 2022-05-13 17:04:22 -04:00
Jim 785241237e refactor (kms): adopt the go-kms-wrapping/extras/kms package (#2027)
* feature (db): add Db.UnderlyingDB()

This is needed to allow for integration with bits that need a *dbw.DB

* feature (kms): add new go-kms-wrapping/extras/kms dependency

* refactor (kms): schema changes required to adopt extras/kms pkg

* refactor (kms/iam): rename to DeprecateCreateKeysTx(...)

* refactor (kms): remove deprecated test

* refactor (kms): refactor Kms type

This refactor includes renaming the existing type to DeprecatedKms
and then refactoring the Kms type to become a wrapper of
go-kms-wrapping/extras/kms

* refactor (kms): delete all the unneeded bits

All this stuff is not needed now that we're using
go-kms-wrapping/extras/kms

* refactor (db): fixup tests after kms refactor

* refactor (kms/tests): 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.

* tests (session benchmarks): refactor to use new Kms type

* refactor (schema): rm test which relies on deprecated Kms code

* refactor (kms): post rebase on main changes required

* chore (kms refactor): re-add unit test from main

* refactor (kms): uses migrations that don't include KMS schema changes
2022-05-13 13:53:22 -04:00
Johan Brandhorst-Satzkorn 8cef1017e9 fix(session): Fix typo in connection documentation (#2075) 2022-05-12 16:11:35 -04:00
Irena Rindos a11b0e81a8 Merge pull request #2065 from hashicorp/irindos-session-nullfkey
bug(session): null fkey trigger also checks for session terminated state
2022-05-12 15:12:50 -04:00
irenarindos 54c30d2cad bug(session): null fkey trigger also checks for session terminated state 2022-05-12 14:59:22 -04:00
Cameron Perera 20f5185a8c chore: Change how update-ui-version gets the latest commit sha (#2069)
* chore: Change how update-ui-version gets the latest commit sha on main

* remove changelog edits

* chore: refactor uiupdate.sh to use UI_COMMITISH instead of main
2022-05-12 09:32:39 -05:00
Jeff Mitchell 99a16dafc2 Leave cluster listener up when bad data is sent (#2073)
Leave cluster listener up when bad data is sent

Removing the ALPN muxer exposed the underlying listener directly to the
gRPC server, which means that a quirk of the ALPN muxer (not surfacing
errors on accept) turned into the gRPC server receiving errors on
accept, and it turns out if the error does not satisfy a special
temporary interface the listener will be closed.

The obviously better thing to do would be to let the listener close
itself if there was truly a fatal error rather than relying on
undocumented interfaces, but here we are.
2022-05-11 17:02:36 -04: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
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