Commit Graph
65 Commits
Author SHA1 Message Date
Jim 3a3f956615 support new event formats of: hclog-text and hclog-json (#1440) 2021-08-03 15:06:19 -04:00
Jim 68dd2a66ba Remove unneeded hclog dependencies as we move forward with events (#1433) 2021-08-01 14:41:13 -04:00
s-christoffandJim 6b78108ecf Update primary error functions to take a context, deprecate old functions (#1358)
* add new error funcs which take a ctx and deprecate existing funcs

* use context where available when writing error events

* remove circular internal/errors pkg dep

* suppress some chatty errors using errors.WithoutEvent()

* convert auth oidc funcs to take context where needed to write events

Co-authored-by: Jim <jlambert@hashicorp.com>
2021-07-29 20:52:56 -04:00
Chris Marchesi a15961e461 Close connections on worker on shutdown, add force shutdown (#1354)
This adds functionality to ensure that connections are closed on a
worker when the server is shut down or reloaded.

Connections are closed, and then the shutdown process waits for the next
report to the controller to go through, waiting the grace period that
was added in #1330. The rest of shutdown is then proceeded with.
Listener shutdown has been moved to the start of the process to ensure
that new connections can't be made while we are shutting down.

Additionally, functionality has been added to force shut down servers
after a second interrupt has been received after the first one. This
takes the form of code in both the server and dev mode code paths that
just performs an os.Exit if another shutdown is received during the
normal shutdown process.

Additionally, the commit also includes some refactoring to tests so that
we could use some of the new E2E testing code to test session
connections during shutdown and reload.

Additionally, this fixes a panic in worker startup when there are no
controllers defined. Looks like the shutdown call was attempting to call
into the controller, not the worker.

Finally, this also removes the extra shutdown within the outer worker
startup.

Shutdown is actually handled within the inner StartWorker(), attempting
shutdown on errors was actually leading to potential use of an
uninitialized worker, which is leading to panics in testing.
2021-07-28 14:35:58 -07:00
Jim 70ad081e39 Events: convert from hclog to events (#1409) 2021-07-28 06:31:16 -04:00
Jim 11124794bf Events: add node for formatting/filtering cloudevents (#1390) 2021-07-25 17:40:54 -04:00
Jeff Mitchell ed6c59a053 Update the rest of the shared libs locations 2021-07-14 17:50:15 -07:00
Jeff Mitchell ce52acb968 Update strutil import 2021-07-14 17:37:40 -07:00
Jeff Mitchell 9ba1948298 Remove telemetry calls as we aren't using them 2021-07-14 16:53:42 -07:00
Chris Marchesi 5a70875726 internal/servers/controller: Worker failure connection cleanup (#1340)
This commit adds the support to do the following:

* Mark connections for non-reporting workers as closed. This is the
controller counterpart to the worker functionality (see #1330). This is
written as a scheduled job that does the work DB-side in a single atomic
query.

* Works to reconcile states if such a broken controller-worker
connection resumes and a worker reports a connection as connected that
should be disconnected. In this case, the controller will send an update
request, and the worker will honor it and terminate the connection.

* Further refinement of the grace period setting has been added here.
We have converged on the current server "liveness" setting as our
default here, which is half of the previous 30s (15 seconds, in other
words). Additionally, this is now configurable on the controller and
worker side, with the caveat that it's currently impossible to do so in
config as the setting has been untagged in HCL. This is exposed so that
we can run some sophisticated testing scenarios where we skew the grace
period to either the controller or worker to ensure the aforementioned
reconciliation works.

* Some repository functions have been added to support the new
functionality, in addition to some test code to the worker to allow
querying of session state while testing.

* Finally, we've added some add timestamp subtraction functions
as well, basically serving as the opposite of the addition functions.
2021-07-14 09:14:24 -07:00
Jeff Mitchell 2cbcf9a563 Update usage of shared-secure-libs (#1393) 2021-07-12 21:06:22 -04:00
Jim 1daa3ebefe integrate events into the servers (#1355) 2021-07-08 15:50:25 -04:00
Jeff Mitchell 9c945b7021 Migrate ParseAddress to shared-secure-libs (#1313) 2021-06-15 13:35:29 -04:00
Jeff Mitchell 054c0aa538 Update password generated account IDs (#1290) 2021-06-08 12:31:58 -04:00
Jeff Mitchell ad93315b59 Add predictable account IDs in dev mode (#1271) 2021-06-04 10:35:51 -04:00
Jeff Mitchell 15bd1a5245 Add initial SQL for managed groups (#1253) 2021-05-26 20:43:36 -04:00
Jeff Mitchell 6f34da8923 Add cleanup of dead connections no longer reported by a worker (#1220) 2021-05-14 13:23:12 -04:00
s-christoff 9ceeb3bd65 Add -container-image flag (#1112) 2021-05-03 13:11:28 -05:00
Jim 8d317023f8 OIDC: make callback URL paths deterministic. (#1188) 2021-05-02 15:25:29 -04:00
dd0f34bc35 Add new OIDC auth method. (#1090)
Co-authored-by: Todd Knight <T.Alan.Knight@gmail.com>
Co-authored-by: Jeff Mitchell <jeffrey.mitchell@gmail.com>
Co-authored-by: Michael Gaffney <mgaffney@users.noreply.github.com>
2021-04-08 20:54:32 -04:00
Jeff Mitchell 9649a19d23 Update CLI error codes to be consistent with connect (#976) 2021-03-04 20:05:17 -05:00
Jeff Mitchell e9da3a871d Switch on CORS by default if not specified (#928) 2021-02-11 20:10:48 -05:00
Jeff Mitchell 22462cdd84 Add read:self and cancel:self to sessions; add dev unpriv user (#923)
* Sessions support for read:self and cancel:self permissions. This is automatic with fallback; no API change is needed.

* Strips out values from listing if only self actions are allowed on the resource and the user ID is different. This prevents a default ACL of id=*;type=session;actions=read:self,cancel:self from causing all values to be visible when listing.

* Adds an unprivileged user to development/testing instances. This user has only default permissions plus the ability to authorize sessions in the default target.
2021-02-11 13:14:18 -05:00
Jeff MitchellandJeff Malnick d279a906ce Allow public_cluster_addr to use an env var or file (#907)
Co-authored-by: Jeff Malnick <malnick@gmail.com>
2021-02-10 20:22:02 -05:00
Todd Knight 1f9fcad1cd Adding Migrate Command (#872) 2021-01-25 14:43:50 -07:00
Todd Knight ec6151d174 Organize DB Schema Migration Code and DB Init Checks (#842)
Create Schema Manager and propagate contexts into the DB calls downstream.
Add checks at controller startup and database init for correct schema version and schema migration dirty bit being set.
2021-01-19 10:40:41 -07:00
Michael GaffneyandJeff Mitchell 94cb79bbdd See how Boundary would look with gofumpt applied (#853)
* See how Boundary would look with https://github.com/mvdan/gofumpt applied

Results of running `gofumpt -w -s .`

* Update tools file and Makefile for gofumpt

Co-authored-by: Jeff Mitchell <jeffrey.mitchell@gmail.com>
2021-01-07 10:02:32 -05:00
Jeff Mitchell 833f29e352 Switch connection limit for default target to -1 (#814)
This makes the initial testing workflow less confusing for users
2020-12-09 16:05:48 -05:00
Jeff Mitchell e2e4631929 Add ability to set public cluster address (#761) 2020-10-30 16:54:53 -04:00
Jeff Mitchell 1f48d97327 Support for Unix domain socket listeners (#705)
The client already supports protocol-agnostic transport so handles
unix:/// schemes.
2020-10-16 13:45:47 -04:00
Jeff Mitchell c1a1f8bb1b Separate out docker dep into package (#482)
This also then removes support for docker-based containing starting (for
now) from platforms other than windows/darwin/linux as there are build
issues on several.
2020-09-28 16:05:15 -04:00
Jeff Mitchell 725abffebf Add some more text to dev flags 2020-09-25 17:40:10 -04:00
Jeff Mitchell bec3d702fb Add -database-url to dev mode (#459)
Create default dev mode login name of "admin" and password of "password"
2020-09-25 17:36:47 -04:00
Jeff Mitchell 94f9d952be Add connect -exec and ssh subcommand support (#434) 2020-09-24 17:29:12 -04:00
Jeff Mitchell 7fcbffbe88 Remove not-set value. (#427)
I don't think the conditions exist here that necessitated it being
introduced into Vault, but I do sometimes see a baffling condition where
the address coming from the flag is empty. I don't think we need this so
take it out.
2020-09-24 12:19:00 -04:00
Jeff Mitchell 31fe9292b3 Instantiate default resources (#425) 2020-09-24 03:31:26 -04:00
Jeff Mitchell 38ce9d9eac Combine controller and worker commands (#415) 2020-09-23 01:23:10 -04:00
Jeff Mitchell 0a4669e96d Remove dev mode from controller/worker, and streamline flags on dev command (#413) 2020-09-22 21:37:37 -04:00
Jeff Mitchell 262ff06042 Add public address config option (#405) 2020-09-22 08:28:10 -04:00
Christian Frichot 72de1a6916 Fix WATCHTWER ENV variable names (#389) 2020-09-21 11:09:40 -04:00
Jeff Mitchell 37e9fed2e3 Allow not destroying dev databases (#366)
This also shifts some logic around to better prepare for non-dev-mode
workloads, although it does not actually call the KMS creation functions
and initial auth method creation from non-dev commands yet.
2020-09-16 10:10:06 -04:00
Jeff Mitchell 23156afa11 Add in most of the proxy flow (#326) 2020-09-03 13:24:34 -04:00
Jeff Mitchell b53812a5c1 Add ability to skip automatic auth method creation (#306)
This is useful if you, for instance, want Terraform to be 100%
responsible for creation of resources (outside of the static ones that
cannot be removed or modified, like u_anon). This will mean using the
recovery mechanism for initial setup, but that isn't an issue once TF
supports that :-)
2020-08-26 23:27:46 -04:00
Jeff Mitchell b47cca0329 Add (non-db aspects of) the recovery key workflow (#286) 2020-08-20 13:34:03 -04:00
Jim 9570897032 basic keys mgmt repo (#264) 2020-08-19 16:47:18 -04:00
Jeff Mitchell 282177afc2 Remove the default org (#270) 2020-08-17 15:38:41 -04:00
Jeff Mitchell fff15bc9f3 Rename KMS purpose 'controller' to 'root' 2020-08-14 10:12:31 -04:00
Jeff Mitchell b75a6fc5e5 Update scopes CLI command in the model of the roles command (#262)
* Update scopes CLI command in the model of the roles command

* Pull help functions to helper methods
2020-08-13 11:20:22 -04:00
Jeff Mitchell 203e2b5dc2 Initial worker porting steps (#232) 2020-08-12 00:40:39 -04:00
Jeff Mitchell 4cfab04307 Migrate user name to login name (#255) 2020-08-11 17:25:00 -04:00