From 0b17987c674282cf73ed4da32c8e4c8b1c2d5d3c Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Tue, 11 Jun 2024 14:11:11 +0200 Subject: [PATCH] acme-api: show all certificate subject_alt_names (DNS, IP, EMAIL, URI) Signed-off-by: Dietmar Maurer --- proxmox-acme-api/src/certificate_helpers.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/proxmox-acme-api/src/certificate_helpers.rs b/proxmox-acme-api/src/certificate_helpers.rs index 2b82d476..dd8385e2 100644 --- a/proxmox-acme-api/src/certificate_helpers.rs +++ b/proxmox-acme-api/src/certificate_helpers.rs @@ -336,8 +336,19 @@ impl CertificateInfo { .subject_alt_names() .map(|san| { san.into_iter() - // FIXME: Support `.ipaddress()`? - .filter_map(|name| name.dnsname().map(str::to_owned)) + .filter_map(|name| { + if let Some(name) = name.dnsname() { + Some(format!("DNS: {name}")) + } else if let Some(ip) = name.ipaddress() { + Some(format!("IP: {ip:?}")) + } else if let Some(email) = name.email() { + Some(format!("EMAIL: {email}")) + } else if let Some(uri) = name.uri() { + Some(format!("URI: {uri}")) + } else { + None + } + }) .collect() }) .unwrap_or_default();