Skip to content

Commit

Permalink
backport of commit 3b31b3e
Browse files Browse the repository at this point in the history
  • Loading branch information
ryancragun authored Nov 22, 2024
1 parent ae907dc commit 7516a71
Show file tree
Hide file tree
Showing 32 changed files with 536 additions and 65 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ jobs:
include: ${{ fromJSON(needs.artifacts.outputs.testable-packages) }}
with:
build-artifact-name: ${{ matrix.artifact }}
runs-on: ${{ github.repository == 'hashicorp/vault' && '"ubuntu-latest"' || '["self-hosted","linux","small"]' }}
sample-max: 1
sample-name: ${{ matrix.sample }}
ssh-key-name: ${{ github.event.repository.name }}-ci-ssh-key
Expand Down
181 changes: 135 additions & 46 deletions .github/workflows/test-run-enos-scenario-matrix.yml

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion enos/enos-descriptions.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ globals {
Vault running in Agent mode uses templates to create log output.
EOF

verify_log_secrets = <<-EOF
Verify that the vault audit log and systemd journal do not leak secret values.
EOF

verify_raft_cluster_all_nodes_are_voters = <<-EOF
When configured with a 'backend:raft' variant, verify that all nodes in the cluster are
healthy and are voters.
Expand Down Expand Up @@ -198,7 +202,7 @@ globals {
EOF

verify_billing_start_date = <<-EOF
Verify that the billing start date has successfully rolled over to the latest billing year if needed.
Verify that the billing start date has successfully rolled over to the latest billing year if needed.
EOF

}
Expand Down
7 changes: 6 additions & 1 deletion enos/enos-modules.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,12 @@ module "vault_wait_for_seal_rewrap" {
vault_install_dir = var.vault_install_dir
}

module "verify_log_secrets" {
source = "./modules/verify_log_secrets"

radar_license_path = var.vault_radar_license_path != null ? abspath(var.vault_radar_license_path) : null
}

module "verify_seal_type" {
source = "./modules/verify_seal_type"

Expand All @@ -363,4 +369,3 @@ module "vault_verify_billing_start_date" {
vault_instance_count = var.vault_instance_count
vault_cluster_addr_port = global.ports["vault_cluster"]["port"]
}

16 changes: 16 additions & 0 deletions enos/enos-qualities.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,10 @@ quality "vault_audit_log" {
description = "The Vault audit sub-system is enabled with the log and writes to a log"
}

quality "vault_audit_log_secrets" {
description = "The Vault audit sub-system does not output secret values"
}

quality "vault_audit_socket" {
description = "The Vault audit sub-system is enabled with the socket and writes to a socket"
}
Expand Down Expand Up @@ -490,6 +494,10 @@ quality "vault_init" {
description = "Vault initializes the cluster with the given seal parameters"
}

quality "vault_journal_secrets" {
description = "The Vault systemd journal does not output secret values"
}

quality "vault_license_required_ent" {
description = "Vault Enterprise requires a license in order to start"
}
Expand Down Expand Up @@ -532,6 +540,14 @@ quality "vault_proxy_cli_access" {
EOF
}

quality "vault_radar_index_create" {
description = "Vault radar is able to create an index from KVv2 mounts"
}

quality "vault_radar_scan_file" {
description = "Vault radar is able to scan a file for secrets"
}

quality "vault_raft_voters" {
description = global.description.verify_raft_cluster_all_nodes_are_voters
}
Expand Down
28 changes: 28 additions & 0 deletions enos/enos-scenario-agent.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,34 @@ scenario "agent" {
}
}

step "verify_log_secrets" {
skip_step = !var.vault_enable_audit_devices || !var.verify_log_secrets

description = global.description.verify_log_secrets
module = module.verify_log_secrets
depends_on = [
step.verify_secrets_engines_read,
]

providers = {
enos = local.enos_provider[matrix.distro]
}

verifies = [
quality.vault_audit_log_secrets,
quality.vault_journal_secrets,
quality.vault_radar_index_create,
quality.vault_radar_scan_file,
]

variables {
audit_log_file_path = step.create_vault_cluster.audit_device_file_path
leader_host = step.get_vault_cluster_ips.leader_host
vault_addr = step.create_vault_cluster.api_addr_localhost
vault_root_token = step.create_vault_cluster.root_token
}
}

step "verify_ui" {
description = global.description.verify_ui
module = module.vault_verify_ui
Expand Down
28 changes: 28 additions & 0 deletions enos/enos-scenario-autopilot.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,34 @@ scenario "autopilot" {
}
}

step "verify_log_secrets" {
skip_step = !var.vault_enable_audit_devices || !var.verify_log_secrets

description = global.description.verify_log_secrets
module = module.verify_log_secrets
depends_on = [
step.verify_secrets_engines_read,
]

providers = {
enos = local.enos_provider[matrix.distro]
}

verifies = [
quality.vault_audit_log_secrets,
quality.vault_journal_secrets,
quality.vault_radar_index_create,
quality.vault_radar_scan_file,
]

variables {
audit_log_file_path = step.create_vault_cluster.audit_device_file_path
leader_host = step.get_updated_vault_cluster_ips.leader_host
vault_addr = step.upgrade_vault_cluster_with_autopilot.api_addr_localhost
vault_root_token = step.create_vault_cluster.root_token
}
}

step "raft_remove_peers" {
description = <<-EOF
Remove the nodes that were running the prior version of Vault from the raft cluster
Expand Down
28 changes: 28 additions & 0 deletions enos/enos-scenario-proxy.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,34 @@ scenario "proxy" {
}
}

step "verify_log_secrets" {
skip_step = !var.vault_enable_audit_devices || !var.verify_log_secrets

description = global.description.verify_log_secrets
module = module.verify_log_secrets
depends_on = [
step.verify_secrets_engines_read,
]

providers = {
enos = local.enos_provider[matrix.distro]
}

verifies = [
quality.vault_audit_log_secrets,
quality.vault_journal_secrets,
quality.vault_radar_index_create,
quality.vault_radar_scan_file,
]

variables {
audit_log_file_path = step.create_vault_cluster.audit_device_file_path
leader_host = step.get_vault_cluster_ips.leader_host
vault_addr = step.create_vault_cluster.api_addr_localhost
vault_root_token = step.create_vault_cluster.root_token
}
}

step "verify_ui" {
description = global.description.verify_ui
module = module.vault_verify_ui
Expand Down
28 changes: 28 additions & 0 deletions enos/enos-scenario-seal-ha.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,34 @@ scenario "seal_ha" {
}
}

step "verify_log_secrets" {
skip_step = !var.vault_enable_audit_devices || !var.verify_log_secrets

description = global.description.verify_log_secrets
module = module.verify_log_secrets
depends_on = [
step.verify_secrets_engines_read,
]

providers = {
enos = local.enos_provider[matrix.distro]
}

verifies = [
quality.vault_audit_log_secrets,
quality.vault_journal_secrets,
quality.vault_radar_index_create,
quality.vault_radar_scan_file,
]

variables {
audit_log_file_path = step.create_vault_cluster.audit_device_file_path
leader_host = step.get_updated_cluster_ips.leader_host
vault_addr = step.create_vault_cluster.api_addr_localhost
vault_root_token = step.create_vault_cluster.root_token
}
}

step "verify_ui" {
description = global.description.verify_ui
module = module.vault_verify_ui
Expand Down
28 changes: 28 additions & 0 deletions enos/enos-scenario-smoke.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,34 @@ scenario "smoke" {
}
}

step "verify_log_secrets" {
skip_step = !var.vault_enable_audit_devices || !var.verify_log_secrets

description = global.description.verify_log_secrets
module = module.verify_log_secrets
depends_on = [
step.verify_secrets_engines_read,
]

providers = {
enos = local.enos_provider[matrix.distro]
}

verifies = [
quality.vault_audit_log_secrets,
quality.vault_journal_secrets,
quality.vault_radar_index_create,
quality.vault_radar_scan_file,
]

variables {
audit_log_file_path = step.create_vault_cluster.audit_device_file_path
leader_host = step.get_vault_cluster_ips.leader_host
vault_addr = step.create_vault_cluster.api_addr_localhost
vault_root_token = step.create_vault_cluster.root_token
}
}

step "verify_ui" {
description = global.description.verify_ui
module = module.vault_verify_ui
Expand Down
31 changes: 31 additions & 0 deletions enos/enos-scenario-upgrade.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,37 @@ scenario "upgrade" {
}
}

step "verify_log_secrets" {
// Only verify log secrets if the audit devices are turned on and we've enabled the check (as
// it requires a radar license). Some older versions have known issues so we'll skip this step
// in the event that we're upgrading from them, see VAULT-30557 for more information.
skip_step = !var.vault_enable_audit_devices || !var.verify_log_secrets || semverconstraint(var.vault_upgrade_initial_version, "=1.17.3 || =1.17.4 || =1.16.7 || =1.16.8")

description = global.description.verify_log_secrets
module = module.verify_log_secrets
depends_on = [
step.verify_secrets_engines_read,
]

providers = {
enos = local.enos_provider[matrix.distro]
}

verifies = [
quality.vault_audit_log_secrets,
quality.vault_journal_secrets,
quality.vault_radar_index_create,
quality.vault_radar_scan_file,
]

variables {
audit_log_file_path = step.create_vault_cluster.audit_device_file_path
leader_host = step.get_updated_vault_cluster_ips.leader_host
vault_addr = step.create_vault_cluster.api_addr_localhost
vault_root_token = step.create_vault_cluster.root_token
}
}

step "verify_raft_auto_join_voter" {
description = global.description.verify_raft_cluster_all_nodes_are_voters
skip_step = matrix.backend != "raft"
Expand Down
12 changes: 12 additions & 0 deletions enos/enos-variables.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,12 @@ variable "vault_product_version" {
default = null
}

variable "vault_radar_license_path" {
description = "The license for vault-radar which is used to verify the audit log"
type = string
default = null
}

variable "vault_revision" {
description = "The git sha of Vault artifact we are testing"
type = string
Expand All @@ -199,3 +205,9 @@ variable "vault_upgrade_initial_version" {
type = string
default = "1.13.13"
}

variable "verify_log_secrets" {
description = "If true and var.vault_enable_audit_devices is true we'll verify that the audit log does not contain unencrypted secrets. Requires var.vault_radar_license_path to be set to a valid license file."
type = bool
default = false
}
2 changes: 1 addition & 1 deletion enos/modules/build_local/scripts/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
## Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

Expand Down
2 changes: 1 addition & 1 deletion enos/modules/install_packages/scripts/install-packages.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

Expand Down
2 changes: 1 addition & 1 deletion enos/modules/softhsm_create_vault_keys/scripts/get-keys.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

Expand Down
2 changes: 1 addition & 1 deletion enos/modules/softhsm_init/scripts/init-softhsm.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

Expand Down
2 changes: 1 addition & 1 deletion enos/modules/softhsm_install/scripts/find-shared-object.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
## Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

Expand Down
2 changes: 1 addition & 1 deletion enos/modules/vault_upgrade/scripts/restart-vault.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

Expand Down
Loading

0 comments on commit 7516a71

Please sign in to comment.