Commit Graph
1396 Commits
Author SHA1 Message Date
Todd Knight 715982148f Create Plugin Host Set Handler for Create, List, Get (#1518) 2021-09-13 15:02:04 -07:00
Todd Knight e208800f77 Merge branch 'main' into plugin-hostcatalogs 2021-09-10 15:40:21 -07:00
Timothy Messier 30736b3bcd Merge branch 'tmessi/faster-testing' 2021-09-10 08:08:02 -04:00
Todd Knight 4f09f1d74f Add create, list, lookup functions for plugin based host catalogs (#1515)
Create the repository for plugin host catalogs.  A large TODO is left in the code to interface with the plugin system once ready.
2021-09-09 11:15:14 -07:00
Todd Knight 1249f9668f Add Plugin Host Set Repo Create, List, Read Operations (#1497)
Add repo for plugin based host sets as well as tests.
2021-09-09 10:45:41 -07: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 ecdcf72e0e ci: Update Makefile with new targets for testing
This updates the test-ci target to startup the test database container
first, wait for it to be ready, and then start running the tests.

It also creates some new targets for local devs. Prior to running any
tests either via `make test` or `go test`, the database should be
started with:

    make test-database-up

It can take a few seconds for the database to fully initialize, the
status can be checked with:

    docker logs -f boundary-sql-tests

This database can be stopped and destroyed with:

    make test-database-down

In general it should only need to be restarted when new migrations are
added. But it might also be necessary to restart if some tests fail in
an unexpected way and fail to do cleanup steps.
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
Timothy Messier af5d1af568 test: Add dbtest package
This is modeled after the internal/docker package to make it easy to use as a
replacement. Instead of creating a new docker container for each test,
it will create a new database in an existing database container, using a
template database as a source. This assumes that the template database
exists and already has the schema migrations run against it.

The default template is `boundary_template` which should already have
all migrations applied. However, some tests require an empty database to
test the migration code. In these cases the `template1` template
database should be used, ie:

    dbtest.StartWithTemplate("postgres", dbtest.WithTemplate("template1"))
2021-09-09 13:42:00 -04:00
Timothy Messier c6cb7c8512 chore: Define custom docker image for tests
This images is built from the official postgres docker image, but with
updates to optimize the test execution:

- A config file for postgres to increase the performance of the
  test server.
- An initialization script to create a template database with all
  migrations run against it.

There are new make targets to build and publish this docker image.
The image can be pulled with:

    docker pull hashicorpboundary/postgres:13-alpine

To use this image for tests start the container:

    make -C internal/db/docker database-up
2021-09-09 13:42:00 -04:00
Susmitha Girumala 811d0b63fd Bump doc download versions to latest (#1517) 2021-09-09 12:38:55 -04:00
Todd Knight 7769452f3b Merge branch 'alanknight-hostplugin-repo' into plugin-hostcatalogs 2021-09-08 17:03:14 -07:00
Todd Knight ce26b0d981 merging type of 2 arguments into a single declaration. 2021-09-08 16:59:54 -07:00
Todd Knight a78f16c969 Adding back accidentally removed tests and removing accidentally re-added proto messages. 2021-09-08 16:58:24 -07:00
Todd Knight 8104ecb3d5 Fix comments describing the requirements of the arguments to CreatePlugin. 2021-09-08 16:47:11 -07:00
Todd Knight 1237d05232 Create a repository to create, lookup, and list host plugins. 2021-09-08 16:41:41 -07:00
Randall MoreyandSusmitha Girumala 7746916d59 chore: bump UI version for release (#1514)
Co-authored-by: Susmitha Girumala <susmitha@hashicorp.com>
2021-09-08 16:08:36 -04:00
Todd KnightandMichael Gaffney db9e1106a9 feat(host): Add host plugin related schemas and tests (#1475)
* feat(host): Add host plugin related schemas and tests

This adds the schema files for host plugins, plugin based catalogs and
plugin based sets.  This also adds the protos and tests which utilize
gorm to ensure the schemas enforce the constraints we expect.

Along with this change was a migration which moved catalog names to the
base type table so we can ensure all catalogs in a single scope,
regardless of subtype, have a unique name.

* Updated plugin schemas to do the following:
- Add plugin_executable table
- plugin table now also has scope_id and name w/ uniqueness constraints
- host_plugin no longer has id_prefix column
- host_plugin separates name and plugin_name
- plugin_version table renamed version to symantic_version column.

* Fix typo in delete_plugin_subtype trigger.  Add update test for host plugins.

* Update id prefixes. Fix public_id typos in protos and plugin_executable name in sql diagrams.

* Created internal/plugin and moved base plugin structs to it and moved host plugin subdirectory to it.

* Created internal/plugin and moved base plugin structs to it and moved host plugin subdirectory to it.

* Add first pass at enums for OS and Arch supported by plugin executables.

* Capitalizing the const enums for OS and Architectures.

* Add comments to sql files.

* Reviewer comments.

Remove unsupported OSes and Archs from SQL and go constants.
Add missing tests.

* Be more permissive in the values the db accepts.

The go logic can restrict which values it will allow getting populated into the db.

* Removing constraints on which values can be placed inside operating_system and architecture columns.

* Updating test helper functions to only create a single catalog or set.

* Move files to new migration version.

* Fixing job/plugin test.

* Update table names, named a number of constraints, remove plugin version and executable tables.

* Add constraints for plugin name and id prefix.

* Rename constraint, remove unhelpful comment block.

* Adding semantic version to plugin_host and set attributes to not null.

* Remove semantic versioning from all locations.

* Remove semantic_version from plugin_host table comment.

* Fix op copy/paste error. Don't use deprecated errors methods. Update constraint names.  Add docs.

* Apply suggestions from code review

Fixing constraint names.

Co-authored-by: Michael Gaffney <mgaffney@users.noreply.github.com>
2021-09-08 10:06:38 -07:00
Jeff Mitchell 71cba858e3 Add secrets to host catalogs API struct (#1512)
This also changes the address from a plugin from a scalar value to other
fields, starting with an IP address array.
2021-09-08 12:41:57 -04:00
Jeff Mitchell 361d568550 Merge branch 'main' into plugin-hostcatalogs 2021-09-08 12:20:41 -04:00
Jeff Mitchell 68867ef01e Update api/sdk tags 2021-09-08 12:17:20 -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 d5a3c6c3b8 Merge branch 'main' into plugin-hostcatalogs 2021-09-07 22:16:29 -04:00
Jeff Mitchell d7a990b62b Bump api/sdk in main module 2021-09-07 22:16:20 -04:00
Jeff Mitchell 8d8290b83e Remove unneeded replace directive 2021-09-07 22:15:16 -04:00
Jeff Mitchell f141b806d8 Merge branch 'main' into plugin-hostcatalogs 2021-09-07 22:13:29 -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
Chris Marchesi ad8839e6de Move protobufs to sdk/pbs/plugin (#1506) 2021-09-07 13:27:53 -07:00
Kevin Wang 3fc2cf4df5 chore(website): add next-remote-watch (#1499)
- this enables auto-reloading on specified file changes
2021-09-07 15:29:19 -04:00
Randall Morey 700ed0b138 chore: bump ui (#1508) 2021-09-07 15:16:03 -04:00
Jeff Mitchell 2074c478e0 Merge branch 'main' into plugin-hostcatalogs 2021-09-07 12:49:24 -04:00
Louis Ruch 61722659d1 test(scheduler) Remove un-needed test causing intermittent failures (#1501) 2021-09-04 07:30:31 -07:00
Jim 02c0764e11 chore: update product version and make packages 2021-09-03 15:48:28 -04:00
Randall Morey ffc01b141d chore: bump UI version and add UI changelog (#1503) 2021-09-03 15:45:15 -04:00
Jim 6ad8333b97 chore: update sdk and api deps 2021-09-03 15:00:17 -04:00
Jim 48c6195829 chore (api): update sdk dep 2021-09-03 14:52:09 -04:00
Jim 5fe40bc7bd style (events): add changes from make fmt in prep for release. 2021-09-03 14:35:42 -04:00
Todd Knight 56dd053ea6 Merge branch 'main' into plugin-hostcatalogs 2021-09-03 09:42:40 -07:00
Louis Ruch 4cdce29a84 fix(connect): Remove erroneous event error message (#1500)
When a session is terminated by the user, the cancel session path is
triggered, in this path the websocket connection is closed.  If the
connection is already closed, an EOF is returned. In this situation an
EOF is expected and should not be logged to the user.

Example log line:
{
  "id": "ezqk6w9dOQ",
  "source": "https://hashicorp.com/boundary/dev-controller/boundary-dev",
  "specversion": "1.0",
  "type": "error",
  "data": {
    "error": "failed to close WebSocket: failed to read frame header: EOF",
    "error_fields": {},
    "id": "e_n60YPsDkaj",
    "version": "v0.1",
    "op": "worker.(Worker).handleProxy",
    "info": {
      "msg": "error closing client connection"
    }
  },
  "datacontentype": "text/plain",
  "time": "2021-09-02T10:05:46.587513-07:00"
}
2021-09-02 12:24:12 -07:00
Jeff Mitchell 2c61bd4963 Fix recursive listing when the ingress scope lacks permissions (#1478)
The existing logic was to ignore Forbidden errors when recursively
listing in favor of looking for downstream scopes with appropriate
permissions. The problem is that when there is actually no
authentication token at all, what comes back is an Unauthenticated
error. Therefore if you didn't have permissions on the ingress scope
(e.g. the default of `global`) but did downstream for the anonymous
user, you'd get back an error.

I don't think there's any security issue with doing this; the user could
always have simply started the search at a downstream scope to begin
with so nothing more is being revealed, this just fixes behavior to
match expectations in this case.

A test was added for one of the services; the code is exactly the same
across them. The reason that the existing tests that were added with the
output fields testing didn't catch this is that even though they were
specifying `u_anon` as the user, the disabled test context skipped the
logic that would return a 401 in this case. It turns out that fixing
this is very complicated because we don't have a great way in most tests
of defining grants to put onto the generated scopes, so even if a true
anonymous context was added each test would require the anonymous user
to have list permissions on whatever resource was under test, requiring
a lot of role and grant and principal finagling. This is probably a good
longer-term TODO but not one that seemed worth it for this fix.

Fixes ICU-2301
2021-09-02 12:55:04 -04:00
Jeff Mitchell 781871c30d Properly accept grant format type=<type>;output_fields=<of> (#1474)
Although we document that this is allowed, and the ACL code handles it,
some of the validation code did not. This would cause a semi
intermittent problem because that validation code is used only in some
code paths; specifically we skip it (for now) to avoid erroring out on
some deprecated grant string formats when reading grants from the DB,
but we use it to error out when validating incoming grants.
2021-09-02 12:54:02 -04:00
Louis Ruch 030c09c6b9 bug(targets): Fix panic in authorize-session (#1496)
When renaming credential libraries -> credential sources
the target service added the credential library information
to the SessionCredential response, while the target cmd was
parsing the credential source.

This prevents a panic like the following:

    boundary targets authorize-session -id ttcp_5PS2dktESb
    panic: runtime error: invalid memory address or nil pointer dereference
    [signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x1f99a31]

    goroutine 1 [running]:
    github.com/hashicorp/boundary/internal/cmd/commands/targetscmd.printCustomActionOutputImpl(0xc00046c0a0)
    	/Users/louisruch/boundary/internal/cmd/commands/targetscmd/funcs.go:822 +0x9d1
    github.com/hashicorp/boundary/internal/cmd/commands/targetscmd.(*Command).Run(0xc00046c0a0, {0xc000134030, 0x2, 0x2})
    	/Users/louisruch/boundary/internal/cmd/commands/targetscmd/targets.gen.go:324 +0x188b
    github.com/mitchellh/cli.(*CLI).Run(0xc0001c6500)
    	/Users/louisruch/go/pkg/mod/github.com/mitchellh/cli@v1.1.2/cli.go:262 +0x5f8
    github.com/hashicorp/boundary/internal/cmd.RunCustom({0xc000134010, 0x60, 0x0}, 0x0)
    	/Users/louisruch/boundary/internal/cmd/main.go:186 +0x9d6
    github.com/hashicorp/boundary/internal/cmd.Run(...)
    	/Users/louisruch/boundary/internal/cmd/main.go:92
    main.main()
    	/Users/louisruch/boundary/cmd/boundary/main.go:13 +0xc9

Fixes #1488
2021-09-01 09:16:47 -07:00
Louis Ruch db8e9bb0c6 refactor(worker): refactors the proxy handler to use endpoint scheme (#1491) 2021-09-01 07:22:45 -07:00
Chris Marchesi 2132040260 Fix host_plugin_service.proto; run make gen 2021-08-31 16:57:06 -07:00
Todd Knight 252d64f364 Merge branch 'main' into plugin-hostcatalogs 2021-08-31 16:42:35 -07:00
Chris MarchesiandTodd Knight 2c097c2f38 sdk: add host plugin protobufs and interface (#1473)
* sdk: add host plugin protobufs and interface

This adds the protobufs and interface for the upcoming plugin-based host
feature for boundary, providing a common interface for building targets
and host catalogs off of dynamic cloud data.

* Fix signature formatting and separate out/flesh out descriptions

* sdk: re-gen with protobuf v3.15.8

* sdk: update protobuf according to @talanknight's comments

* Update internal/proto/local/plugin/host_catalog.proto

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

* Add TODO for host catalog persisted data for size limits

* sdk: move id to external_id and make protobuild

* Move plugin interface to GRPC service

This re-uses existing protobufs where possible, a few more messages have
been created for persisted data and for the host response where it's
important that we make it clear that the external ID is *not* the same
ID as the calculated stable ID for the host within Boundary.

* Update internal/proto/local/plugin/host_plugin_service.proto

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

* Move proto target to plugin/proto, fix formatting

Co-authored-by: Todd Knight <T.Alan.Knight@gmail.com>
2021-08-31 16:34:51 -07:00
Rolf Sommerhalder b599bb5eb2 Adjust syntax in example (#1476) 2021-08-31 13:29:04 -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
Timothy Messier 06ce257cb8 Merge branch 'tmessi/wh-refactors' 2021-08-30 15:45:09 -04:00
Timothy Messier 90e2c871f0 refactor(wh): Remove host prefix from wh_user_dimension org fields
These fields are being refactored so they conform with the new
wh_credential_dimension. This will inform Business Intelligence tools
that these attributes conform across dimensions.
2021-08-30 14:25:30 -04:00