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 10639725C9 for ; Mon, 12 Apr 2021 21:29:19 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 0560522B60 for ; Mon, 12 Apr 2021 21:28:49 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (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 id 23E5922B4E for ; Mon, 12 Apr 2021 21:28:48 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id E159D45A5E for ; Mon, 12 Apr 2021 21:28:47 +0200 (CEST) From: Stoiko Ivanov To: pmg-devel@lists.proxmox.com Date: Mon, 12 Apr 2021 21:28:32 +0200 Message-Id: <20210412192833.21988-3-s.ivanov@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210412192833.21988-1-s.ivanov@proxmox.com> References: <20210412192833.21988-1-s.ivanov@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.059 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pmg-devel] [PATCH v2 proxmox-widget-toolkit 1/1] acme: allow wildcards as domain 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: Mon, 12 Apr 2021 19:29:19 -0000 allow wildcard dns-names as defined in [0,1] (only the prefix '*.' in front of a valid dns-name) as domain. [0] https://tools.ietf.org/html/rfc8555#section-7.1.3 [1] https://community.letsencrypt.org/t/acme-v2-production-environment-wildcards/55578 Signed-off-by: Stoiko Ivanov --- src/Toolkit.js | 5 +++++ src/Utils.js | 1 + src/window/ACMEDomains.js | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Toolkit.js b/src/Toolkit.js index b011c38..56dcee8 100644 --- a/src/Toolkit.js +++ b/src/Toolkit.js @@ -131,6 +131,11 @@ Ext.apply(Ext.form.field.VTypes, { }, DnsNameText: gettext('This is not a valid DNS name'), + DnsNameOrWildcard: function(v) { + return Proxmox.Utils.DnsName_or_Wildcard_match.test(v); + }, + DnsNameOrWildcardText: gettext('This is not a valid DNS name'), + // workaround for https://www.sencha.com/forum/showthread.php?302150 proxmoxMail: function(v) { return (/^(\w+)([-+.][\w]+)*@(\w[-\w]*\.){1,5}([A-Za-z]){2,63}$/).test(v); diff --git a/src/Utils.js b/src/Utils.js index 3fd8f91..4b53238 100644 --- a/src/Utils.js +++ b/src/Utils.js @@ -1041,6 +1041,7 @@ utilities: { let DnsName_REGEXP = "(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\\-]*[a-zA-Z0-9])?)\\.)*(?:[A-Za-z0-9](?:[A-Za-z0-9\\-]*[A-Za-z0-9])?))"; me.DnsName_match = new RegExp("^" + DnsName_REGEXP + "$"); + me.DnsName_or_Wildcard_match = new RegExp("^(?:\\*\\.)?" + DnsName_REGEXP + "$"); me.HostPort_match = new RegExp("^(" + IPV4_REGEXP + "|" + DnsName_REGEXP + ")(?::(\\d+))?$"); me.HostPortBrackets_match = new RegExp("^\\[(" + IPV6_REGEXP + "|" + IPV4_REGEXP + "|" + DnsName_REGEXP + ")\\](?::(\\d+))?$"); diff --git a/src/window/ACMEDomains.js b/src/window/ACMEDomains.js index 930a4c3..5ec5856 100644 --- a/src/window/ACMEDomains.js +++ b/src/window/ACMEDomains.js @@ -150,7 +150,7 @@ Ext.define('Proxmox.window.ACMEDomainEdit', { xtype: 'proxmoxtextfield', name: 'domain', allowBlank: false, - vtype: 'DnsName', + vtype: 'DnsNameOrWildcard', value: '', fieldLabel: gettext('Domain'), }, -- 2.20.1