M5: notifications, setup check, audit log and password confirmation
- notifications to administrators for failed backup/restore runs and locations without a successful backup for two days (once a day) - setup check in the admin overview: error when the key/kit is not set up, warning for missing, old or failed backups - security events (recovery kit downloaded, location removed, append-only turned off, retention changed, snapshots forgotten) go to the audit log and are announced to all administrators, from the web and from occ; the scheduled weekly cleanup is logged only - fix: the recovery-kit download link failed the CSRF check (412); it now requires a recent password confirmation instead, like creating the key, removing a location and restoring
This commit is contained in:
@@ -16,6 +16,7 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
class KeyKit extends Command {
|
||||
public function __construct(
|
||||
private KeyService $keys,
|
||||
private \OCA\NgBackup\Service\AlertService $alerts,
|
||||
) {
|
||||
parent::__construct();
|
||||
}
|
||||
@@ -31,6 +32,7 @@ class KeyKit extends Command {
|
||||
$output->writeln('<error>No backup key yet: run occ backup:key:init first.</error>');
|
||||
return 1;
|
||||
}
|
||||
$this->alerts->securityEvent('kit_downloaded');
|
||||
$json = json_encode($this->keys->recoveryKit(), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_THROW_ON_ERROR) . "\n";
|
||||
$file = $input->getOption('output');
|
||||
if ($file === null) {
|
||||
|
||||
@@ -16,6 +16,7 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
class TargetAppendOnly extends Command {
|
||||
public function __construct(
|
||||
private TargetService $targets,
|
||||
private \OCA\NgBackup\Service\AlertService $alerts,
|
||||
) {
|
||||
parent::__construct();
|
||||
}
|
||||
@@ -35,6 +36,9 @@ class TargetAppendOnly extends Command {
|
||||
return 1;
|
||||
}
|
||||
$t = $this->targets->setAppendOnly($this->targets->get($input->getArgument('target')), $state === 'on');
|
||||
if ($state === 'off') {
|
||||
$this->alerts->securityEvent('append_only_off', ['target' => $t->getName()]);
|
||||
}
|
||||
$output->writeln($t->getName() . ' is ' . ($t->getAppendOnly() ? 'append-only' : 'normal') . '.');
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
class TargetRemove extends Command {
|
||||
public function __construct(
|
||||
private TargetService $targets,
|
||||
private \OCA\NgBackup\Service\AlertService $alerts,
|
||||
) {
|
||||
parent::__construct();
|
||||
}
|
||||
@@ -34,6 +35,7 @@ class TargetRemove extends Command {
|
||||
return 1;
|
||||
}
|
||||
$this->targets->remove($t);
|
||||
$this->alerts->securityEvent('target_removed', ['target' => $t->getName()]);
|
||||
$output->writeln('Removed <info>' . $t->getName() . '</info>. The backups on the location itself were not touched; add it again to use them.');
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user