Commit Graph
170 Commits
Author SHA1 Message Date
Jim 48c6195829 chore (api): update sdk dep 2021-09-03 14:52:09 -04:00
Jeff Mitchell f8a51b987c Migrate target host sets -> host sources (#1424)
This follows the same model as https://github.com/hashicorp/boundary/pull/1413

See there and CHANGELOG for more details.
2021-07-30 08:48:03 -04:00
ab6f3eaeb4 Migrate credential-library nomenclature around targets to credential-source (#1413)
See the CHANGELOG entry for more information.

Co-authored-by: Jim <jlambert@hashicorp.com>

Co-authored-by: Michael Gaffney <mgaffney@users.noreply.github.com>
2021-07-27 12:48:36 -04:00
Jeff Mitchell 528d54b4ad Add token/userinfo claims to account read output (#1419)
This is very useful when trying to write managed groups filters as you
can directly look at the structure of the claims for the accounts you're
trying to filter.

The output of the claims in text format on the CLI currently leaves
something to be desired. I started revamping some of the formatting
functions and it quickly got very fragile. Fundamentally at this point
we're likely better off -- now that we have a good idea what our output
format/standards are like -- rewriting the formatting code. I'll take
that as a tasker as I have a lot of ideas...
2021-07-26 17:52:18 -04:00
Jeff Mitchell 5b7544c81f Update API against shared libs and sdk 2021-07-14 17:24:06 -07:00
Jeff Mitchell 2cbcf9a563 Update usage of shared-secure-libs (#1393) 2021-07-12 21:06:22 -04:00
Jeff Mitchell 7c3d5be4f6 Update format of secret to return both raw and decoded when possible (#1372) 2021-06-30 18:02:03 -04:00
Jim 4c0276b4af update sdk dep 2021-06-29 07:05:08 -04:00
Jeff Mitchell 86c9a90554 Update target credential library service, API, SDK, CLI (#1343) 2021-06-25 14:06:31 -04:00
df35699c4e Integrate with Vault to retrieve and manage per session credentials (#1308)
* Fix down migrations

* Udpates due to merge

* Sentinel values only have to be greater than 0

* Create credential related sdk structs and methods.

* Post merge interface updating.

* Removing scratch code that was not cleaned up.

* updates

* Convert client certificate and client certificate keys into pem blocks and validate.

* Add newline at end of file.

* Faster check for "s" at the end of a resource name when generating from templates.

* make fmt

* updates

* Add dynamic credentials to a session

* Refactor: move contents of file

* updates

* Updates

* Add InvalidDynamicCredential error

* Assign credentials

* Allow updating client certificates seperate from the client certificate key.

* Replace application purpose string with enum value

* PR feedback / fix go test .

* Delete dead code

* Use common view

* Refactor: extract interface and rename method

* Refactor: move code to eliminate privPurpLibrary

* Add comment to requestMap

* Refactor: do not export methods on an unexported struct

* Update internal/db/schema/migrations/postgres/10/03_vault_credential.up.sql

Co-authored-by: Michael Gaffney <mgaffney@users.noreply.github.com>

* Add comments to credential Purpose constants

* Reorder switch statements to handle errors first

* PR feedback

* update

* fix merge

* Organizing the scheduler code and extract the individual store creation test helper function.

* Run 'make fmt'

* Create certificate when creating store.  Allow vault address to be passed in as option

* Refactor: rename database views and associated structs

This change renames two database views and associated go structs to use
a consistent naming pattern. Views ending in 'private' contain encrypted
credentials needed for connecting to Vault. Views ending in 'public'
mirror the 'private' views but do not include any encrypted values.

This change does not include any changes to functionality or behavior.

* Adding SAD target operations for credential libraries to the SDK.

* Add status field and enumeration table for credential status

* Refactor: rename Status to TokenStatus

* Add status to vault credentials

* Creating the template for the CLI and helper functions.

* Add private database view for vault credentials

* Add scope_id to view and cleanup TODO comment

* Reformat embedded sql queries

* Add vault client helpers

* updates

* white space

* Add LookupLease test

* CLI commands for Store work.  Renamed fields in proto w/ vault prefix.

* Test issue credentials with client TLS

* Add additional checks to vault ping

* Add an error for vault token capabilities and create a VaultToken error kind

* Add support for working with Vault policies

* Use Vault 1.7.2 for testing

* Add testing helper for creating a vault client with a non-root token

* Fix Vault renew lease test

The Vault renew lease endpoint accepts an optional duration parameter
for requesting the number of seconds to extend the lease by. However,
Vault is not required to honor this request.

* Add a var for the required capabilities of a boundary Vault token

* Enhance the test helper for adding a policy to Vault

* Allow the test role in postgresql to revoke credentials

* Remove out of date comments

* Enhance Vault test helpers for the database secrets engine

* Reformat comments

* Add a method for getting the capabilities of the current Vault token

* Add revoke lease to internal Vault client

* Reformat: combine err return line with check for nil line

* Remove redundant checks in test code

Remove checks in test code that are redundant with checks in the test
harness.

* Refactor CreateToken test helper to return the secret and the token

* Fix build failures caused by signature change in vault.CreateToken

* Fix Vault version and Vault API link in comments

* ran `make gen` after merging from mgaffney-vault.

* Remove Vault prefix from attribute fields in API, create a base CLI option for adding field prefixes. format now uses that prefix for error reporting.

* Template now allows attaching attribute field prefixes.

* Credential store uses PrefixAttributeFieldErrorsWithSubactionPrefix.

* Fixing naming of vault flags and helper flags.

* Updating more references to generated api methods.

* Make the capabilities String method more readable

* Add comment outlining PrintApiError usage of Options.

* Refactor test to move declarations closer to first use

* Fix comment

* Implement revoke method on vault repository

* Tests now verify certs, CA, and tokens, addresses can be updated in a store.

* Added test for creating store with pk/cert in same field.

* Allo updating certificates seperate from private key.  Only contact backing vault service when updating token.

* Fixing bad tests and removing unused code.

* Adding tests for various ways of updating tokens.

* Add private credential

* Add token revocation job and cred renewal/revocation job

* Regen after merge.

* Fixing field mask related merge error.

* Create Library CLI. Removes vault prefix from path. Adds a WithoutCleanup testOption for vault.

* Set all credentials to revoked when a token is revoked

* Fixing missed renaming update.

* fix copy/paste error.

* Fixing code generation errors after merge.

* make gen after merge.

* Update internal/cmd/commands/credentialstorescmd/vault_funcs.go

Co-authored-by: Michael Gaffney <mgaffney@users.noreply.github.com>

* Update internal/cmd/commands/credentialstorescmd/vault_funcs.go

Co-authored-by: Michael Gaffney <mgaffney@users.noreply.github.com>

* Update internal/cmd/commands/credentialstorescmd/vault_funcs.go

Co-authored-by: Michael Gaffney <mgaffney@users.noreply.github.com>

* Refactor: move migrations from 10 to 12

* Removing logic from transaction.

* wrapping client errors in the calling op for CredentialStore's client() method.

* Redact token

* redact client key

* updates

* Add trigger to revoke credentials when session is canceled or terminated

* Fixing some help text for some flags.

* Add ability to load values from files (file://) or environment variables (env://).

* Updating comments

* fix bad merge

* feedback

* Adding issued credentials to sessions.

* Error on capabilities

* updates

* Expose NewVaulTestServer

* Add godoc

* Adding generated SessionCredential struct for API.

* Progress on building handler test for Authorize Session.

* feedback

* Update policies

* Add 'revoke' as a status for Vault Tokens

* Add delete_time to vault credential store

* Create dynamic credentials at session creation time.

* Tests pass with credentials attached to AuthorizedSession result.

* Only call issue if there are credentials to issue.

* Fixing output only issues. Adding type to credential library.

* Fix test to clear un/pw generated.  confirm generated un/pw changes from 1 authorize session call to another.

* Update lookupTokenError

* Add delete_time to private credential store

* Refactor: move private store to separate file

* Fixing tests for AuthorizeSession and verifying error cases.

* Only create the credential repo if there are credentials to issue.

* Rename Library field to CredentialLibrary.

* Fixing missing change of Library to CredentialLibrary.

* Removing Default SDK functions for fields which are required and update CLI to match.

* Replace resource specific id variables with "id" and the input parmater for paths to be just a single string and the resource name as it should show up in the path.

* Soft delete vault credential stores

* Prevent new SQL functions from silently overwriting existing functions

* Rename "Hmac" to "HMAC" in the human readable cli response table.

* Fix tests

* Add vault database cleanup jobs

* Add ability to set the token period in the vault test harness

* updates

* Add not_null_columns func test

* remove unused struct

* Up no output timeout

* Validate current vault token on addr update

* Fix client cert change test

* add cert test

* Update revocation job where

* Fix comment

* Use Vault's default port in CLI help strings

* Remove down migrations

* Increase migration file numbers by 1

* Run make migrations

* Move migrations from 12 to 10

* Increase Circle CI timeout for acceptance tests

* Fix spelling mistake in error messages

* ASD cmds for Target and returning credentials to AuthSession request (#1338)

* Add Add/Set/Remove commands for libraries on Targets.  Return credentials on AuthorizeSession request.

Co-authored-by: Michael Gaffney <mgaffney@users.noreply.github.com>

Co-authored-by: Louis Ruch <louisruch@gmail.com>
Co-authored-by: Todd Knight <T.Alan.Knight@gmail.com>
Co-authored-by: Jeff Mitchell <jeffrey.mitchell@gmail.com>
2021-06-22 22:26:26 -04:00
Jeff Mitchell 306d4fb4d3 Add API/CLI for managed groups (#1265) 2021-06-02 14:05:10 -04:00
Jeff Mitchell 179a49657e Managed Groups service (#1262) 2021-06-02 14:01:37 -04:00
Jim 2437cdcc8d OIDC: add support for account claim maps (#1186) 2021-05-04 08:41:04 -04:00
Jim 25e657fa51 Ongoing OIDC: support to request additional OIDC scopes from the IdP (#1175) 2021-04-28 06:53:13 -04:00
Jeff Mitchell 4690225c1e Update delete action behavior and JSON format output (#1155)
This PR changes delete behavior:

* On success, a 204 is returned rather than a 200 with an empty JSON object
* The CLI now passes through the 404 error if encountered instead of swallowing it

It also updates formatting for JSON to use the response body, which means that the item (or items) in the JSON format are actually the format across the wire, instead of being reinterpreted by unmarshaling into the Go SDK and then remarshaling.
2021-04-26 20:38:55 -04:00
Jeff Mitchell 77a85636c2 If we're going to use replace directives, use SDK too 2021-04-21 12:05:37 -04:00
Jim 75108cbc8b Ongoing OIDC: return the primary account info along with the user. (#1145) 2021-04-20 20:33:56 -04:00
Jeff Mitchell 941e74388a Fix curl string building (#1106)
I'm not sure why it was doing it the other way with assuming the string
being built would always have a space at the end, but, this way is
easier to understand and fixes a bug where there wasn't a space being
left between some fields.
2021-04-13 16:08:51 -04:00
Todd Knight 14c222709c Make oidc auth callback redirect on most errors (#1105) 2021-04-13 09:21:26 -07:00
Todd Knight 71673ea161 Pass disable_discovered_config_validation in the API change-state call (#1100) 2021-04-12 08:49:22 -07:00
Jeff Mitchell f05f37d0fa Fix panic in non-generated API calls when printing as JSON (#1095)
Fixes #992
2021-04-09 13:09:51 -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 6605b4c9f8 Revamp authenticate (#1025) 2021-03-24 16:07:43 -04:00
Jeff Mitchell 845f582213 Update api's sdk 2021-03-09 13:52:44 -05:00
Jeff Mitchell 519efa6dd1 Add -filter to CLI listing and website docs (#967)
* Add -filter to CLI listing.

This doesn't include docs/Changelog yet, that will come shortly.

* Add changelog

* Add website docs and fix a curl output bug
2021-03-01 09:23:17 -08:00
Jeff Mitchell f5490e95a6 Sync API deps to main in preparation for tag 2021-02-25 12:41:18 -05:00
Jeff Mitchell ea23737258 Port over API bits from #962 (#965) 2021-02-25 12:39:51 -05:00
Todd Knight cac1e60e11 Add filters to listing different resources in the go sdk. (#957) 2021-02-22 13:31:17 -07:00
Jeff Mitchell 46f0f55a28 Update SDK in API 2021-02-12 11:46:02 -05:00
Kevin Maris 8a8b2fb8e1 Fix nil TLSClientConfig (#901) 2021-02-02 20:50:30 -05:00
Jeff Mitchell 9879841e00 Update SDK in API 2021-01-29 18:28:52 -05:00
Jeff Mitchell 6cd97a4a6e Add support for recursive listing (#885) 2021-01-25 19:37:40 -05:00
Jeff Mitchell 6b58a3317d Add recursive listing to roles (#881)
This also lays the framework for adding recursive listing to the rest of the resources.
2021-01-23 13:39:04 -05:00
Jeff Mitchell 717a3b52ee Add worker tagging (#862)
This allows workers to have tags assigned to them, which can then be filtered to control which targets they are allowed to serve.
2021-01-21 16:27:20 -05:00
Jeff Mitchell dcb15cffbd Add authorized actions output on resources (#870) 2021-01-20 10:53:01 -05:00
Jeff Mitchell 27919ab11b Groundwork for returning authorized actions (#860)
This returns authorized actions on targets to users when they perform an operation on a target, including listing. It also prevents users from seeing values in listing targets on which they have no permissions.
2021-01-13 14:42:37 -05:00
Jeff Mitchell 9de928318d Skip curl output when using automatic versioning and reading (#858)
This makes it so that the actual output is the update/delete.

Fixes #856
2021-01-08 17:30:41 -05: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 d4a6efb363 Pass endpoint to the client (#811)
This allows us to automatically set TLS parameters, useful for `boundary
connect http` and some other features to come.
2020-12-09 14:45:53 -05:00
Todd Knight aa4157639c Change Format of API Error (#784)
This is a wire breaking change for json errors since we have removed and renamed a few fields, and changed part of the structure of the returned json error.

* Remove redundant fields in Status, details.error_id, details.TraceId and details.request_id from API errors.

* Added wrapped errors and "ops" field to indicate the internal operation of the errors returned by the API.

* Added error cli error reporting of Op and wrapped errors.
2020-12-07 14:25:16 -07:00
Jeff Mitchell 813d21565f Allow authorize-session to be invoked with target name (#737) 2020-10-22 08:40:00 -04:00
Jeff Mitchell 09b865ab28 Add pass cred storage support (#731)
* Add `pass` cred storage support

Make it the default on non-Windows/macOS

Document the token storage behavior
2020-10-21 09:00:17 -04:00
Jim b8c527c6cd handle v1 as a prefix/suffix, not just a cut set to be trimmed (#723) 2020-10-17 19:01:24 -04:00
Todd Knight abe5e9b950 Add Termination Reason (#573) 2020-10-07 21:37:30 -04:00
Jeff Mitchell 5bc8c8d921 Fix API test 2020-10-07 21:35:43 -04:00
Jeff Mitchell 26e86ef56a Update API deps 2020-10-07 14:16:48 -04:00
Jeff Mitchell fc09e2c21b Remove api mod dep for now 2020-10-07 14:11:06 -04:00
Jeff Mitchell 6993d10118 Update main's api/sdk mods 2020-10-07 14:05:50 -04:00
Jeff Mitchell 5cbfcf8eb6 Shuffle things around out of new modules 2020-10-07 14:03:42 -04:00
Jeff Mitchell 23f7306b62 Add api module 2020-10-07 13:55:55 -04:00