From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 965659A066 for ; Tue, 14 Nov 2023 15:15:03 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 782E31CD22 for ; Tue, 14 Nov 2023 15:14:33 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Tue, 14 Nov 2023 15:14:32 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 5A9A2429E7 for ; Tue, 14 Nov 2023 15:14:32 +0100 (CET) From: Folke Gleumes To: pmg-devel@lists.proxmox.com Date: Tue, 14 Nov 2023 15:14:01 +0100 Message-Id: <20231114141408.228705-3-f.gleumes@proxmox.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231114141408.228705-1-f.gleumes@proxmox.com> References: <20231114141408.228705-1-f.gleumes@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.020 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [directory.rs] Subject: [pmg-devel] [PATCH acme-rs 2/8] add meta fields returned by the directory X-BeenThere: pmg-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Mail Gateway development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Nov 2023 14:15:03 -0000 According to the rfc, the meta field contains additional fields that weren't covered by the Meta struct. Of the additional fields, only external_account_required will be used in the near future, but others were added for completeness and the case that they might be used in the future. Signed-off-by: Folke Gleumes --- src/directory.rs | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/directory.rs b/src/directory.rs index 755ea8c..a9d31f2 100644 --- a/src/directory.rs +++ b/src/directory.rs @@ -47,6 +47,18 @@ pub struct Meta { /// The terms of service. This is typically in the form of an URL. #[serde(skip_serializing_if = "Option::is_none")] pub terms_of_service: Option, + + /// Flag indicating if EAB is required, None is equivalent to false + #[serde(skip_serializing_if = "Option::is_none")] + pub external_account_required: Option, + + /// Website with information about the ACME Server + #[serde(skip_serializing_if = "Option::is_none")] + pub website: Option, + + /// List of hostnames used by the CA, intended for the use with caa dns records + #[serde(skip_serializing_if = "Option::is_none")] + pub caa_identities: Option>, } impl Directory { @@ -64,6 +76,17 @@ impl Directory { } } + /// Get if external account binding is required + pub fn external_account_binding_required(&self) -> bool { + matches!( + &self.data.meta, + Some(Meta { + external_account_required: Some(true), + .. + }) + ) + } + /// Get the "newNonce" URL. Use `HEAD` requests on this to get a new nonce. pub fn new_nonce_url(&self) -> &str { &self.data.new_nonce @@ -78,8 +101,6 @@ impl Directory { } /// Access to the in the Acme spec defined metadata structure. - /// Currently only contains the ToS URL already exposed via the `terms_of_service_url()` - /// method. pub fn meta(&self) -> Option<&Meta> { self.data.meta.as_ref() } -- 2.39.2