]> git.proxmox.com Git - pve-manager.git/commitdiff
node_config: Allow leading underscore in ACME aliases
authorFabian Möller <fabianm88@gmail.com>
Mon, 22 Jun 2020 10:10:14 +0000 (12:10 +0200)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Thu, 25 Jun 2020 08:25:45 +0000 (10:25 +0200)
PVE/NodeConfig.pm

index ad49e2882f508d61730d5d1eb75444f9a4e254f3..017f6b3065f3951f00ec441e7378e240be83641d 100644 (file)
@@ -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 ($domain, $noerr) = @_;
+
+    my $label = qr/[a-z0-9_][a-z0-9_-]*/i;
+
+    return $domain if $domain =~ /^$label(?:\.$label)+$/;
+    return undef if $noerr;
+    die "value '$domain' does not look like a valid domain name!\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,