Commit Graph
200 Commits
Author SHA1 Message Date
irenarindos 594e6e82b5 feat(worker): save workerAuth request to a file 2022-06-09 10:40:30 -04:00
Haotian 631c174f47 feat(worker): implements WorkerAuthStorage wrapper for worker credential encryption (#2076)
* Adds WorkerAuthStorage wrapper for worker credential encryption using nodeenrollment library.

* Adds AuthStoragePath field in worker config and dev mode to specify directory to store credentials.
2022-06-03 13:25:58 -07:00
Jeff Mitchell 2f06513a3a Merge branch 'main' into llb-byow 2022-05-13 17:05:36 -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
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 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
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
Todd 631de192d3 Initialize the build info metrics using init to always register to the DefaultRegistery. (#2020)
This fixes errors related to calling NewServer or NewCommand multiple times when using autocomplete.
2022-04-15 15:48:59 -07:00
Todd 0b12feb953 Do not register the build_info collectors multiple times. (#2014)
Since we call base.NewServer multiple times when building the Commands map this was returning
an error "duplicate metrics collector registration attempted".  This PR only creates a single
server which is used for both the "server" command as well as "dev".
2022-04-15 09:30:23 -07:00
Haotian e3f72bd0a4 feat(metrics): add build info metric on server start (#1984)
Adds a Prometheus gauge metric set to the value of 1, with labels for go version, git revision, and Boundary version. 
Assigns the Prometheus DefaultRegisterer to the Server struct as a parameter to NewServer(), to avoid "duplicate metrics collector registration" panics from test cases.
2022-04-12 17:04:11 -07:00
Jeff Mitchell 07dc3db974 Remove ALPN Muxer (#1965)
We never ended up using this and it makes it much harder to reason about the listeners.

An explanation: for the moment I separated out all of the listeners in the struct, even though one should suffice, because when I did it that way first I was hitting some really weird and hard to find intermittent behavior where it seemed like the listeners were getting crossed. So I re-did it this way with each listener very explicitly referenced. I'm happy to make a follow-up PR that attempts to combine them all into a single listener without hitting the issues I did, if desired, but at least doing it via a separate PR means that it won't be something with removing the ALPN muxer that is at fault.
2022-04-01 12:06:41 -04:00
ToddandHugo Vieira 3eb22b073a Defines the controller api metrics and registers them at controller startup (#1917)
Co-authored-by: Hugo Vieira <hugoamvieira@users.noreply.github.com>
2022-03-31 08:48:50 -07:00
Hugo 244237cd2f feat(controller): Add health endpoint (#1882)
* feat(controller): New health service and server

This change also implements a new listener purpose, `ops`.

`ops` (short for operations) is a new listener purpose that is
responsible for serving Boundary's operations endpoints, like health
and possibly metrics.

At Startup: `ops` listeners get configured as late as possible to catch
any errors with the startup process;

At Shutdown: If the health endpoint has been set-up, we introduce a
configurable delay in the process. This is to enable the health endpoint
to report unhealthy for that amount of time. `ops` listeners are also
the last listeners to be shutdown.
2022-03-28 17:16:39 +01:00
Jeff Mitchell c99907c6c5 Update keyring deps to remove deprecation warnings (#1924) 2022-03-18 13:52:38 -04:00
Jeff Mitchell e596daf34d Add hclog adapter and gating to eventer (#1915)
This contains to related things:

1. An adapter allowing an hclog interface to take in information and send them to the eventer
2. A gate on the eventer, which is the analogue to the behavior prior to eventing where we'd ensure logs were not printed prior to the startup information. Without this, plugin logs using the hclog adapter will start showing up too early.
2022-03-16 17:25:34 -04:00
Jeff Mitchell 7eb29261b2 Update to go-kms-wrapping version 2, and plugin-based KMS (#1901) 2022-03-16 17:04:07 -04:00
Timothy Messier c9b99306e1 refact(target): Add NewFunc to registry
This adds a new requirement onto subtypes to register a NewFunc.
Previously the subtypes where implementing this function anyway, but the
target package was not including them in the registry. This resulted in
packages that use the target package needing to import the subtypes
directly, which we want to avoid.

This refactor will require the subtypes to register their NewFunc which
can then be used by `target.New` so packages that need to create targets
can do so by only using the target package.

This also updates the tcp subpackage to register a NewFunc.
2021-12-03 10:19:29 -05:00
Hugo Vieira f1063a62a0 feature(config): add sockaddr template support 2021-11-30 14:07:12 +00:00
Hugo Vieira 21a771b581 test(servers base): add tests ahead of functionality change
Adds tests to `SetupControllerPublicClusterAddress` and
`SetupWorkerPublicAddress` ahead of changes in these functions to
ensure functionality is preserved.
2021-11-29 18:19:10 +00:00
Jeff Mitchell 95568ef07f Fix tests using multiple controllers (#1734)
The previous PR only initialized plugins if they were required, which
meant that there may not actually be a plugin manager running because a
second node would not actually create the dev database, which is where
the plugin was being added. The assumption that a plugin manager is
running is still a fine one at the moment, but we just need to make sure
it's running in _all_ cases.
2021-11-18 16:01:15 -05:00
Jeff Mitchell 5559cf54d3 Don't always assume plugins should be activated (#1732) 2021-11-18 11:53:45 -05:00
Jeff Mitchell 48ac8b8f0b Merge branch 'main' into plugin-hostcatalogs 2021-11-07 18:47:28 -05:00
Jim eecd878b36 feature: Add signing (hmac-sha256) of audit entries (#1666) 2021-11-05 20:44:33 -04:00
Jim f63ca1313c feature (kms/audit): Add base audit key type (#1651)
* feature (db): Add the ability to enable debug output for a connection

* refactor: Use scope.Global instead of "global"

* feature (db/migrations): Add kms audit keys

Add schema changes to support a new DEK for audit crypto operations.

* feature (kms/audit): Add audit key type

All the bits required to define a new DEK concrete type for
operating on audit entries.

* refactor (db): Remove deprecated migration unit tests.

We added a new audit DEK to kms.CreateKeysTx(...).  Unfortunately,
unit tests like TestMigrations_UserDimension,
Test_PrimaryAuthMethodChanges and TestMigrations_CredentialDimension
have an indirect dependency on a specific historical set of DEKs via
an indirect call kms.CreateKeysTx.  This of course fails because the
new DEK's tables is not a part of pinned migration versions that these
tests depend on.
2021-11-04 09:34:01 -04:00
Jeff Mitchell b1a72bd445 Merge remote-tracking branch 'origin/main' into plugin-hostcatalogs 2021-10-27 21:57:30 -04:00
Jeff Mitchell 3de16b6e21 Fix TLS 1.2 support (#1637) 2021-10-26 16:30:02 -04:00
Timothy Messier 24c6c329fe chore(target): Remove unused option support from repo Create
For the target Repository's Create method, the options of
WithHostSources and WithCredentialSources where never used by the
targets.Service. As such the repository does not need to support these
options.

See: 51812ff779
2021-10-26 08:20:15 -04:00
Jeff Mitchell 0fd906d964 Merge branch 'main' into plugin-hostcatalogs 2021-10-21 11:47:13 -04:00
Timothy Messier eac433f7ff refact(target): Move tcp into subpackage
This moves all of the tcp target functionality into a tcp package. It
also establishes a Register function in the target package to allow
specific target types to be registered at initilazation time. When
registering, a target type needs to provide its Subtype, as well as some
RepositoryHooks that are used by the target Repository.
2021-10-19 10:44:51 -04:00
Jeff Mitchell 1c8e0ed1e1 Add scaffolding for external host plugins and convert aws/azure over (#1581) 2021-10-14 11:56:08 -04:00
Jeff Mitchell 13ad92d800 Merge remote-tracking branch 'origin/main' into plugin-hostcatalogs 2021-10-11 12:38:42 -04:00
Timothy Messier 8caaf3e076 refactor(schema): Add support for migration editions
This refactors the schema package and subpackages to support editions.
An Edition is a collection of sql migrations. A given boundary binary
can have multiple migration editions. The `schema.Manager` is updated to
apply the necessary migrations in the correct order, leveraging an
Edition's priority to determine the order in which the separate Editions
are applied.

The sql migration files are now nested under a directory for the
edition.

This also switches from the generated code to using embed, which
eliminates the need for the `make migrations` target and the generated
code. As such this commit removes the target and generated code.

See:
    https://pkg.go.dev/embed
2021-10-08 06:50:26 -04:00
Jeff Mitchell 217adfc4d2 Pull over CombinedSliceFlagValue from WIP plugin-hostcatalogs (#1582)
I've pulled over files as-is for the most part so this also pulls over
some common attribute/secret flags but it's not worth dealing with the
merge later...
2021-10-07 15:30:39 -04:00
Jeff Mitchell 70e6536919 Swap server interface for client (#1580) 2021-10-07 11:56:39 -04:00
Jeff Mitchell 158ab09952 Merge branch 'main' into plugin-hostcatalogs 2021-10-05 16:27:28 -04:00
Jim 8d6dee09a9 refact: Add db.DB wrapper and refact all test fixtures to use it. (#1535)
* refact: Changes required for gorm v2

* refact: Add db.DB wrapper and refact all test fixtures to use it

Stop leaking the gorm abstraction within our unit tests.

* refact: Migrate direct calls to pq to pgx driver

The refactor will remove the remaining direct dependencies on
the pq driver which has been deprecated in favor of the pgx
driver.

It includes the addition of common.SqlOpen which is a wrapper around
sql.Open, which is needed to deal with the driver name changing from
"postgres" to "pgx" but in our code base the dialect and driver are
synonyms.
2021-09-30 09:17:27 -04:00
Jim 136ac00b49 refact: Changes required for gorm v2 (#1528) 2021-09-30 08:47:34 -04:00
Todd e11a481256 Register Azure and AWS at controller start up (#1570)
* Register Plugins.

* Pass catalogs and persisted data when listing hosts for host sets.  Register azure plugin at startup if not present.
2021-09-29 15:46:42 -07:00
Jeff MitchellandTodd 7d71618df0 Add more host-catalog and host-set CLI support (#1567)
Add more host-catalog and host-set CLI support

Co-authored-by: Todd <T.Alan.Knight@gmail.com>
2021-09-28 09:40:12 -04:00
Jim 350b79be2d chore: Update go:build tags to new fmt 2021-09-27 16:24:00 -04:00
Jeff Mitchell a834a14785 Add attribute flag building and parsing (#1562)
This adds a few command sketches but that's not the main point of the PR
and filling those out will come in a different PR. This adds a new flag
type that can combine inputs to a single target slice, retaining the
ability to distinguish where it came from but also keep ordering across
different flag names. It also implements a function that does the
heuristic parsing with fallback.
2021-09-26 11:48:43 -04:00
Timothy Messier 2ee1d4e6e4 refactor: Make docker pacakge an internal package of cmd/base
The docker package and its StartDbInDocker function should only be used
by the `boundary dev` command now. So moving it into an internal package
of `base` will prevent it from being use for tests accidentally, while
still allowing it to be used for `boundary dev`.
2021-09-09 13:42:01 -04:00
Timothy Messier 75388f727a test: Refactor to use dbtest package instead of docker
This swaps the test initialization to use the dbtest package so each
test will get a fresh database created from a template database, instead
of a completely new docker container.
2021-09-09 13:42:01 -04:00
Jeff Mitchell e9a8ede0d6 Move wrapper package back to SDK (#1511)
TF uses this, so SDK is a decent place for it. It doesn't create
dependencies between it and API.
2021-09-08 12:15:42 -04:00
Jeff Mitchell 081de3cf79 Migrate sdk/recovery to api/ and sdk/wrapper to internal (#1507)
* `recovery` is only used by the API (and the main module, for decryption)
* `wrapper` is only used by the CLI right now

Moving these brings them closer to the code that uses them, and makes
the SDK package a bit more clear in terms of functionality.
2021-09-07 22:13:19 -04:00
Jim 5f46207e76 Events: add redact/encrypt node for audit events to Eventer (#1490)
* feat (events): Add new options needed for AuditConfig

WithAuditWrapper and WithFilterOperations all for optional paramters
when creating AuditConfig types.

* refactor (event): Change EventerConfig.Sinks to a ptr

We need to modify the SinkConfig.AuditConfig during the NewEventer factory, so we have to use a ptr not a ref.

* feat (events): Add audit configuration types

* feat (events): add audit config to sink configuration.

* feat (events): add redact/encrypt node for audit events to Eventer

Integrate the encrypt.Filter node from the eventlogger into the
event.Eventer, so audit events can be redacted/encrypted based
on data classifications.

* test (events) Add test protobufs for events

Add test protobufs along with a test service for testing
the audit event encrypt node
2021-08-30 19:02:48 -04:00
Todd Knight 8496093874 make fmt. 2021-08-04 13:56:54 -07:00
Jeff MitchellandJim c75c97a872 Normalize event configuration (#1444)
* Normalize event configuration

This updates event configuration stanzas to more closely match behavior
for listeners and kmses:

* Singular "sink" instead of "sinks" (probably not the most correct
  option, but a consistent option, and one that makes sense for HCL)
* Allows sinks to have the type defined at the start of the block
* Moves type-specific configuration to a specific named block

Co-authored-by: Jim <jlambert@hashicorp.com>
2021-08-04 14:01:58 -04:00