fix(daemon): handling IPv6 addresses in healthcheck (#3004)

* fix(daemon): handling IPv6 addresses propertly in healthcheck Fixes #3002
This commit is contained in:
James Hodgkinson 2024-08-28 18:33:08 +10:00 committed by GitHub
parent 0e352cf47c
commit 413ef9210a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 3 deletions

View file

@ -1,4 +1,4 @@
bindaddress = "127.0.0.1:8443" bindaddress = "[::]:8443"
ldapbindaddress = "127.0.0.1:3636" ldapbindaddress = "127.0.0.1:3636"
db_fs_type = "zfs" db_fs_type = "zfs"

View file

@ -1044,10 +1044,16 @@ async fn kanidm_main(
let healthcheck_url = match &sopt.check_origin { let healthcheck_url = match &sopt.check_origin {
true => format!("{}/status", config.origin), true => format!("{}/status", config.origin),
false => format!("https://{}/status", config.address), false => {
// the replace covers when you specify an ipv6-capable "all" address
format!(
"https://{}/status",
config.address.replace("[::]", "localhost")
)
}
}; };
debug!("Checking {healthcheck_url}"); info!("Checking {healthcheck_url}");
let mut client = reqwest::ClientBuilder::new() let mut client = reqwest::ClientBuilder::new()
.danger_accept_invalid_certs(!sopt.verify_tls) .danger_accept_invalid_certs(!sopt.verify_tls)