Added check that backup path is not in meshcentral-data folder, #3266

This commit is contained in:
Ylian Saint-Hilaire 2021-11-09 00:03:39 -08:00
parent 6297a2ef53
commit 3a42b84315
2 changed files with 8 additions and 1 deletions

View File

@ -1747,6 +1747,12 @@ function CreateMeshCentralServer(config, args) {
if (obj.config.settings.autobackup == null) { obj.config.settings.autobackup = { backupintervalhours: 24, keeplastdaysbackup: 10 }; }
else if (obj.config.settings.autobackup === false) { delete obj.config.settings.autobackup; }
// Check that autobackup path is not within the "meshcentral-data" folder.
if ((typeof obj.config.settings.autobackup.backuppath == 'string') && (obj.path.normalize(obj.config.settings.autobackup.backuppath).startsWith(obj.path.normalize(obj.datapath)))) {
addServerWarning("Backup path can't be set within meshcentral-data folder, backup settings ignored.", 21);
delete obj.config.settings.autobackup;
}
// Load Intel AMT passwords from the "amtactivation.log" file
obj.loadAmtActivationLogPasswords(function (amtPasswords) {
obj.amtPasswords = amtPasswords;

View File

@ -2219,7 +2219,8 @@
17: "SendGrid server has limited use in LAN mode.",
18: "SMTP server has limited use in LAN mode.",
19: "SMS gateway has limited use in LAN mode.",
20: "Invalid \"LoginCookieEncryptionKey\" in config.json."
20: "Invalid \"LoginCookieEncryptionKey\" in config.json.",
21: "Backup path can't be set within meshcentral-data folder, backup settings ignored."
};
var x = '';
for (var i in message.warnings) {