fix #5254: api: allow usage of download-url with Sys.AccessNetwork
The download-url API endpoint has some implications that admins are unaware of, namely that it basically allow to scan the whole network via HTTP URLs, and potentially even download some image that the user should not have access to and adding to a VM that the user controls. That's why in addition to the Datastore.AllocateTemplate privilege on the storage, the Sys.Modify on the whole Cluster was required to use the API call. That design was chosen as we were not fully sure if a separate privilege is warranted, but user feedback has shown that the (not so big) cost of adding such a new privilege is justified. Change the permission check to allow the combination of Datastore.AllocateTemplate on the storage and either 'Sys.Modify' on /, for backwards compatibility, or the newer 'Sys.AccessNetwork' on the node that handles the download. Using a node-specific ACL path allows admins to e.g. prepare one specific node's firewall so that pveproxy can access only a safe set of hosts via outgoing HTTP (not stemming from valid connection tracking to the PVE API), and thus even further limit the privileges of users or tools that are trusted to download images to a storage. Buglink: https://bugzilla.proxmox.com/show_bug.cgi?id=5254 Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com> Tested-by: Hannes Duerr <h.duerr@proxmox.com> Reviewed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
@ -546,9 +546,15 @@ __PACKAGE__->register_method({
|
|||||||
description => "Download templates and ISO images by using an URL.",
|
description => "Download templates and ISO images by using an URL.",
|
||||||
proxyto => 'node',
|
proxyto => 'node',
|
||||||
permissions => {
|
permissions => {
|
||||||
|
description => 'Requires allocation access on the storage and as this allows one to probe'
|
||||||
|
.' the (local!) host network indirectly it also requires one of Sys.Modify on / (for'
|
||||||
|
.' backwards compatibility) or the newer Sys.AccessNetwork privilege on the node.',
|
||||||
check => [ 'and',
|
check => [ 'and',
|
||||||
['perm', '/storage/{storage}', [ 'Datastore.AllocateTemplate' ]],
|
['perm', '/storage/{storage}', [ 'Datastore.AllocateTemplate' ]],
|
||||||
['perm', '/', [ 'Sys.Audit', 'Sys.Modify' ]],
|
[ 'or',
|
||||||
|
['perm', '/', [ 'Sys.Audit', 'Sys.Modify' ]],
|
||||||
|
['perm', '/nodes/{node}', [ 'Sys.AccessNetwork' ]],
|
||||||
|
],
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
protected => 1,
|
protected => 1,
|
||||||
|
|||||||
Reference in New Issue
Block a user