Skip to content

Commit 2dc6f89

Browse files
Merge remote-tracking branch 'remotes/from/ce/main'
2 parents 958669c + 8debe72 commit 2dc6f89

File tree

12 files changed

+369
-200
lines changed

12 files changed

+369
-200
lines changed

.github/workflows/test-run-enos-scenario-matrix.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ jobs:
197197
echo 'ENOS_VAR_vault_revision=${{ inputs.vault-revision }}'
198198
echo 'ENOS_VAR_vault_upgrade_initial_version=${{ matrix.attributes.upgrade_initial_version }}'
199199
echo 'ENOS_VAR_verify_aws_secrets_engine=false'
200+
echo 'ENOS_VAR_verify_kmip_secrets_engine=true'
200201
echo 'ENOS_VAR_verify_ldap_secrets_engine=false'
201202
echo 'ENOS_VAR_verify_log_secrets=true'
202203
} | tee -a "$GITHUB_ENV"

changelog/_9394.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:improvement
2+
ui/auth: the role field on the SAML login form now auto-fills from the `role` URL query string parameter
3+
```

enos/enos-modules.hcl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ module "vault_verify_secrets_engines_create" {
333333

334334
aws_enabled = var.verify_aws_secrets_engine
335335
ldap_enabled = var.verify_ldap_secrets_engine
336+
kmip_enabled = var.verify_kmip_secrets_engine
336337
vault_install_dir = var.vault_install_dir
337338
}
338339

@@ -341,6 +342,7 @@ module "vault_verify_secrets_engines_read" {
341342

342343
aws_enabled = var.verify_aws_secrets_engine
343344
ldap_enabled = var.verify_ldap_secrets_engine
345+
kmip_enabled = var.verify_kmip_secrets_engine
344346
vault_install_dir = var.vault_install_dir
345347
}
346348

enos/enos-variables.hcl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,12 @@ variable "verify_aws_secrets_engine" {
205205
default = false
206206
}
207207

208+
variable "verify_kmip_secrets_engine" {
209+
description = "If true we'll verify KMIP secrets engines behavior"
210+
type = bool
211+
default = false
212+
}
213+
208214
variable "verify_ldap_secrets_engine" {
209215
description = "If true we'll verify LDAP secrets engines behavior"
210216
type = bool
Lines changed: 16 additions & 171 deletions
Original file line numberDiff line numberDiff line change
@@ -1,182 +1,27 @@
11
# Copyright (c) HashiCorp, Inc.
22
# SPDX-License-Identifier: BUSL-1.1
33

4-
variable "kmip_listen_address" {
5-
type = string
6-
description = "The KMIP listen address for the Vault server"
7-
default = "0.0.0.0"
4+
module "create_kmip_secret_engine" {
5+
depends_on = [
6+
enos_remote_exec.policy_write_kv_writer,
7+
]
8+
count = var.kmip_enabled ? 1 : 0
9+
source = "./kmip"
10+
11+
integration_host_state = var.integration_host_state
12+
ip_version = var.ip_version
13+
leader_host = var.leader_host
14+
ports = var.ports
15+
vault_addr = var.vault_addr
16+
vault_edition = var.vault_edition
17+
vault_root_token = var.vault_root_token
18+
vault_install_dir = var.vault_install_dir
819
}
920

1021
locals {
11-
kmip_scope_name = "kmip_scope"
12-
kmip_role_name = "kmip_role"
13-
kmip_cert_format = "pem"
14-
kmip_mount_path = "kmip"
15-
16-
// Response data - only access if Vault Enterprise (count > 0)
17-
server_ca = var.vault_edition == "ce" ? "" : enos_remote_exec.kmip_configure[0].stdout
18-
client_cert = var.vault_edition == "ce" ? "" : enos_remote_exec.kmip_generate_certificate[0].stdout
19-
20-
kmip_output = {
21-
server_ca = local.server_ca
22-
client_cert = local.client_cert
23-
test_server_ip = var.integration_host_state.kmip.host.public_ip
24-
port = var.ports.kmip.port
25-
}
22+
kmip_output = var.kmip_enabled ? module.create_kmip_secret_engine[0].kmip : null
2623
}
2724

2825
output "kmip" {
2926
value = local.kmip_output
3027
}
31-
32-
resource "enos_remote_exec" "secrets_enable_kmip_secret" {
33-
environment = {
34-
ENGINE = "kmip"
35-
MOUNT = local.kmip_mount_path
36-
VAULT_ADDR = var.vault_addr
37-
VAULT_TOKEN = var.vault_root_token
38-
VAULT_INSTALL_DIR = var.vault_install_dir
39-
}
40-
41-
// Only perform KMIP operations for Vault Enterprise
42-
// The KMIP secrets engine is not available in Vault CE
43-
count = var.vault_edition == "ce" ? 0 : 1
44-
45-
scripts = [abspath("${path.module}/../../scripts/secrets-enable.sh")]
46-
47-
transport = {
48-
ssh = {
49-
host = var.leader_host.public_ip
50-
}
51-
}
52-
}
53-
54-
resource "enos_remote_exec" "kmip_configure" {
55-
depends_on = [enos_remote_exec.secrets_enable_kmip_secret]
56-
environment = {
57-
MOUNT = local.kmip_mount_path
58-
VAULT_ADDR = var.vault_addr
59-
VAULT_TOKEN = var.vault_root_token
60-
VAULT_INSTALL_DIR = var.vault_install_dir
61-
KMIP_MOUNT = local.kmip_mount_path
62-
KMIP_LISTEN_ADDR = var.kmip_listen_address
63-
KMIP_PORT = var.ports.kmip.port
64-
}
65-
66-
// Only perform KMIP operations for Vault Enterprise
67-
// The KMIP secrets engine is not available in Vault CE
68-
count = var.vault_edition == "ce" ? 0 : 1
69-
70-
scripts = [abspath("${path.module}/../../scripts/kmip/kmip-configure.sh")]
71-
72-
transport = {
73-
ssh = {
74-
host = var.leader_host.public_ip
75-
}
76-
}
77-
}
78-
79-
# Creating KMIP Scope
80-
resource "enos_remote_exec" "kmip_create_scope" {
81-
depends_on = [enos_remote_exec.kmip_configure]
82-
83-
environment = {
84-
REQPATH = "${local.kmip_mount_path}/scope/${local.kmip_scope_name}"
85-
VAULT_ADDR = var.vault_addr
86-
VAULT_INSTALL_DIR = var.vault_install_dir
87-
VAULT_TOKEN = var.vault_root_token
88-
}
89-
90-
// Only perform KMIP operations for Vault Enterprise
91-
// The KMIP secrets engine is not available in Vault CE
92-
count = var.vault_edition == "ce" ? 0 : 1
93-
94-
scripts = [abspath("${path.module}/../../scripts/write.sh")]
95-
96-
transport = {
97-
ssh = {
98-
host = var.leader_host.public_ip
99-
}
100-
}
101-
}
102-
103-
# Creating KMIP Role
104-
resource "enos_remote_exec" "kmip_create_role" {
105-
depends_on = [enos_remote_exec.kmip_create_scope]
106-
107-
environment = {
108-
REQPATH = "${local.kmip_mount_path}/scope/${local.kmip_scope_name}/role/${local.kmip_role_name}"
109-
PAYLOAD = jsonencode({
110-
operation_all = true,
111-
})
112-
VAULT_ADDR = var.vault_addr
113-
VAULT_INSTALL_DIR = var.vault_install_dir
114-
VAULT_TOKEN = var.vault_root_token
115-
}
116-
117-
// Only perform KMIP operations for Vault Enterprise
118-
// The KMIP secrets engine is not available in Vault CE
119-
count = var.vault_edition == "ce" ? 0 : 1
120-
121-
scripts = [abspath("${path.module}/../../scripts/write.sh")]
122-
123-
transport = {
124-
ssh = {
125-
host = var.leader_host.public_ip
126-
}
127-
}
128-
}
129-
130-
# Generating KMIP Certificate
131-
resource "enos_remote_exec" "kmip_generate_certificate" {
132-
depends_on = [enos_remote_exec.kmip_create_role]
133-
134-
environment = {
135-
MOUNT = local.kmip_mount_path
136-
VAULT_ADDR = var.vault_addr
137-
VAULT_INSTALL_DIR = var.vault_install_dir
138-
VAULT_TOKEN = var.vault_root_token
139-
SCOPE_NAME = local.kmip_scope_name
140-
ROLE_NAME = local.kmip_role_name
141-
CERT_FORMAT = local.kmip_cert_format
142-
}
143-
144-
// Only perform KMIP operations for Vault Enterprise
145-
// The KMIP secrets engine is not available in Vault CE
146-
count = var.vault_edition == "ce" ? 0 : 1
147-
148-
scripts = [abspath("${path.module}/../../scripts/kmip/kmip-generate-cert.sh")]
149-
transport = {
150-
ssh = {
151-
host = var.leader_host.public_ip
152-
}
153-
}
154-
}
155-
156-
# Managing KMIP Roles
157-
resource "enos_remote_exec" "kmip_manage_roles" {
158-
depends_on = [enos_remote_exec.kmip_generate_certificate]
159-
environment = {
160-
REQPATH = "${local.kmip_mount_path}/scope/${local.kmip_scope_name}/role/${local.kmip_role_name}"
161-
PAYLOAD = jsonencode({
162-
operation_activate = true,
163-
operation_create = true,
164-
operation_get = true
165-
})
166-
VAULT_ADDR = var.vault_addr
167-
VAULT_INSTALL_DIR = var.vault_install_dir
168-
VAULT_TOKEN = var.vault_root_token
169-
}
170-
171-
// Only perform KMIP operations for Vault Enterprise
172-
// The KMIP secrets engine is not available in Vault CE
173-
count = var.vault_edition == "ce" ? 0 : 1
174-
175-
scripts = [abspath("${path.module}/../../scripts/write.sh")]
176-
177-
transport = {
178-
ssh = {
179-
host = var.leader_host.public_ip
180-
}
181-
}
182-
}

0 commit comments

Comments
 (0)