Endpoints under /nodes/{node}/certificates/* required
/nodes/{node} permission. To allow least-privileged for certification
changes, check the permissions on /nodes/{node}/certificates path
instead.

Link: https://bugzilla.proxmox.com/show_bug.cgi?id=7513
Signed-off-by: Jakob Klocker <[email protected]>
---
 PVE/API2/ACME.pm         | 6 +++---
 PVE/API2/Certificates.pm | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/PVE/API2/ACME.pm b/PVE/API2/ACME.pm
index a948a72a..3f6679a0 100644
--- a/PVE/API2/ACME.pm
+++ b/PVE/API2/ACME.pm
@@ -160,7 +160,7 @@ __PACKAGE__->register_method({
     path => 'certificate',
     method => 'POST',
     permissions => {
-        check => ['perm', '/nodes/{node}', ['Sys.Modify']],
+        check => ['perm', '/nodes/{node}/certificates', ['Sys.Modify']],
     },
     description => "Order a new certificate from ACME-compatible CA.",
     protected => 1,
@@ -232,7 +232,7 @@ __PACKAGE__->register_method({
     path => 'certificate',
     method => 'PUT',
     permissions => {
-        check => ['perm', '/nodes/{node}', ['Sys.Modify']],
+        check => ['perm', '/nodes/{node}/certificates', ['Sys.Modify']],
     },
     description => "Renew existing certificate from CA.",
     protected => 1,
@@ -319,7 +319,7 @@ __PACKAGE__->register_method({
     path => 'certificate',
     method => 'DELETE',
     permissions => {
-        check => ['perm', '/nodes/{node}', ['Sys.Modify']],
+        check => ['perm', '/nodes/{node}/certificates', ['Sys.Modify']],
     },
     description => "Revoke existing certificate from CA.",
     protected => 1,
diff --git a/PVE/API2/Certificates.pm b/PVE/API2/Certificates.pm
index de8762c5..8da1e93b 100644
--- a/PVE/API2/Certificates.pm
+++ b/PVE/API2/Certificates.pm
@@ -87,7 +87,7 @@ __PACKAGE__->register_method({
     path => 'custom',
     method => 'POST',
     permissions => {
-        check => ['perm', '/nodes/{node}', ['Sys.Modify']],
+        check => ['perm', '/nodes/{node}/certificates', ['Sys.Modify']],
     },
     description => 'Upload or update custom certificate chain and key.',
     protected => 1,
@@ -165,7 +165,7 @@ __PACKAGE__->register_method({
     path => 'custom',
     method => 'DELETE',
     permissions => {
-        check => ['perm', '/nodes/{node}', ['Sys.Modify']],
+        check => ['perm', '/nodes/{node}/certificates', ['Sys.Modify']],
     },
     description => 'DELETE custom certificate chain and key.',
     protected => 1,
-- 
2.47.3



Reply via email to