Commit Graph
4633 Commits
Author SHA1 Message Date
Todd 61f9d1f6af Add update set handler and sdk functionality (#1684) 2021-11-11 14:32:15 -07:00
Jim 1ac151100e docs (internal/db): Add docs Update/Delete operations using WithWhere (#1687) 2021-11-11 16:13:44 -05:00
Todd 29b4537d3b Reference PreferredEndpoints by top level struct name (#1688)
* Reference PreferredEndpoints by top level struct name instead of embedded proto GetPreferredEndpoint method.

Reorganize the sql files a little.

* Make PreferredEndpoints replayable. Test refactoring to remove variables that persist across test calls. DeleteItems instead of trying to use WithWhere.
2021-11-11 13:51:52 -07:00
Jeff Mitchell 30e9f944a2 Add sync interval to host sets (#1680)
This adds a parameter to host sets allowing the sync interval to be
user-specified on a per-host-set basis. A value of -1 disables syncing;
a value of null uses the current default.
2021-11-11 11:28:08 -05:00
Todd Knight dba7c6b531 Fix value of op constant for syncSets 2021-11-11 08:29:13 -07:00
Chris Marchesi c2cd6febca internal/host/plugin: add UpdateSet (#1686)
* internal/host/plugin: add UpdateSet

This adds the UpdateSet repository function.

UpdateSet runs the OnUpdateSet plugin call within the transaction as per
the changes in #1683.

The plugin call returns the updated set, the hosts in the set, the rows
updated, and any error.

* Ensure that attributes can be cleared by supplying a full null

* move version increment to the end and track perferred endpoint update separately

* move plugin call to end of transaction

* only clone returned set once, and move host fetch call out of transaction

* Request a sync when attributes are updated

* Add test to assert that old preferred endpoints are being removed correctly
2021-11-10 17:08:42 -08:00
Todd Knight 772bb88d8d Updating the aws plugin dependency. 2021-11-10 15:42:51 -07:00
Todd Knight b14302e762 Updating the azure plugin dependency. 2021-11-10 15:30:40 -07:00
Jeff Mitchell 3a5f0a2981 Update plugin 2021-11-10 15:20:48 -05:00
Jeff Mitchell 5c09db5e4a Update plugin 2021-11-10 15:18:45 -05:00
Jeff Mitchell 962c9463fd Update SDK/API modules 2021-11-10 15:11:57 -05:00
Jeff Mitchell 3f3f6d974c Update API go.mod to require Go 1.17 2021-11-10 15:10:18 -05:00
Jeff Mitchell 0ea3ff03c4 Update SDK go.mod to require Go 1.17 2021-11-10 15:09:55 -05:00
Todd 2229d1a819 Call OnCreate or OnUpdate on the plugin after db constraints are checked (#1683)
* Only call the Plugin at create/update time after the db has been partially updated. This allows more constraints to be checked prior to calling the plugin.
2021-11-10 09:04:29 -07:00
Todd 050553ffcf Add update catalog support for plugin based catalogs in handler and go sdk (#1673)
* Create catalog service handler for updating plugin.  Add tests for handler and run make fmt. Silently drop attributes where the value is nil when creating the catalog or set.
2021-11-09 14:42:48 -07:00
Jim c047c4d89d refactor (db): Remove the internal/db test tables from the migrations (#1675) 2021-11-09 11:58:57 -05:00
Jim 048fceaf54 feature (workers): Add audit events for worker requests (#1681)
* feature (audit events): Add interceptor for auditing worker requests

* feature (events): Add default deny filter for worker status events

* feature (worker audit events): Add tags to SessionService req/resp
2021-11-09 11:43:41 -05:00
Carlos Alcaide Corvo aa8f216f4f Add redirect to managed groups domain model documentation (#1682) 2021-11-09 11:35:18 -05:00
Jim b96f57ec4e fix (events): Only "sign" audit events (#1677)
* chore: Update eventlogger dependency.

We need the latest version, so we can limit the type of events
that are signed.

* fix (events): Only "sign" audit events
2021-11-08 13:29:16 -05:00
Jeff Mitchell 48ac8b8f0b Merge branch 'main' into plugin-hostcatalogs 2021-11-07 18:47:28 -05:00
Jeff Mitchell b0642344b9 Update Go version to 1.17.3 (#1674) 2021-11-06 11:32:29 -04:00
Jim eecd878b36 feature: Add signing (hmac-sha256) of audit entries (#1666) 2021-11-05 20:44:33 -04:00
DevOps Rob 55ab75f364 updating db init without generated resources example (#1493) 2021-11-05 17:18:43 -04:00
Chris Marchesi 157f1a091b internal/host/plugin: add update catalog test for empty/same description (#1672)
This is to mainly get coverage on the empty description case, but it
follows the same logic as the "update name to same" test.
2021-11-05 14:05:52 -07:00
Timothy Messier 242e353f18 fix(schema): Prevent duplicate versions per edition (#1670)
This should help prevent issues like the one fixed in
f2ad4de554.

A version for a particular edition should only exist once, previously
which ever file was read last for a version would be included, which
would lead to some migrations not running.
2021-11-05 14:57:10 -04:00
Chris MarchesiandTodd 0670e272e3 internal/host/plugin: Add UpdateCatalog (#1634)
* internal/host/plugin: Add UpdateCatalog

This adds support for updating plugin-based host catalogs.

The workflow is:

* The existing catalog is fetched.
* Any attribute changes are patched against it, along with other changes
  such as name and description.
* Both the existing catalog, and the state of the catalog as it will
  exist post-update, along with any persisted secrets, are sent to the
  plugin via an OnUpdateCatalog request.

Upon success, the following is done:

* The record is updated if non-secret updates need to be made.
* Secrets are updated if they still exist.
* If an empty secret set was sent back, secrets are instead deleted.
* If the secrets field was instead null, secret update is skipped
  altogether.

There has also been a lot of helper code added to the tests to help make
the update tests more readable and reduce boilerplate. While the create
tests have not been updated to use these new helpers, it might be a good
idea to do so for consistency.

* move secret/persisted state closer to plugin call

* Update internal/host/plugin/repository_host_catalog.go

Co-authored-by: Todd <T.Alan.Knight@gmail.com>

* Update internal/host/plugin/repository_host_catalog_test.go

Co-authored-by: Todd <T.Alan.Knight@gmail.com>

* move all test helpers for UpdateCatalog inline

* WIP - transparent attributes struct/wire conversion

* Revert "WIP - transparent attributes struct/wire conversion"

This reverts commit 31af1b1b7e535119aa23bd0aa936da1a80eb5aa2.

* deal with multiple attribute masks

* Note TODO for upsertQuery for HostCatalogSecret

* add version check guard

* Update internal/host/plugin/host_catalog_secret.go

Co-authored-by: Todd <T.Alan.Knight@gmail.com>

* remove redundant JIRA reference

* don't separate number of updated catalogs and secrets

* increment version when secrets is the only thing being updated

* add another test for updating both catalog and secrets at once

* correct comment for mock plugin manager section

* add first-part path matching for secrets

* update plugin lookup error to return errors.Internal

* only add name/description to plugin request if they are non-empty

* update duplicate tests to use two project scopes

* remove unused test checks

* return plugin record along with host catalog in update

* move away from using passed in catalog after patching newCatalog

* use t.Cleanup() instead of defer

Co-authored-by: Todd <T.Alan.Knight@gmail.com>
2021-11-05 10:43:58 -07:00
Jim b6ad76e4d2 fix (db): Clean up tests a bit (#1669) 2021-11-05 08:51:12 -04:00
Chris Marchesi 165cc5ef1b fix ineffectual assignment to err in DeleteCatalog (#1664)
Was being caught by my linters. Looks like the error wasn't being
checked after getCatalog.
2021-11-04 17:09:32 -07:00
Jim f2ad4de554 fix (migrations): Adjust migration numbers to remove dups (#1667) 2021-11-04 15:34:56 -04:00
Todd 54bccf3674 Mask manager can now include mask paths w/ a specified prefix which would be filtered otherwise (#1654)
* Update the mask manager to always allow fields containing a prefix which matchs a passedThroughPrefix.

This will be useful when updating plugin based host catalog and sets since attributes and secrets cannot be contained in the mask manager mapping.
2021-11-04 10:43:08 -07: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 80d41b9044 Merge branch 'main' into plugin-hostcatalogs 2021-11-04 09:02:39 -04:00
Jim dd2c3807cd refactor: Move functions from kms pkg to new libs/crypto pkg (#1650) 2021-11-04 08:55:30 -04:00
Jeff Mitchell a37e4f08c8 Update aws plugin 2021-11-03 21:22:57 -04:00
Kevin Wang a86ee59bcd chore: react-subnav (#1663) 2021-11-03 17:07:00 -04:00
Chris Marchesi 1bc9a07316 populate correct field for host catalog secret (#1661) 2021-11-03 13:16:45 -07:00
Jeff Mitchell 03de1c4b21 Pass namespace to the Vault client (#1660)
The namespace was plumbed all the way through the API but isn't actually
set on the client when it is created.

Fixes #1597
2021-11-03 14:52:11 -04:00
Jim 4df3b40def feature (db): Add support for multi-column PKs (#1658) 2021-11-03 14:04:47 -04:00
Jeff Mitchell b9269ce93c Update available actions for host resource (#1659) 2021-11-03 12:39:41 -04:00
Todd 1ff2968409 Warehouse contains "Unsupported" host_address for plugin based hosts (#1656)
* Populating the warehouse with the host_address from a plugin basd host is unsupported.

* Adding test for plugin hosts in the datawarehouse.
2021-11-03 07:24:53 -07:00
Hugo 8d3f666bba docs: include boundary-ui dependencies for make dev (#1657) 2021-11-03 13:55:58 +00:00
Timothy Messier ee88e863a3 Merge branch 'tmessi-docker-test-config' (#1652) 2021-11-03 07:45:24 -04:00
Timothy Messier 1a24a0fc2f feat(sqltest): Make container name configurable 2021-11-03 07:44:51 -04:00
Timothy Messier 35a7c4f6e7 feat(dbtest): Make test container name configurable 2021-11-03 07:44:51 -04:00
Todd ec36528e97 Updating dependencies since the host plugins were updated. (#1649) 2021-11-02 20:49:04 -04:00
Todd 808b986834 Read and List Plugin based Hosts (#1655)
* Add ability to read and list hosts.  Tests to follow.

* Add tests for reading and listing as well as validation checks to not modify hosts.

* Add IpAddress and DnsNames to the api resource.  Populate the plugin info.

* Adding go sdk tests for reading and listing hosts and ensuring update and deleting is disallowed.
2021-11-02 14:06:20 -07:00
Timothy Messier decc3ec2cf test(targets): Change test to not depend on response order (#1653)
This test started failing when the order of the list response changed.
Since the order does not matter, this test was updated to not depend on
the order.
2021-11-02 15:38:37 -04:00
Timothy Messier f53772519c Merge branch 'tmessi-target-egress-api-cli' (#1648) 2021-11-02 10:25:48 -04:00
Timothy Messier 7d7d8af694 feat(cli): Add support for egress credentials for targets command 2021-11-01 13:33:54 -04:00
Timothy Messier 1da403a2d2 feat(api): Add support for egress credentials for targets endpoint 2021-11-01 13:33:54 -04:00