Commit Graph

72 Commits

Author SHA1 Message Date
Steven Clark
e3f09b8c6d Update licensing across various source files - 1.13 (#24675)
* Fix licensing on various files

* Update packaging to use BUSL-1.1

* Update offset within config_test_helpers.go

 - Fix a test the same way it's been fixed on main/1.15
2024-01-08 12:24:57 -05:00
hc-github-team-es-release-engineering
2766fa2297 [DO NOT MERGE UNTIL EOY] EOY license fixes 1.13.x (#24391) 2024-01-02 10:35:40 -08:00
hc-github-team-secure-vault-core
1c5ef3cd88 backport of commit 3389a572b9 (#24609) 2023-12-21 00:26:40 +00:00
hc-github-team-secure-vault-core
817e0193a8 backport of commit d6bfe428f3 (#24485)
Co-authored-by: Ryan Cragun <me@ryan.ec>
2023-12-11 21:43:31 +00:00
hc-github-team-secure-vault-core
008943e96e Backport of [QT-627] enos: add pkcs11 seal testing with softhsm into release/1.13.x (#24453)
* [QT-627] enos: add `pkcs11` seal testing with softhsm (#24349)

Add support for testing `+ent.hsm` and `+ent.hsm.fips1402` Vault editions
with `pkcs11` seal types utilizing a shared `softhsm` token. Softhsm2 is
a software HSM that will load seal keys from a local disk via pkcs11.
The pkcs11 seal implementation is fairly complex as we have to create a
one or more shared tokens with various keys and distribute them to all
nodes in the cluster before starting Vault. We also have to ensure that
each sets labels are unique.

We also make a few quality of life updates by utilizing globals for
variants that don't often change and update base versions for various
scenarios.

* Add `seal_pkcs11` module for creating a `pkcs11` seal key using
  `softhsm2` as our backing implementation.
* Require the latest enos provider to gain access to the `enos_user`
  resource to ensure correct ownership and permissions of the
  `softhsm2` data directory and files.
* Add `pkcs11` seal to all scenarios that support configuring a seal
  type.
* Extract system package installation out of the `vault_cluster` module
  and into its own `install_package` module that we can reuse.
* Fix a bug when using the local builder variant that mangled the path.
  This likely slipped in during the migration to auto-version bumping.
* Fix an issue where restarting Vault nodes with a socket seal would
  fail because a seal socket sync wasn't available on all nodes. Now we
  start the socket listener on all nodes to ensure any node can become
  primary and "audit" to the socket listner.
* Remove unused attributes from some verify modules.
* Go back to using cheaper AWS regions.
* Use globals for variants.
* Update initial vault version for `upgrade` and `autopilot` scenarios.
* Update the consul versions for all scenarios that support a consul
  storage backend.
* use MPL-2.0 for branches that are still MPL-2.0

Signed-off-by: Ryan Cragun <me@ryan.ec>
2023-12-08 22:00:01 +00:00
Ryan Cragun
4af9178d7e enos: fix licensing on backported files (#24163)
Signed-off-by: Ryan Cragun <me@ryan.ec>
2023-11-16 12:59:51 -07:00
hc-github-team-secure-vault-core
70cc195561 backport of commit 30a8435499 (#23925)
Co-authored-by: Ryan Cragun <me@ryan.ec>
2023-10-31 15:34:11 -06:00
hc-github-team-secure-vault-core
8a5e6fcc4e backport of commit a46def288f (#23868)
Co-authored-by: Ryan Cragun <me@ryan.ec>
2023-10-26 21:32:45 +00:00
Ryan Cragun
b6281e2bad test: don't run proxy scenario before 1.14.x (#23482)
Signed-off-by: Ryan Cragun <me@ryan.ec>
2023-10-03 14:58:14 -06:00
hc-github-team-secure-vault-core
cfd8a04a86 backport of commit 9afd5e52ae (#23477)
Co-authored-by: Ryan Cragun <me@ryan.ec>
2023-10-03 19:27:17 +00:00
hc-github-team-secure-vault-core
0779ac452d backport of commit 1b321e3e7e (#23411)
Co-authored-by: Ryan Cragun <me@ryan.ec>
2023-09-28 23:31:04 +00:00
hc-github-team-secure-vault-core
72fe98509e backport of commit 807bacbc9c (#23408)
Co-authored-by: Ryan Cragun <me@ryan.ec>
2023-09-28 22:44:23 +00:00
hc-github-team-secure-vault-core
31fdcefacf backport of commit 460b5de47b (#23357)
Co-authored-by: Ryan Cragun <me@ryan.ec>
2023-09-27 23:39:59 +00:00
hc-github-team-secure-vault-core
108d26b363 backport of commit 5cdce48a6a (#23346)
Co-authored-by: Ryan Cragun <me@ryan.ec>
2023-09-27 17:07:31 -06:00
hc-github-team-secure-vault-core
4450198a7e enos: remove old initial version from upgrades (#23323) (#23325)
* Remove old initial versions from the upgrade scenario as they're
  unreliable.
* Ensure that shellcheck is available on runners for linting job.

Signed-off-by: Ryan Cragun <me@ryan.ec>
2023-09-27 19:33:28 +00:00
Ryan Cragun
940272de0f Backport [QT-602] Run proxy and agent test scenarios (#23176) into release/1.13.x (#23303)
* [QT-602] Run `proxy` and `agent` test scenarios (#23176)

Update our `proxy` and `agent` scenarios to support new variants and
perform baseline verification and their scenario specific verification.
We integrate these updated scenarios into the pipeline by adding them
to artifact samples.

We've also improved the reliability of the `autopilot` and `replication`
scenarios by refactoring our IP address gathering. Previously, we'd ask
vault for the primary IP address and use some Terraform logic to determine
followers. The leader IP address gathering script was also implicitly
responsible for ensuring that a found leader was within a given group of
hosts, and thus waiting for a given cluster to have a leader, and also for
doing some arithmetic and outputting `replication` specific output data.
We've broken these responsibilities into individual modules, improved their
error messages, and fixed various races and bugs, including:
* Fix a race between creating the file audit device and installing and starting
  vault in the `replication` scenario.
* Fix how we determine our leader and follower IP addresses. We now query
  vault instead of a prior implementation that inferred the followers and sometimes
  did not allow all nodes to be an expected leader.
* Fix a bug where we'd always always fail on the first wrong condition
  in the `vault_verify_performance_replication` module.

We also performed some maintenance tasks on Enos scenarios  byupdating our
references from `oss` to `ce` to handle the naming and license changes. We
also enabled `shellcheck` linting for enos module scripts.

* Rename `oss` to `ce` for license and naming changes.
* Convert template enos scripts to scripts that take environment
  variables.
* Add `shellcheck` linting for enos module scripts.
* Add additional `backend` and `seal` support to `proxy` and `agent`
  scenarios.
* Update scenarios to include all baseline verification.
* Add `proxy` and `agent` scenarios to artifact samples.
* Remove IP address verification from the `vault_get_cluster_ips`
  modules and implement a new `vault_wait_for_leader` module.
* Determine follower IP addresses by querying vault in the
  `vault_get_cluster_ips` module.
* Move replication specific behavior out of the `vault_get_cluster_ips`
  module and into it's own `replication_data` module.
* Extend initial version support for the `upgrade` and `autopilot`
  scenarios.

We also discovered an issue with undo_logs that has been described in
the VAULT-20259. As such, we've disabled the undo_logs check until
it has been fixed.


* actions: fix actionlint error and linting logic (#23305)
* enos: don't attempt to use the vault proxy command before 1.14

---------

Signed-off-by: Ryan Cragun <me@ryan.ec>
2023-09-27 10:53:35 -06:00
Ryan Cragun
db1c24d904 test: wait for nc to be listening before enabling auditor (#23142) (#23151)
Rather than assuming a short sleep will work, we instead wait until netcat is listening of the socket. We've also configured the netcat listener to persist after the first connection, which allows Vault and us to check the connection without the process closing.

As we implemented this we also ran into AWS issues in us-east-1 and us-west-2, so we've changed our deploy regions until those issues are resolved.

Signed-off-by: Ryan Cragun <me@ryan.ec>
2023-09-18 15:10:12 -06:00
hc-github-team-secure-vault-core
8a37264de0 backport of commit d634700c9e (#22965)
Co-authored-by: Ryan Cragun <me@ryan.ec>
2023-09-11 18:22:18 +00:00
Ryan Cragun
9995ccd003 test: fix release testing from artifactory (#22941) (#22946)
Signed-off-by: Ryan Cragun <me@ryan.ec>
2023-09-08 21:31:11 +00:00
hc-github-team-secure-vault-core
b15098fa96 [QT-506] Use enos scenario samples for testing (#22641) (#22932)
Replace our prior implementation of Enos test groups with the new Enos
sampling feature. With this feature we're able to describe which
scenarios and variant combinations are valid for a given artifact and
allow enos to create a valid sample field (a matrix of all compatible
scenarios) and take an observation (select some to run) for us. This
ensures that every valid scenario and variant combination will
now be a candidate for testing in the pipeline. See QT-504[0] for further
details on the Enos sampling capabilities.

Our prior implementation only tested the amd64 and arm64 zip artifacts,
as well as the Docker container. We now include the following new artifacts
in the test matrix:
* CE Amd64 Debian package
* CE Amd64 RPM package
* CE Arm64 Debian package
* CE Arm64 RPM package

Each artifact includes a sample definition for both pre-merge/post-merge
(build) and release testing.

Changes:
* Remove the hand crafted `enos-run-matrices` ci matrix targets and replace
  them with per-artifact samples.
* Use enos sampling to generate different sample groups on all pull
  requests.
* Update the enos scenario matrices to handle HSM and FIPS packages.
* Simplify enos scenarios by using shared globals instead of
  cargo-culted locals.

Note: This will require coordination with vault-enterprise to ensure a
smooth migration to the new system. Integrating new scenarios or
modifying existing scenarios/variants should be much smoother after this
initial migration.

[0] https://github.com/hashicorp/enos/pull/102

Signed-off-by: Ryan Cragun <me@ryan.ec>
2023-09-08 19:34:27 +00:00
Sarah Thompson
4a4ac6771b cherrypick of a9a4b0b9ff (#22811) 2023-09-06 18:25:51 +01:00
hc-github-team-secure-vault-core
1d716d7a90 backport of commit 6ae9f8d4ed (#22442)
Co-authored-by: Rebecca Willett <47540675+rebwill@users.noreply.github.com>
2023-08-18 16:28:53 +00:00
hc-github-team-secure-vault-core
6884e4dcaa backport of commit 6654c425d2 (#22220)
Co-authored-by: Rebecca Willett <47540675+rebwill@users.noreply.github.com>
2023-08-08 11:10:35 -04:00
hc-github-team-secure-vault-core
3ac2cd37b2 [QT-588] test: fix drift between enos directories (#21695) (#21980)
* Sync missing scenarios and modules
* Clean up variables and examples vars
* Add a `lint` make target for enos
* Update enos `fmt` workflow to run the `lint` target.
* Always use ipv4 addresses in target security groups.

Signed-off-by: Ryan Cragun <me@ryan.ec>
Co-authored-by: Ryan Cragun <me@ryan.ec>
2023-07-20 14:36:28 -06:00
hc-github-team-secure-vault-core
8d13ab49dd backport of commit fd1683698b (#21476)
Co-authored-by: Ryan Cragun <me@ryan.ec>
2023-06-27 16:57:00 +00:00
hc-github-team-secure-vault-core
84d2bb154a enos: use on-demand targets (#21459) (#21463)
Add an updated `target_ec2_instances` module that is capable of
dynamically splitting target instances over subnet/az's that are
compatible with the AMI architecture and the associated instance type
for the architecture. Use the `target_ec2_instances` module where
necessary. Ensure that `raft` storage scenarios don't provision
unnecessary infrastructure with a new `target_ec2_shim` module.

After a lot of trial, the state of Ec2 spot instance capacity, their
associated APIs, and current support for different fleet types in AWS
Terraform provider, have proven to make using spot instances for
scenario targets too unreliable.

The current state of each method:
* `target_ec2_fleet`: unusable due to the fact that the `instant` type
  does not guarantee fulfillment of either `spot` or `on-demand`
  instance request types. The module does support both `on-demand` and
  `spot` request types and is capable of bidding across a maximum of
  four availability zones, which makes it an attractive choice if the
  `instant` type would always fulfill requests. Perhaps a `request` type
  with `wait_for_fulfillment` option like `aws_spot_fleet_request` would
  make it more viable for future consideration.
* `target_ec2_spot_fleet`: more reliable if bidding for target instances
  that have capacity in the chosen zone. Issues in the AWS provider
  prevent us from bidding across multiple zones succesfully. Over the
  last 2-3 months target capacity for the instance types we'd prefer to
  use has dropped dramatically and the price is near-or-at on-demand.
  The volatility for nearly no cost savings means we should put this
  option on the shelf for now.
* `target_ec2_instances`: the most reliable method we've got. It is now
  capable of automatically determing which subnets and availability
  zones to provision targets in and has been updated to be usable for
  both Vault and Consul targets. By default we use the cheapest medium
  instance types that we've found are reliable to test vault.

* Update .gitignore
* enos/modules/create_vpc: create a subnet for every availability zone
* enos/modules/target_ec2_fleet: bid across the maximum of four
  availability zones for targets
* enos/modules/target_ec2_spot_fleet: attempt to make the spot fleet bid
  across more availability zones for targets
* enos/modules/target_ec2_instances: create module to use
  ec2:RunInstances for scenario targets
* enos/modules/target_ec2_shim: create shim module to satisfy the
  target module interface
* enos/scenarios: use target_ec2_shim for backend targets on raft
  storage scenarios
* enos/modules/az_finder: remove unsed module

Signed-off-by: Ryan Cragun <me@ryan.ec>
Co-authored-by: Ryan Cragun <me@ryan.ec>
2023-06-26 16:46:12 -06:00
hc-github-team-secure-vault-core
11a211c631 backport of commit 5de6af6076 (#21439)
Co-authored-by: Ryan Cragun <me@ryan.ec>
2023-06-22 22:40:21 -06:00
hc-github-team-secure-vault-core
737d25348f [QT-572][VAULT-17391] enos: use ec2 fleets for consul storage scenarios (#21400) (#21420)
Begin the process of migrating away from the "strongly encouraged not to
use"[0] Ec2 spot fleet API to the more modern `ec2:CreateFleet`.
Unfortuantely the `instant` type fleet does not guarantee fulfillment
with either on-demand or spot types. We'll need to add a feature similar
to `wait_for_fulfillment` on the `spot_fleet_request` resource[1] to
`ec2_fleet` before we can rely on it.

We also update the existing target fleets to support provisioning generic
targets. This has allowed us to remove our usage of `terraform-enos-aws-consul`
and replace it with a smaller `backend_consul` module in-repo.

We also remove `terraform-enos-aws-infra` and replace it with two smaller
in-repo modules `ec2_info` and `create_vpc`. This has allowed us to simplify
the vpc resources we use for each scneario, which in turn allows us to
not rely on flaky resources.

As part of this refactor we've also made it possible to provision
targets using different distro versions.

[0] https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-best-practices.html#which-spot-request-method-to-use
[1] https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/spot_fleet_request#wait_for_fulfillment

* enos/consul: add `backend_consul` module that accepts target hosts.
* enos/target_ec2_spot_fleet: add support for consul networking.
* enos/target_ec2_spot_fleet: add support for customizing cluster tag
  key.
* enos/scenarios: create `target_ec2_fleet` which uses a more modern
  `ec2_fleet` API.
* enos/create_vpc: replace `terraform-enos-aws-infra` with smaller and
  simplified version. Flatten the networking to a single route on the
  default route table and a single subnet.
* enos/ec2_info: add a new module to give us useful ec2 information
  including AMI id's for various arch/distro/version combinations.
* enos/ci: update service user role to allow for managing ec2 fleets.

Signed-off-by: Ryan Cragun <me@ryan.ec>
Co-authored-by: Ryan Cragun <me@ryan.ec>
2023-06-22 20:11:23 +00:00
hc-github-team-secure-vault-core
5d70ee7b2d backport of commit ddff68c82a (#21229)
Co-authored-by: Ryan Cragun <me@ryan.ec>
2023-06-14 12:39:25 -06:00
hc-github-team-secure-vault-core
e10f7f757e backport of commit 2ec5a28f51 (#21147)
Co-authored-by: Ryan Cragun <me@ryan.ec>
2023-06-12 17:20:08 +00:00
hc-github-team-secure-vault-core
1ebb80c484 backport of commit 27621e05d6 (#21136)
Co-authored-by: Ryan Cragun <me@ryan.ec>
2023-06-12 09:44:27 -06:00
hc-github-team-secure-vault-core
a239eb6a49 backport of commit b0aa808baa (#21113)
Co-authored-by: Ryan Cragun <me@ryan.ec>
2023-06-09 13:35:06 -06:00
hc-github-team-secure-vault-core
3bedf816cb backport of commit b9f9f27e8e (#21037)
Co-authored-by: Jaymala <jaymala@hashicorp.com>
2023-06-06 18:12:37 -07:00
hc-github-team-secure-vault-core
49da62437d backport of commit 8512858583 (#21031)
Co-authored-by: Jaymala <jaymala@hashicorp.com>
2023-06-06 17:34:27 -04:00
hc-github-team-secure-vault-core
375bdbacce backport of commit dbe41c4fee (#21006)
Co-authored-by: Mike Baum <mike.baum@hashicorp.com>
2023-06-06 08:00:30 -04:00
hc-github-team-secure-vault-core
68ae0e8e94 backport of commit 2c9a75b093 (#20977)
Co-authored-by: Mike Baum <mike.baum@hashicorp.com>
2023-06-03 14:43:51 -04:00
hc-github-team-secure-vault-core
1720d3172d backport of commit 0115b5e43a (#20963)
Co-authored-by: Mike Baum <mike.baum@hashicorp.com>
2023-06-02 14:17:30 -04:00
hc-github-team-secure-vault-core
2a3db26994 backport of commit cb23fcd83f (#20608)
Co-authored-by: Ryan Cragun <me@ryan.ec>
2023-05-16 14:38:21 -06:00
Jaymala
b739a5487c [QT-554] Remove Terraform validations from Enos replication scenario (#20586)
cherry-pick of commit #20570

Signed-off-by: Jaymala Sinha <jaymala@hashicorp.com>
2023-05-15 12:28:07 -04:00
hc-github-team-secure-vault-core
b9b773f162 backport of commit 18890322c6 (#20352)
Co-authored-by: Ryan Cragun <me@ryan.ec>
2023-04-25 13:02:50 -06:00
hc-github-team-secure-vault-core
3ca228b738 Backport of enos: always use the initial release during upgrades into release/1.13.x (#20329)
* backport of commit cddbc3f79e
* enos: use artifactory release for auto-pilot upgrade

Signed-off-by: Ryan Cragun <me@ryan.ec>
2023-04-24 19:06:55 +00:00
hc-github-team-secure-vault-core
05ca6d0f39 Backport of [QT-525] and [QT-530] into release/1.13.x (#20158)
* [QT-525] enos: use spot instances for Vault targets (#20037)

The previous strategy for provisioning infrastructure targets was to use
the cheapest instances that could reliably perform as Vault cluster
nodes. With this change we introduce a new model for target node
infrastructure. We've replaced on-demand instances for a spot
fleet. While the spot price fluctuates based on dynamic pricing, 
capacity, region, instance type, and platform, cost savings for our
most common combinations range between 20-70%.

This change only includes spot fleet targets for Vault clusters.
We'll be updating our Consul backend bidding in another PR.

* Create a new `vault_cluster` module that handles installation,
  configuration, initializing, and unsealing Vault clusters.
* Create a `target_ec2_instances` module that can provision a group of
  instances on-demand.
* Create a `target_ec2_spot_fleet` module that can bid on a fleet of
  spot instances.
* Extend every Enos scenario to utilize the spot fleet target acquisition
  strategy and the `vault_cluster` module.
* Update our Enos CI modules to handle both the `aws-nuke` permissions
  and also the privileges to provision spot fleets.
* Only use us-east-1 and us-west-2 in our scenario matrices as costs are
  lower than us-west-1.

Signed-off-by: Ryan Cragun <me@ryan.ec>

* [QT-530] enos: allow-list all public IP addresses (#20304)

The security groups that allow access to remote machines in Enos
scenarios have been configured to only allow port 22 (SSH) from the
public IP address of machine executing the Enos scenario. To achieve
this we previously utilized the `enos_environment.public_ip_address`
attribute. Sometime in mid March we started seeing sporadic SSH i/o
timeout errors when attempting to execute Enos resources against SSH
transport targets. We've only ever seen this when communicating from
Azure hosted runners to AWS hosted machines.

While testing we were able to confirm that in some cases the public IP
address resolved using DNS over UDP4 to Google and OpenDNS name servers
did not match what was resolved when using the HTTPS/TCP IP address
service hosted by AWS. The Enos data source was implemented in a way
that we'd attempt resolution of a single name server and only attempt
resolving from the next if previous name server could not get a result.
We'd then allow-list that single IP address. That's a problem if we can
resolve two different public IP addresses depending our endpoint address.

This change utlizes the new `enos_environment.public_ip_addresses`
attribute and subsequent behavior change. Now the data source will
attempt to resolve our public IP address via name servers hosted by
Google, OpenDNS, Cloudflare, and AWS. We then return a unique set of
these IP addresses and allow-list all of them in our security group. It
is our hope that this resolves these i/o timeout errors that seem like
they're caused by the security group black-holing our attempted access
because the IP we resolved does not match what we're actually exiting
with.

Signed-off-by: Ryan Cragun <me@ryan.ec>

---------

Signed-off-by: Ryan Cragun <me@ryan.ec>
Co-authored-by: Ryan Cragun <me@ryan.ec>
2023-04-23 17:12:59 -06:00
Jaymala
65cb09c75f Add Vault log level support (#19083)
Signed-off-by: Jaymala Sinha <jaymala@hashicorp.com>
2023-02-08 17:41:16 -05:00
Mike Baum
8afa241518 [QT-304] Ensure Chrome is only installed for vault-enterprise UI Test workflows (#19003) 2023-02-06 16:29:33 -05:00
Mike Baum
6b7787c86a [QT-304] Add enos ui scenario (#18518)
* Add enos ui scenario
* Add github action for running the UI scenario
2023-02-03 09:55:06 -05:00
Jaymala
748ee9c7d5 Update replication verification to check connection status (#18921)
* Update replication verification to check connection status

Signed-off-by: Jaymala Sinha <jaymala@hashicorp.com>

* Output replication status after verifying connection

Signed-off-by: Jaymala Sinha <jaymala@hashicorp.com>

---------

Signed-off-by: Jaymala Sinha <jaymala@hashicorp.com>
2023-01-31 16:23:46 -05:00
Hamid Ghaf
86d356e404 enos: default undo-logs to cluster behavior (#18771)
* enos: default undo-logs to cluster behavior

* change a step dependency

* rearrange steps, wait a bit longer for undo logs
2023-01-20 10:25:14 -05:00
Jaymala
88658f2c28 Rename reusable enos-run workflow file (#18757)
* Rename reusable enos-run workflow file

Signed-off-by: Jaymala Sinha <jaymala@hashicorp.com>

* Update Enos README file

Signed-off-by: Jaymala Sinha <jaymala@hashicorp.com>

Signed-off-by: Jaymala Sinha <jaymala@hashicorp.com>
2023-01-18 16:37:38 -07:00
Mike Baum
39211b8772 [QT-441] Switch over to using new vault_ci AWS account for enos CI workflows (#18398) 2023-01-18 16:09:19 -05:00
Josh Brand
1c77309106 Add enterprise resources to CI cleanup (#18758) 2023-01-18 14:14:19 -05:00