Commit Graph
568 Commits
Author SHA1 Message Date
irenarindos b7120bf88e bug(workers): Do not update description for status update 2022-06-16 18:15:44 -04:00
Todd 2ed18da214 TestPkiWorker always tries to create valid globally scoped root certificates (#2201) 2022-06-15 14:02:11 -07:00
Jeff Mitchell 4efbce3112 Add description updating via worker status (#2197) 2022-06-15 15:50:36 -04:00
Todd b3efe0eb3a Allow TestPkiWorker to be created in an authorized state. (#2198)
* Allow TestPkiWorker to be created in an authorized state.
2022-06-15 12:42:50 -07:00
Todd e379234259 Remove CanonicalAddress, GetApiTags(), and NewWorkerForStatus. (#2196)
Minor testing tweaks are also included.
2022-06-15 11:47:38 -07:00
Jim d7aaa9f7e2 fix (byow): minor updates to UpsertWorkerStatus(...) on conflict (#2194) 2022-06-15 14:43:39 -04:00
Todd 90a999d3fe Some testing fixes (#2193) 2022-06-15 10:47:25 -07:00
Todd beecbbb8a2 Upsert creates a new KMS and Updates PKI workers (#2187) 2022-06-15 08:27:08 -07:00
Jeff Mitchell 8335deb8b6 Update protos, generated code, and service handlers (#2188)
* Update protos, generated code, and service handlers

* Address review feedback
2022-06-14 17:54:35 -04:00
Jim 9dde83aea7 feature (byow): classify status msg data (#2181)
Classifying the data allows it to appropriately included in
audit events
2022-06-14 12:09:02 -04:00
Jeff MitchellandJim 7c139d28b2 Have hclog payloads use json tags (#2171)
* Have hclog payloads use `json` tags

Previously a global setting for the `structs` lib was causing the `json`
tag to be used, but this could have side effects from other packages, or
could be affected by other packages' behavior. This behavior was removed
earlier but it means this format call no longer uses `json` tags; this
behavior reverts it.

It also normalizes using mapstructure in a few other places.

* Update some tests

* Fix incorrect op const

* Fix more tests

* refactor (events): tell filter to use json tags (fix related tests)

Explicitly tell the filter to use the "json" tags so we don't have to
re-tag everything with a mapstructure tag via bexpr.WithTagName("json")

Update docs

Co-authored-by: Jim <jlambert@hashicorp.com>
2022-06-13 19:02:11 -04:00
irenarindos 16d95262a6 feature(worker): add workerKeyId to status 2022-06-10 09:31:22 -04:00
Jeff Mitchell d1b3b2441f Add node rotation (#2142) 2022-06-07 14:26:33 -04:00
Todd 1e3c941be1 Add active session count to the worker (#2145) 2022-06-07 11:21:39 -07:00
Todd 0f7e1ee7fa Fix canonical tags not getting assigned in the api resource. (#2144) 2022-06-06 16:50:22 -07:00
irenarindos 78150d88d9 feature(WorkerAuth): Create RotateRoots domain and job 2022-06-06 14:35:53 -04:00
Todd 43bcbba47f Implement UpdateWorker service method (#2133) 2022-06-06 10:52:50 -07:00
irenarindos 4c55305a49 Remove nonce encryption for workerAuth 2022-06-06 11:20:04 -04:00
Jeff Mitchell 4117841cf9 Use persistent storage for worker auth credentials (#2139) 2022-06-05 22:50:44 -04:00
Jim c1445728e3 tests (servers): additional CreateWorker(...) unit tests (#2134) 2022-06-05 14:50:15 -04:00
Jeff Mitchell caf19f867e Rename some variables to remove Nodee 2022-06-03 17:47:44 -04:00
HaotianandTodd 1830605a7e refact(servers) Update api for new worker and controller server tables (#2101)
* Discontinue support for old Server message in ServerCoordinationService. Split message into ServerWorkerStatus and UpstreamServer (which currently contains controller addresses). Remove unnecessary fields. Modify workerStatusServer to use new fields.

Co-authored-by: Todd <github@quaddi.com>
2022-06-03 11:59:02 -07:00
Jeff Mitchell 1987264bc3 Migrate storage to database repo (#2132) 2022-06-03 14:44:53 -04:00
Jim 5f66d8f2af feature (worker): add WithFetchNodeCredentialsRequest to CreateWorker (#2131)
* feature (errors): add support fmt specifier with operands to WithMsg(...)

* feature (worker): add WithFetchNodeCredentialsRequest to CreateWorker

* fixup! feature (worker): add WithFetchNodeCredentialsRequest to CreateWorker
2022-06-03 14:32:51 -04:00
Todd abbfe45419 Add the Read/List service functions (#2123) 2022-06-03 11:19:04 -07:00
Jim 9da0faabd7 refactor (servers/workerauth): add StoreNodeInformationTx(...) (#2125)
refactor to export StoreNodeInformationTx(...) which can be used
by other repositories within their transactions to store
node information.
2022-06-03 12:28:54 -04:00
Jim 6cbb36f2b1 chore (servers): update nodeenrollment dep (#2129)
The signature for registration.AuthorizeNode(...) changed
2022-06-03 12:04:33 -04:00
Jim 78ffd82581 fix (servers): return unhandled err from storeRootCertificates(...) (#2127) 2022-06-03 09:14:45 -04:00
irenarindos 642e41c9d7 feat(workerAuth): Implement nodeenrollment lib workerauth storage 2022-06-02 15:09:12 -04:00
4716c1a788 Update List Workers Repo function to allow limits and provide scopes (#2121)
* Update List Workers Repo function to allow limits and provide scopes

Co-authored-by: Irena Rindos <irenarindos@users.noreply.github.com>
Co-authored-by: Michael Gaffney <mgaffney@users.noreply.github.com>
2022-06-02 09:28:34 -07:00
Todd 587c6372c2 Add worker update to server repo (#2117) 2022-06-01 14:00:24 -07:00
Todd 731a45eba6 Merge the worker_status table with the worker table (#2111) 2022-06-01 13:25:29 -07:00
irenarindos bf3b0340e5 feat(workerauth): add storage for RootCertificates aggregate 2022-06-01 08:16:14 -04:00
Michael Gaffney eece174e5e test(worker): Fix TestDeleteWorker 2022-05-31 13:57:50 -04:00
irenarindos 74fce3776b feature(workers): add repository DeleteWorker 2022-05-26 19:15:10 -04:00
Jim 70c5da1048 feature (workers): add repository CreateWorker(...) (#2105) 2022-05-26 13:32:21 -04:00
Todd a281d10206 Add worker config table and view (#2090)
* Remove the server_id from session table, change it to worker_id on session_connection

This is step 1 in updating the worker table.  The worker is becoming a public resource so it must have
a public id.  We drop the server_id column on the session_connection table and add the worker_id column
so we can use the wt_public_key type.  Since db migrations are applied while the controller is offline,
it should be safe to assume all session connections are not in a running state, thus allowing us to null
out all the worker ids in the session_connection table.

For now we don't have very good enforcement of the wt_public_id constraints, since the id is currently
defined in the worker config, but this will soon change and the worker's id will be generated by the
controller.
2022-05-24 15:08:02 -07:00
Todd e5f02dfc26 Refactor the different repo methods into separate files (#2096)
* Refactor the different repo methods into separate files

* Move DefaultLiveness to the repository.go file to be shared across workers and controllers.
2022-05-23 09:07:30 -07:00
Todd 1c575a8762 make gen fix. 2022-05-20 11:58:40 -07:00
ToddandIrena Rindos 3fbf901739 Add source to worker tags table (#2087)
* Remove the server_id from session table, change it to worker_id on session_connection

This is step 1 in updating the worker table.  The worker is becoming a public resource so it must have
a public id.  We drop the server_id column on the session_connection table and add the worker_id column
so we can use the wt_public_key type.  Since db migrations are applied while the controller is offline,
it should be safe to assume all session connections are not in a running state, thus allowing us to null
out all the worker ids in the session_connection table.

For now we don't have very good enforcement of the wt_public_id contraints, since the id is currently
defined in the worker config, but this will soon change and the worker's id will be generated by the
controller.

* Adding worker tag db writing test.

* Move the server table back to the top.

* Update comment for the worker object.

* Update comment for the worker table.

* Add worker tag sources ("config" or "api")

* Revert renaming of UpsertWorker until later.

* Remove no longer needed files.

* Moving the TestWorker into the servers package. Fix the worker tags test.

* Update internal/proto/controller/storage/servers/store/v1/worker.proto

Co-authored-by: Irena Rindos <irenarindos@users.noreply.github.com>

* Place the repos back together so they can be refactored in a different PR.

Co-authored-by: Irena Rindos <irenarindos@users.noreply.github.com>
2022-05-20 11:55:54 -07:00
irenarindos af3f75ffaf fixup! feat(pki): Add PKI schemas and protos 2022-05-20 10:30:56 -04:00
irenarindos 20c314787d fixup! feat(pki): Add PKI schemas and protos 2022-05-20 10:23:15 -04:00
irenarindos 88a6ca036f feat(pki): Add PKI schemas and protos 2022-05-20 10:02:06 -04:00
Todd 2ecd550e27 Add fields to server_worker to be a boundary resource (#2083)
* Remove the server_id from session table, change it to worker_id on session_connection

This is step 1 in updating the worker table.  The worker is becoming a public resource so it must have
a public id.  We drop the server_id column on the session_connection table and add the worker_id column
so we can use the wt_public_key type.  Since db migrations are applied while the controller is offline,
it should be safe to assume all session connections are not in a running state, thus allowing us to null
out all the worker ids in the session_connection table.

For now we don't have very good enforcement of the wt_public_id contraints, since the id is currently
defined in the worker config, but this will soon change and the worker's id will be generated by the
controller.

* Updating server_id references to controller_id.

* Adding worker tag db writing test.

* Move the server table back to the top.

* Update comment for the worker object.

* Update comment for the worker table.

* Update the newWorkerId call to take a context and fix its error.

* Correct comment for the wt_network_address domain.
2022-05-18 17:03:24 -07:00
Todd 472d7d520a Remove the server_id from session table, change it to worker_id on session_connection (#2070)
* Remove the server_id from session table, change it to worker_id on session_connection

This is step 1 in updating the worker table.  The worker is becoming a public resource so it must have
a public id.  We drop the server_id column on the session_connection table and add the worker_id column
so we can use the wt_public_key type.  Since db migrations are applied while the controller is offline,
it should be safe to assume all session connections are not in a running state, thus allowing us to null
out all the worker ids in the session_connection table.

For now we don't have very good enforcement of the wt_public_id constraints, since the id is currently
defined in the worker config, but this will soon change and the worker's id will be generated by the
controller.
2022-05-16 15:14:12 -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 ab4d542fad Add multihop auth support (#32) 2022-05-09 13:50:53 -04:00