]> git.proxmox.com Git - pmg-api.git/commitdiff
api: nodeconfig: validate acme config before writing
authorStoiko Ivanov <s.ivanov@proxmox.com>
Wed, 16 Jun 2021 18:36:40 +0000 (20:36 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 28 Jun 2021 13:19:40 +0000 (15:19 +0200)
Currently it is possible to add the same domains as different
acmedomainX keys to the node config, which prevents the user from
ordering certificates later.

This patch adds a call to get_acme_conf, which does the semantic
validation (and is also used in all other sites, which read the
config).

Reported in our community forum:
https://forum.proxmox.com/threads/lets-encrypt-cert-on-gui-not-working.91014/

quickly tested in my setup, by successfully adding the same domain
twice without the patch, and failing to do so with it applied.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
src/PMG/API2/NodeConfig.pm

index 284f663f71580804b5bfe5bf2d2334346edf60e1..bfbbacdb4c81a3f3f71b3a6edb7a63e312d962aa 100644 (file)
@@ -81,6 +81,9 @@ __PACKAGE__->register_method ({
                $conf->{$opt} = $param->{$opt};
            }
 
+           #validate the acme config (check for duplicates)
+           PMG::NodeConfig::get_acme_conf($conf);
+
            PMG::NodeConfig::write_config($conf);
        });