Skip to content

Commit 657f2f5

Browse files
authored
Disable cert validation if needed (#1757)
With the updated version of metal3-dev-env, the redfish endpoint will be TLS secured, with a self signed certificate. This will be indicated by the https protocol in the redfish address, and a redfish_verify_ca field set to False. We need to configure BMHs with disableCertificateVerification = true in this case. Signed-off-by: Marc Sluiter <[email protected]>
1 parent 484d98d commit 657f2f5

File tree

6 files changed

+30
-8
lines changed

6 files changed

+30
-8
lines changed

01_install_requirements.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if [ -z "${METAL3_DEV_ENV}" ]; then
1919
# TODO -- come up with a plan for continuously updating this
2020
# Note we only do this in the case where METAL3_DEV_ENV is
2121
# unset, to enable developer testing of local checkouts
22-
git reset 0cd943dfe68db8f20341588120f4434bc52ebb31 --hard
22+
git reset fab747ef4805bea2f12f70a7a5fbcedfc12a0222 --hard
2323

2424
popd
2525
fi

agent/05_agent_configure.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,8 @@ function generate_cluster_manifests() {
318318
export AGENT_NODES_BMC_PASSWORDS_STR=${nodes_bmc_passwords::-1}
319319
nodes_bmc_addresses=$(printf '%s,' "${AGENT_NODES_BMC_ADDRESSES[@]}")
320320
export AGENT_NODES_BMC_ADDRESSES_STR=${nodes_bmc_addresses::-1}
321+
nodes_bmc_verify_cas=$(printf '%s,' "${AGENT_NODES_BMC_VERIFY_CAS[@]}")
322+
export AGENT_NODES_BMC_VERIFY_CAS_STR=${nodes_bmc_verify_cas::-1}
321323
set -x
322324

323325
if [[ ! -z "$INSTALLER_PROXY" ]]; then
@@ -530,6 +532,7 @@ function get_nodes_bmc_info() {
530532
AGENT_NODES_BMC_USERNAMES=()
531533
AGENT_NODES_BMC_PASSWORDS=()
532534
AGENT_NODES_BMC_ADDRESSES=()
535+
AGENT_NODES_BMC_VERIFY_CAS=()
533536

534537
number_nodes=$NUM_MASTERS+$NUM_WORKERS
535538

@@ -538,6 +541,7 @@ function get_nodes_bmc_info() {
538541
AGENT_NODES_BMC_USERNAMES+=($(node_val ${i} "driver_info.username"))
539542
AGENT_NODES_BMC_PASSWORDS+=($(node_val ${i} "driver_info.password"))
540543
AGENT_NODES_BMC_ADDRESSES+=($(node_val ${i} "driver_info.address"))
544+
AGENT_NODES_BMC_VERIFY_CAS+=($(node_val ${i} "driver_info.redfish_verify_ca"))
541545
done
542546

543547
if [ "$NODES_PLATFORM" = "libvirt" ]; then

agent/roles/manifests/templates/install-config_baremetal_yaml.j2

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ platform:
6868
{% set bmc_addresses = agent_nodes_bmc_addresses.split(',') %}
6969
{% set bmc_passwords = agent_nodes_bmc_passwords.split(',') %}
7070
{% set bmc_usernames = agent_nodes_bmc_usernames.split(',') %}
71+
{% set bmc_verify_cas = agent_nodes_bmc_verify_cas.split(',') %}
7172
provisioningHostIP: {{ cluster_provisioning_ip }}
7273
provisioningNetworkInterface: {{ cluster_provisioning_interface }}
7374
provisioningNetworkCIDR: {{ provisioning_network }}
@@ -80,7 +81,7 @@ platform:
8081
address: {{ bmc_addresses[loop.index0] }}
8182
username: {{ bmc_usernames[loop.index0] }}
8283
password: {{ bmc_passwords[loop.index0] }}
83-
disableCertificateVerification: false
84+
disableCertificateVerification: {% if bmc_verify_cas[loop.index0] == "False" %}true{% else %}false{% endif %}
8485
networkConfig:
8586
interfaces:
8687
{{ net.interfaces("eth0", macs[loop.index0])|indent(4, True) }}

agent/roles/manifests/vars/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ agent_nmstate_dhcp: "{{ lookup('env', 'AGENT_NMSTATE_DHCP') }}"
1010
agent_nodes_bmc_addresses: "{{ lookup('env', 'AGENT_NODES_BMC_ADDRESSES_STR') }}"
1111
agent_nodes_bmc_passwords: "{{ lookup('env', 'AGENT_NODES_BMC_PASSWORDS_STR') }}"
1212
agent_nodes_bmc_usernames: "{{ lookup('env', 'AGENT_NODES_BMC_USERNAMES_STR') }}"
13+
agent_nodes_bmc_verify_cas: "{{ lookup('env', 'AGENT_NODES_BMC_VERIFY_CAS_STR') }}"
1314
agent_nodes_macs: "{{ lookup('env', 'AGENT_NODES_MACS_STR') }}"
1415
agent_nodes_ips: "{{ lookup('env', 'AGENT_NODES_IPS_STR') }}"
1516
agent_nodes_ipsv6: "{{ lookup('env', 'AGENT_NODES_IPSV6_STR') }}"

ocp_install_env.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,11 +404,13 @@ function generate_ocp_host_manifest() {
404404
rm -f "${outdir}/extras/*"
405405

406406
worker_index=0
407-
jq --raw-output '.[] | .name + " " + .ports[0].address + " " + .driver_info.username + " " + .driver_info.password + " " + .driver_info.address' $host_input \
408-
| while read name mac username password address ; do
407+
jq --raw-output '.[] | .name + " " + .ports[0].address + " " + .driver_info.username + " " + .driver_info.password + " " + .driver_info.address + " " + .driver_info.redfish_verify_ca' $host_input \
408+
| while read name mac username password address verify_ca; do
409409

410410
encoded_username=$(echo -n "$username" | base64)
411411
encoded_password=$(echo -n "$password" | base64)
412+
# Heads up, "verify_ca" in ironic driver config, and "disableCertificateVerification" in BMH have opposite meaning
413+
disableCertificateVerification=$([ "$verify_ca" = "False" ] && echo "true" || echo "false")
412414

413415
secret="---
414416
apiVersion: v1
@@ -432,7 +434,8 @@ spec:
432434
bootMACAddress: $mac
433435
bmc:
434436
address: $address
435-
credentialsName: ${name}-bmc-secret"
437+
credentialsName: ${name}-bmc-secret
438+
disableCertificateVerification: ${disableCertificateVerification}"
436439

437440
echo "${secret}${bmh}" >> "${outdir}/${host_output}"
438441

utils.sh

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,13 +246,15 @@ function node_map_to_install_config_hosts() {
246246
driver_prefix=ipmi
247247
elif [ $driver == "idrac" ] ; then
248248
driver_prefix=drac
249+
else
250+
driver_prefix=redfish
249251
fi
250252

251253
port=$(node_val ${idx} "driver_info.port // \"\"")
252254
username=$(node_val ${idx} "driver_info.username")
253255
password=$(node_val ${idx} "driver_info.password")
254256
address=$(node_val ${idx} "driver_info.address")
255-
disable_certificate_verification=$(node_val ${idx} "driver_info.disable_certificate_verification")
257+
256258
boot_mode=$(node_val ${idx} "properties.boot_mode")
257259
if [[ "$boot_mode" == "null" ]]; then
258260
boot_mode="UEFI"
@@ -261,14 +263,25 @@ function node_map_to_install_config_hosts() {
261263
cat << EOF
262264
- name: ${name}
263265
role: ${node_role}
266+
bootMACAddress: ${mac}
267+
bootMode: ${boot_mode}
264268
bmc:
265269
address: ${address}
266270
username: ${username}
267271
password: ${password}
272+
EOF
273+
274+
if [[ "$driver_prefix" == "redfish" ]]; then
275+
# Set disableCertificateVerification
276+
# Heads up, "verify ca" in ironic driver config, and "disableCertificateVerification" in BMH have opposite meaning
277+
verify_ca=$(node_val ${idx} "driver_info.redfish_verify_ca")
278+
disable_certificate_verification=$([ "$verify_ca" = "False" ] && echo "true" || echo "false")
279+
cat << EOF
268280
disableCertificateVerification: ${disable_certificate_verification}
269-
bootMACAddress: ${mac}
270-
bootMode: ${boot_mode}
271281
EOF
282+
fi
283+
284+
272285
if [ -n "${NETWORK_CONFIG_FOLDER:-}" ]; then
273286
node_network_config="${NETWORK_CONFIG_FOLDER}/${name}.yaml"
274287
if [ -e "$node_network_config" ]; then

0 commit comments

Comments
 (0)