Skip to content

Commit

Permalink
Fix passing custom CA cert via DDF params
Browse files Browse the repository at this point in the history
The verify_credentials method is looking for "ca_certs" in the
default_endpoint hash but the key is "certificate_authority".

This means even if the user passes in a valid CA cert the verify call
will fail because ca_certs will be `nil`

```
server, port, verify_ssl, ca_certs = default_endpoint&.values_at(
  "hostname", "port", "verify_ssl", "ca_certs"
)
(byebug) ca_certs
nil
(byebug) default_endpoint.keys
["hostname", "verify_ssl", "certificate_authority", "port"]
```
  • Loading branch information
agrare committed Mar 2, 2023
1 parent 1ed50e8 commit ce5a66f
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ def verify_credentials(args)
metrics_authentication = args.dig("authentications", "metrics")

username, password = default_authentication&.values_at("userid", "password")
server, port, verify_ssl, ca_certs = default_endpoint&.values_at(
"hostname", "port", "verify_ssl", "ca_certs"
server, port, verify_ssl, certificate_authority = default_endpoint&.values_at(
"hostname", "port", "verify_ssl", "certificate_authority"
)

metrics_username, metrics_password = metrics_authentication&.values_at("userid", "password")
Expand All @@ -230,7 +230,7 @@ def verify_credentials(args)
:server => server,
:port => port,
:verify_ssl => verify_ssl,
:ca_certs => ca_certs,
:ca_certs => certificate_authority,
:metrics_username => metrics_username,
:metrics_password => ManageIQ::Password.try_decrypt(metrics_password),
:metrics_server => metrics_server,
Expand Down

0 comments on commit ce5a66f

Please sign in to comment.