]> git.proxmox.com Git - pve-cluster.git/commitdiff
add webauthn configuration to datacenter.cfg
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Tue, 9 Nov 2021 11:27:06 +0000 (12:27 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 10 Nov 2021 10:10:40 +0000 (11:10 +0100)
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
data/PVE/DataCenterConfig.pm

index fa8ba4a579c04fb2520bbfe1f24f633ae26467d6..2e802d3186d3d76385c643f29d8d298f96f0bf0d 100644 (file)
@@ -66,6 +66,34 @@ my $u2f_format = {
     },
 };
 
+my $webauthn_format = {
+    rp => {
+       type => 'string',
+       description =>
+           'Relying party name. Any text identifier.'
+           .' Changing this *may* break existing credentials.',
+       format_description => 'RELYING_PARTY',
+       optional => 1,
+    },
+    origin => {
+       type => 'string',
+       description =>
+           'Site origin. Must be a `https://` URL (or `http://localhost`).'
+           .' Should contain the address users type in their browsers to access'
+           .' the web interface.'
+           .' Changing this *may* break existing credentials.',
+       format_description => 'URL',
+       optional => 1,
+    },
+    id => {
+       type => 'string',
+       description =>
+           'Relying part ID. Must be the domain name without protocol, port or location.'
+           .' Changing this *will* break existing credentials.',
+       format_description => 'DOMAINNAME',
+       optional => 1,
+    },
+};
 
 PVE::JSONSchema::register_format('mac-prefix', \&pve_verify_mac_prefix);
 sub pve_verify_mac_prefix {
@@ -181,6 +209,12 @@ my $datacenter_schema = {
            format => $u2f_format,
            description => 'u2f',
        },
+       webauthn => {
+           optional => 1,
+           type => 'string',
+           format => $webauthn_format,
+           description => 'webauthn configuration',
+       },
        description => {
            type => 'string',
            description => "Datacenter description. Shown in the web-interface datacenter notes panel."
@@ -224,6 +258,10 @@ sub parse_datacenter_config {
        $res->{u2f} = PVE::JSONSchema::parse_property_string($u2f_format, $u2f);
     }
 
+    if (my $webauthn = $res->{webauthn}) {
+       $res->{webauthn} = PVE::JSONSchema::parse_property_string($webauthn_format, $webauthn);
+    }
+
     # for backwards compatibility only, new migration property has precedence
     if (defined($res->{migration_unsecure})) {
        if (defined($res->{migration}->{type})) {
@@ -271,6 +309,11 @@ sub write_datacenter_config {
        $cfg->{u2f} = PVE::JSONSchema::print_property_string($u2f, $u2f_format);
     }
 
+    if (ref($cfg->{webauthn})) {
+       my $webauthn = $cfg->{webauthn};
+       $cfg->{webauthn} = PVE::JSONSchema::print_property_string($webauthn, $webauthn_format);
+    }
+
     my $comment = '';
     # add description as comment to top of file
     my $description = $cfg->{description} || '';