[pve-devel] [PATCH v2 node_config 1/1] node_config: Allow leading underscore in ACME aliases

Fabian Möller fabianm88 at gmail.com
Thu Jun 25 10:24:04 CEST 2020


---
 PVE/NodeConfig.pm | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/PVE/NodeConfig.pm b/PVE/NodeConfig.pm
index ad49e288..c16e455f 100644
--- a/PVE/NodeConfig.pm
+++ b/PVE/NodeConfig.pm
@@ -25,6 +25,16 @@ PVE::JSONSchema::register_format('pve-acme-domain', sub {
     die "value '$domain' does not look like a valid domain name!\n";
 });
 
+PVE::JSONSchema::register_format('pve-acme-alias', sub {
+    my ($alias, $noerr) = @_;
+
+    my $label = qr/[a-z0-9_][a-z0-9_-]*/i;
+
+    return $alias if $alias =~ /^$label(?:\.$label)+$/;
+    return undef if $noerr;
+    die "value '$alias' does not look like a valid domain alias!\n";
+});
+
 sub config_file {
     my ($node) = @_;
 
@@ -107,7 +117,7 @@ my $acme_domain_desc = {
     },
     alias => {
 	type => 'string',
-	format => 'pve-acme-domain',
+	format => 'pve-acme-alias',
 	format_description => 'domain',
 	description => 'Alias for the Domain to verify ACME Challenge over DNS',
 	optional => 1,
-- 
2.27.0




More information about the pve-devel mailing list