restrict vzdump cron options
modeled after the VZDump API path, but since we are restricted to Sys.Modify users already, we only need to restrict these three options.
This commit is contained in:
parent
e465d72830
commit
d5489c9334
@ -233,6 +233,7 @@ __PACKAGE__->register_method({
|
||||
description => "Create new vzdump backup job.",
|
||||
permissions => {
|
||||
check => ['perm', '/', ['Sys.Modify']],
|
||||
description => "The 'tmpdir', 'dumpdir' and 'script' parameters are additionally restricted to the 'root\@pam' user.",
|
||||
},
|
||||
parameters => {
|
||||
additionalProperties => 0,
|
||||
@ -264,6 +265,11 @@ __PACKAGE__->register_method({
|
||||
my $rpcenv = PVE::RPCEnvironment::get();
|
||||
my $user = $rpcenv->get_user();
|
||||
|
||||
foreach my $key (qw(tmpdir dumpdir script)) {
|
||||
raise_param_exc({ $key => "Only root may set this option."})
|
||||
if defined($param->{$key}) && ($user ne 'root@pam');
|
||||
}
|
||||
|
||||
my $data = cfs_read_file('vzdump.cron');
|
||||
|
||||
$param->{dow} = 'mon,tue,wed,thu,fri,sat,sun' if !defined($param->{dow});
|
||||
|
Loading…
x
Reference in New Issue
Block a user