public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Gabriel Goller <g.goller@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH v2] schema: add regex for dns domains with wildcard
Date: Wed, 18 Sep 2024 14:06:41 +0200	[thread overview]
Message-ID: <20240918120641.308844-2-g.goller@proxmox.com> (raw)
In-Reply-To: <20240918120641.308844-1-g.goller@proxmox.com>

Support dns domains with wildcards, f.e. '*.proxmox.com'. This is useful
when adding ACME-domains.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---

v2: nothing changed 

 proxmox-schema/src/api_types.rs | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/proxmox-schema/src/api_types.rs b/proxmox-schema/src/api_types.rs
index fed46257cef2..2e49936e800b 100644
--- a/proxmox-schema/src/api_types.rs
+++ b/proxmox-schema/src/api_types.rs
@@ -53,9 +53,15 @@ pub const SAFE_ID_REGEX_STR: &str = r"(?:[A-Za-z0-9_][A-Za-z0-9._\-]*)";
 #[rustfmt::skip]
 pub const DNS_LABEL_STR: &str = r"(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?)";
 
+#[rustfmt::skip]
+pub const DNS_LABEL_WILDCARD_STR: &str = r"(?:[a-zA-Z0-9\*](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?)";
+
 #[rustfmt::skip]
 pub const DNS_NAME_STR: &str = concatcp!(r"(?:(?:", DNS_LABEL_STR, r"\.)*", DNS_LABEL_STR, ")");
 
+#[rustfmt::skip]
+pub const DNS_NAME_WILDCARD_STR: &str = concatcp!(r"(?:(?:", DNS_LABEL_WILDCARD_STR, r"\.)*", DNS_LABEL_WILDCARD_STR, ")");
+
 #[rustfmt::skip]
 pub const DNS_ALIAS_LABEL_STR: &str = r"(?:[a-zA-Z0-9_](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?)";
 
@@ -99,7 +105,7 @@ const_regex! {
     pub MULTI_LINE_COMMENT_REGEX = r"(?m)^([[:^cntrl:]]*)$";
 
     pub HOSTNAME_REGEX = r"^(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?)$";
-    pub DNS_NAME_REGEX = concatcp!(r"^", DNS_NAME_STR, r"$");
+    pub DNS_NAME_REGEX = concatcp!(r"^", DNS_NAME_WILDCARD_STR, r"$");
     pub DNS_ALIAS_REGEX = concatcp!(r"^", DNS_ALIAS_NAME_STR, r"$");
     pub DNS_NAME_OR_IP_REGEX = concatcp!(r"^(?:", DNS_NAME_STR, "|",  IPRE_STR, r")$");
     pub HOST_PORT_REGEX = concatcp!(r"^(?:", DNS_NAME_STR, "|", IPRE_BRACKET_STR, "):", PORT_REGEX_STR ,"$");
-- 
2.39.5



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


  reply	other threads:[~2024-09-18 12:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-18 12:06 [pbs-devel] [PATCH proxmox-backup v2] config: check if acme domain with wildcard uses dns challenge Gabriel Goller
2024-09-18 12:06 ` Gabriel Goller [this message]
2024-09-19 10:52 ` Christian Ebner
2024-09-19 13:07   ` Christian Ebner
2024-09-19 13:29     ` Christian Ebner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240918120641.308844-2-g.goller@proxmox.com \
    --to=g.goller@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal