From: Stoiko Ivanov Date: Thu, 15 Apr 2021 19:46:21 +0000 (+0200) Subject: acme: allow wildcards as domain X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=66c5ceb8482c2510d30184526f1aa7ede89ed3e6;p=proxmox-widget-toolkit.git acme: allow wildcards as domain 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 --- diff --git a/src/Toolkit.js b/src/Toolkit.js index a08af4e..33b7015 100644 --- a/src/Toolkit.js +++ b/src/Toolkit.js @@ -126,6 +126,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 19ce1f2..c52bef2 100644 --- a/src/Utils.js +++ b/src/Utils.js @@ -1213,6 +1213,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 b040e33..1fcc784 100644 --- a/src/window/ACMEDomains.js +++ b/src/window/ACMEDomains.js @@ -153,7 +153,7 @@ Ext.define('Proxmox.window.ACMEDomainEdit', { xtype: 'proxmoxtextfield', name: 'domain', allowBlank: false, - vtype: 'DnsName', + vtype: 'DnsNameOrWildcard', value: '', fieldLabel: gettext('Domain'), },