Commit Graph
470 Commits
Author SHA1 Message Date
Jim d4e537c88d chore: updgrade pgx direct deps to v5 (#3258) 2023-06-01 08:59:38 -04:00
Jim 536551dc0c fix: update go-dbw dep and refactor conversion of pgx errors (#3242) 2023-05-31 20:23:33 -04:00
Timothy Messier 61a37ef4a4 fix(schema): Add missing endpoint column to session recording view 2023-05-31 15:53:16 +00:00
Timothy Messier f53d65eacd refact(sql): Rename migrations to avoid number conflicts 2023-05-31 12:18:23 +00:00
Todd 4063880bbe Add credential history views 2023-05-31 12:18:22 +00:00
Michael Gaffney a783c91b2d feat(sql): Add dynamic credential hst tables to session recording
This adds the `recording_dynamic_credential` join table and a trigger
that runs as an after insert on the `recording_session` table. The join
table joins the `recording_session`, `credential_vault_store_hst`,
`credential_library_history_base`, and the `credential_purpose_enm`
tables.
2023-05-31 12:18:19 +00:00
Michael Gaffney 3769f0851c test(sql): Refactor the colors persona
This changes multiple IDs in the colors persona to be 12 characters. It
also renames some IDs in an attempt to make them more consistent. This
also changes the order of the columns in some insert statements to
follow the pattern of the other insert statements.

This also adds documentation to the top of colors persona file in an
attempt to explain the general patterns being followed in the file.
2023-05-31 12:18:19 +00:00
Michael Gaffney 03b1291b34 feat(sql): Add history tables for dynamic credentials
This adds history tables for `credential_vault_store`,
`credential_vault_library`, and `credential_vault_ssh_cert_library`.
This also adds a base table for the credential library history tables.
2023-05-31 12:18:19 +00:00
Todd e1540be9f3 Add host information to session recording view 2023-05-31 12:18:18 +00:00
Michael Gaffney a8224f4f57 feat(sql): Add endpoint from session table to session recording
This adds an `endpoint` column to the `recording_session` table and
updates the session recording insert trigger to copy the value of
`endpoint` from the `session` table to the `recording_session` table.
2023-05-31 12:18:18 +00:00
Michael Gaffney 06e4e46248 feat(sql): Add static credential hst tables to session recording
This adds the `recording_static_credential` join table and a trigger
that runs as an after insert on the `recording_session` table. The join
table joins the `recording_session`, `credential_static_store_hst`,
`credential_static_history_base`, and the `credential_purpose_enm`
tables.
2023-05-31 12:18:18 +00:00
Michael Gaffney 3a64fb3d58 feat(sql): Add history tables for static credentials
This adds history tables for `credential_static_store`,
`credential_static_json_credential`,
`credential_static_username_password_credential`, and
`credential_static_ssh_private_key_credential`. This also adds a base
table for the static credential history tables.
2023-05-31 12:18:18 +00:00
Todd 386eac072c Add recording_channel_ssh_aggregate view 2023-05-31 12:18:18 +00:00
Johan Brandhorst-Satzkorn 11893a8885 db: add state and error_details to recording 2023-05-31 12:18:17 +00:00
Johan Brandhorst-Satzkorn af8e4d63be db: add channel summary details 2023-05-31 12:18:17 +00:00
Todd ee6a5f05b5 Add historical target and scope information to session recording 2023-05-31 12:18:17 +00:00
Michael Gaffney 477e6df269 feat(sql): Add target and host history tables to session recording
This adds four columns to the `recording_session` table which are
foreign keys to the `iam_scope_hst`, `target_ssh_hst`,
`host_history_base`, and `host_catalog_history_base` tables. The foreign
key to the `iam_scope_hst` table references the project scope of the
target at the time of the recording.
2023-05-31 12:18:17 +00:00
Michael Gaffney 73b710cd06 refactor(sql): Rename session recording migration
This renames the migration with the session recording table to come
after the history table migrations. This allows the session recording
table to have foreign key references to the history tables without using
alter table statements.
2023-05-31 12:18:17 +00:00
Michael Gaffney 37c6b8e540 feat(sql): Add history tables for hosts
This adds history tables for `static_host` and `host_plugin_host`. This
also adds a base table for the host history tables.

This also adds a new test to the history table test suite. The new test
verifies the contents of each history table against the contents of
their operational table.
2023-05-31 12:18:16 +00:00
Michael Gaffney b97dc07bb0 feat(sql): Add history tables for host catalogs
This adds history tables for `static_host_catalog` and
`host_plugin_catalog`. This also adds a base table for the host catalog
history tables and an immutable table with one row for when a target has
a direct address assigned to it.

This also adds a reusable trigger function for tables that are
immutable.
2023-05-31 12:18:16 +00:00
Michael Gaffney 7ebe393aee feat(sql): Add history table for target_ssh
This adds a history table for `target_ssh`.

This also fixes a bug in the history table test suite. Prior to this
change, the operational table name was calculated from the history table
name using the SQL trim() function. The SQL trim function as used
returned 'targe' for 'target_ssh_hst' instead of the expected value
'target_ssh'.
2023-05-31 12:18:16 +00:00
Todd d365123045 add session recording aggregate view 2023-05-31 12:18:16 +00:00
Louis Ruch 7263d08bc5 feat(storage): Add target storage_bucket relation 2023-05-31 12:18:15 +00:00
Timothy Messier 21f6be9ab5 refact(sql): Move migrations to avoid number conflict 2023-05-31 12:18:15 +00:00
Michael Gaffney 882b7eca2f feat(sql): Add IAM history table references to session recording
This adds two columns to the `recording_session` table. One column is a
foreign key to the `iam_user_hst` table and the other is a foreign key
to the `iam_scope_hst` table. The foreign key to the `iam_scope_hst`
table reference the IAM scope the user belongs to at the time of the
recording.
2023-05-31 12:18:14 +00:00
Michael Gaffney 9fd01a79f0 refactor(sql): Move and rename session recording migration
This moves and renames the migration with the session recording table to
come after the history table migrations. This allows the session
recording table to have foreign key references to the history tables
without using alter table statements.
2023-05-31 12:18:14 +00:00
Michael Gaffney 4488f5f8cd refactor(sql): Move and rename history table migrations
This moves and renames the history table migration files into the
correct migration directory.
2023-05-31 12:18:14 +00:00
Michael Gaffney 463f1e36af feat(sql): Add history table for iam_user
This adds a history table for `iam_user`.
2023-05-31 12:18:14 +00:00
Michael Gaffney 8ae658a570 feat(sql): Add history table and triggers for iam_scope
This adds a history table for `iam_scope`. It also includes reusable
triggers to maintain the included history table and future history
tables.

This also includes a test suite that runs on any table ending in `_hst`.
2023-05-31 12:18:14 +00:00
Michael Gaffney 327d950a1e feat(sql): Add function to generate a URL safe ID
This adds a SQL function that generates a secure random ID of at least
14 characters suitable for use as a public or private ID. IDs generated
with the function will only contain characters from the unreserved
character set defined in RFC 3986 Section 2.3 making them safe for use
in a URL.
2023-05-31 12:18:14 +00:00
Michael Gaffney 94f77d36b3 feat(sql): Add a domain type for URL safe IDs
This creates a new domain in SQL that constrains the characters of an ID
to the unreserved character set defined RFC 3986 Section 2.3.
2023-05-31 12:18:13 +00:00
Michael Gaffney 647cf0d33d feat(sql): Add URL safe base64 encoding function
This adds a SQL function to encode binary data into the URL safe base64
encoding defined in RFC 4648.
2023-05-31 12:18:13 +00:00
Danielle Miu a4a14fc7fc merged commit for plugin rework, storage bucket sql and proto, storage bucket secret rewrapping, storage bucket repository 2023-05-31 12:18:13 +00:00
Johan Brandhorst-Satzkorn 7bb44b46f5 internal/db: add session recording tables
Add the following new tables used for storing session recordings:

* recording_session
* recording_connection
* recording_channel
* recording_channel_ssh
* storage_bucket
2023-05-31 12:18:10 +00:00
ace2def49d Add daily sessions pending view and accompanying snapshot table (#3217)
* feat: add a new daily billing view

* update views and table based on early feedback

* address review comments

* update CTE to be an accurate result of what we expect

* remove 'with time zone' from daily range

* remove timezone

* Update internal/db/schema/migrations/oss/postgres/70/01_hcp_billing_daily.up.sql

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

* Apply suggestions from code review

Co-authored-by: Timothy Messier <tim.messier@gmail.com>

* go mod updates

* fix tests

---------

Co-authored-by: Michael Gaffney <mgaffney@users.noreply.github.com>
Co-authored-by: Timothy Messier <tim.messier@gmail.com>
2023-05-24 15:52:34 -04:00
Jeff Mitchell bbe9719e19 Add tracking of worker used for injection (#3204) 2023-05-05 09:22:54 -04:00
Haotian 762e0d7d0d fix(sql): move added file to correct folder (#3197)
* move rename_constraints.up.sql from 67 to 69

* update sql replacement reference comments
2023-05-01 13:16:10 -07:00
Haotian b806297afe style(db): rename constraint names to follow sql style guide (#2973)
* programatically rename unique and foreign key constraints to enforce 'tablename_uq' and 'reftable_fkey' patterns

* manually rename unique constraints for names over 63 characters

* update changed constraint names in db update testcases
2023-05-01 12:40:10 -07:00
Jeff Mitchell 20391e3503 Add default client port to targets and use in connect command (#2767) 2023-04-21 06:50:53 -04:00
Johan Brandhorst-Satzkorn ecdb77b584 internal/db/sqltest: fix sessions aggregate (#3152)
The sessions aggregate was inserting host_id and host_set_id,
columns which are no longer present on the session table. Also
fix the test that guards against regressions like this in the future.
2023-04-05 12:57:25 -04:00
Hugo Vieira 2ff9b8efac feat(host/plugin): Support External Name field
The new `ExternalName` field is an optional field that is used to store
the cloud providers' human-identifiable name for a given compute
instance. This field is not user-editable, but it is kept in sync with
the cloud provider's through Boundary's `SetSyncJob`.
2023-04-04 18:51:04 +01:00
Johan Brandhorst-Satzkorn bc31892f29 internal/db: add set_once_columns function (#3117)
* internal/db: add set_once_columns function

Also replace existing before_soft_delete_credential_vault_store
function and trigger with the new function.

* internal/db/schema: add note to replaced definitions
2023-03-28 13:35:26 -04:00
Jim 63a2b62b85 chore (deps): update GKW and protobuf; and run "make gen" (#3111) 2023-03-22 14:32:52 -04:00
Jim 86192f75eb feature (auth/ldap): add LDAP auth method along with associated accounts and managed groups (#2912)
* feature (auth): required schema changes for auth ldap method (#2669)

chore (auth/ldap): move schema changes to next avail migration number

* feature (auth/ldap): define AuthMethod and all its value objects (#2703)

* feature (auth/ldap): storage protos
* feature (auth/ldap): define AuthMethod and all its value objects

* feature (auth/ldap): add repo and reading an auth method (#2718)

* feature (auth/ldap): add Repository.CreateAuthMethod(...) and Repository.DeleteAuthMethod(...) (#2724)

* feature (auth/ldap): add Repository.UpdateAuthMethod(...) (#2739)

* feature (auth/ldap): add Account

* feature (auth/ldap): add AuthMethod.EnableGroups

* fix (auth/ldap): refactor AuthMethod.oplog to enforce proper constraints

* feature (auth/ldap): add Account repo functions

* refactor (auth/ldap): remove entry attributes from account

Realized the entry attributes could have absolutely anything in them
(including binary data) and since we absolutely don't have to have them
there's just no reason to take on the risk.

* feature (auth/ldap): add AuthMethod.UseTokenGroups

* feature (auth/ldap): add Authenticate(...)

* refactor (auth/ldap): ensure options take a context as the 1st parameter

* feature (auth/ldap): add Account attribute maps

* chore (auth/ldap): make fmt deltas

* feature (auth/ldap): add managed groups (#2760)

* tests (auth/ldap): add missing unit test to Repository.DeleteAccount(...)

Add bits to test the delete operation when you're not able to generate
oplog metadata

* feature (auth/ldap): add managed groups

fixup! feature (auth/ldap): add managed groups (#2760)

* feature (auth/ldap): service proto definition (#2761)

* feature (handlers/authmethods): add handlers for ldap auth method operations (#2794)

* feature (auth/ldap): add Account attribute maps

* chore (auth/ldap): update cap/ldap to latest version

* feature (auth/ldap): add ldap api generation definitions

* feature (authmethods): add ldap repo NewService(...)

* feature (authmethods/ldap): add proper mask_mapping to protobufs

* feature (authmethods): add support to get an ldap auth method

* refactor (auth/ldap): export TestGenerateCA(...)

* feature (authmethods): add support to create an ldap auth method

* feature (authmethods): add support to delete an ldap auth method

* feature (authmethods): add support to list ldap auth methods

* refactor (auth/ldap): make urls optional for NewAuthMethod(...)

* refactor (auth/ldap): export ldap.TestInvalidPem

* chore: make fmt changes

* fix (auth/ldap): properly handle group search config

Add constraints and tests to ensure when an ldap AuthMethod.EnableGroups
is true, and UseTokenGroups is false; that there's a GroupDn configured
for finding a user's associated groups

* feature (authmethods): add support to update an ldap auth methods

* chore (db/ldap): tmp mv migrations so there's no conflict with ongoing work

* feature (verifier): add ldap auth method to verifier bits

* fix (controller): prevent panic when controller stops when there's no listener

* feature (authmethods): add support to authenticate via ldap auth methods

* chore (migrations): fix whitespace in stmt

* chore: fmt fixup

* tests (auth/ldap): invalid err msg

* feature (cli/authmethods): add support for ldap auth-methods CRUD and authenticate (#2810)

* feature (authmethods): add CLI support for ldap auth methods CRUD

* tests (api/auth): ldap auth method classification tests

* feature (authmethods): add CLI support for ldap auth authenticate

* feature (auth/ldap): set request timeouts for ldap server connections

* feature (handlers/authmethods): handle u_anon listing properly.

* feature (account/handers): ldap account and managed group CRUDL APIs (#2852)

* feature (auth/ldap) add repository Listing of ManagedGroupMemberAccount

* feature (controller/handlers): add ldapRepoFn to accounts service

* feature (auth/ldap) register ldap managed group subtype

* feature (account/handlers): ldap account CRUDL APIs

* feature (controller/handlers): add ldapRepo to managed groups service

* feature (account/handlers): ldap managed group CRUDL APIs

* docs (domain): add LDAP accounts, auth-methods and managed groups (#2857)

* feature (ldap/cli) add ldap accounts and managed groups CRUDL commands (#2856)

* fix (handlers/authmethods): fix ldap authorized actions (#2892)

* feature (cli/ldap/authenticate): use primary auth method if none is provided (#2890)

* fix (auth/ldap): support setting the state attribute

* feature (cli/ldap/authenticate): use primary auth method if none is provided

* feature (wh/ldap) add tests for new ldap auth method and accounts (#2919)

* refactor (migrations/ldap): mv to correct directory

* chore: add copyright headers

* fix (api/authmethods/ldap): renumber new LdapAuthMethodAttributes field

* fix (auth/ldap): allow the auth method state to be updated (#2951)

* chore: update sdk and api versions for llb - this is tmp until merging

* tests (managed groups): add required errContains for new test
2023-03-15 11:40:40 -04:00
Irena Rindos ab0a2ad689 Fix hcp billing test (#3045)
* fix test failure
2023-03-02 12:02:16 -05:00
Irena Rindos 860af44556 Fix sql tests failing on the first of the month (#3042)
* initial commit
2023-03-01 19:14:57 -05:00
Hugo 41b1b5b4b7 feat(db): Introduce migrations for ssh targets (#2960)
Adds the schema for ssh targets. This also changes the target listing
func to not error out when it encounters a target with an unknown type.
Instead, it now ignores it and continues to the next one.
2023-02-21 16:31:22 -05:00
Timothy Messier 5c19dba3c9 ci(sqltest): Add github action workflow for sql tests (#2977) 2023-02-16 14:37:48 -05:00
Johan Brandhorst-Satzkorn 3c29308673 chore: Add license headers to all files 2023-02-03 15:54:27 -08:00
Timothy Messier 6a41bf1237 feat(wh): Support vault ssh certificate credentials
This expands the wh_credential_dimension to include fields for the new
vault ssh certificate credential library.
2023-02-02 17:43:17 +00:00