This PR is a security hardning change and will break some setups.
The hardning is done to ensure the datafolder is not compromised and particularly that it is not maliciously seeded.
The changes now **requires** that the datafolder is locked down with exact permissions, or Duplicati will refuse to use it. This is a change to prior functionality where the folder would simply be locked down if it was not already locked.
Previously, a file named `insecure-permissions.txt` could be placed in the folder to instruct Duplicati not to set permissions. With this change that file is no longer supported.
The only way to opt-out of the permission check is to supply `--allow-insecure-datafolder` or the environment variable `DUPLICATI__ALLOW_INSECURE_DATAFOLDER`. Once either of those are set, Duplicati will no longer check permissions and accept folders with other permissions.
The setting can be applied to `preload.json`, but the file needs to be in a trusted location, which is either the directory with the binaries or the file pointed to by `DUPLICATI_PRELOAD_SETTINGS`. The setting cannot be placed in a `preload.json` file that is in an insecure folder as the folder is not read if the permissions are not correct.
The previous paths `/usr/local/share/Duplicati/preload.json` and `C:\ProgramData\Duplicati\preload.json` are no longer supported as they cannot be guaranteed to be locked down.
A `preload.json` in the datafolder is still supported, provided the folder passes the permission check (or the `--allow-insecure-datafolder` is passed to the executable).
For most users, this should not cause any problems as Duplicati has been locking down the folders, so they should be correctly locked down already.
The configuretool has been updated with a `secure-datafolder` command that can be used to force the correct permissions on a folder, in case the folder did not have the correct permissions.
For some Docker setups it may not be possible to set the permissions and the check will fail. These setup will need to apply `DUPLICATI__ALLOW_INSECURE_DATAFOLDER=true` in the image to run without the protections.
The logic is now that there is a `Service` registry key that is locked down and used to communicate with the service. The service will refuse to use the key if it does not have the correct permissions.
Another key, `InstallState` is user readable and is used to keep track of what is installed with the MSI, and also communicates back if the initial password was applied.
All CLI tools and executables now accept a unified set of help command variants:
"help", "/help","--help", "usage", "/usage", "--usage", "/h", "-h"
Affected executables:
Duplicati.Agent
Duplicati.CommandLine
Duplicati.CommandLine.AutoUpdater
Duplicati.CommandLine.BackendTester
Duplicati.CommandLine.BackendTool
Duplicati.CommandLine.ConfigurationImporter
Duplicati.CommandLine.SecretTool
Duplicati.CommandLine.Snapshots
Duplicati.GUI.TrayIcon
Duplicati.Server
Duplicati.Service
Duplicati.WindowsService
Note that SharpAesCrypt command is not included in this because the parameter parsing is part of the SharpAesCrypt code base.
* Improved Windows Eventlog support.
Added support for logging to a different log with a Log:Source format.
Backwards compatible by treating "Source" as "Application:Source", where "Source" is default "Duplicati".
* Changed default log-level for eventlog to `Warning`.
This fixes#5770
* Fixed issue where checking for event log would crash the process.
Changed default log to `Duplicati` (was `Application`).
New default source names for service, agent and server.
* Reverted windows log-level back to information, now that there is a separate log for it
* Using "Duplicati 2" as the log name because "Duplicati" may be registered as a source name.
* Attempt to stop service before uninstalling
* Added additional diagnostics messages
* Fixed bug with starting the agent as a service
* Default to not use WindowsService for Agent as it requires permissions to create the event log
* Reduced log message levels for ongoing communication in agent
* Prevent double-logging from agent into Windows EventLog
* Made the agent log under a separate log source name
This commit adds the option to provide preload/preset options that change the default values for Duplicati's commandline or environment variables.
This fixes#5480