Windows Backup Privilege Tweaks#5424
Conversation
|
Thinking on this, should restic automatically try to enable privileges that cause it to bypass access permissions? Should it be enabled via flag, like VSS is by |
|
This is a great feature that I would very much like to have asap, but I think it would be better to have it as an explicit opt-in. Otherwise, I expect all kinds of "endpoint protection" and anti-virus snake oil to trip over |
It's not bypassing anything, it's using the access paradigms as they were intended and I'd say it is not violating the principle of least surprise. Backup software is the intended use of this privilege. |
MichaelEischer
left a comment
There was a problem hiding this comment.
I'd like to keep the privilege management hidden in the fs package, see below for a suggestion how to achieve that.
Add tests to verify privileges' effects.
|
This should be a bit more proper. Contained to the |
MichaelEischer
left a comment
There was a problem hiding this comment.
LGTM, I just have two small nits
What does this PR change? What problem does it solve?
This PR enables backup semantics for file EA opens and attempts to enable
SeBackupPrivilegewhen first beginning a backup.When enabled,
SeBackupPrivilegeallows read-only opening that bypasses ACLs; this can permit a restricted account with the proper privilege to back up all users' files without changing file-system permissions. Go supports backup semantics for read-only opens since 405275 / v1.20 and restic currently enables the privilege to backup security descriptors, so such backups mostly work already, with two issues:SeBackupPrivilegeallows access which would have been denied without the privilege.This is because
windows.CreateFileis used directly without the appropriate flag.(Directories already have the flag as they require it to get a handle at all.)
SeBackupPrivilegeis only enabled upon reading the first security descriptor; accesses before this are subject to normal ACLs and may fail. This always affects the scanner, and the actual backup will error & skip initial items until one has permissive enough ACLs.An example of both issues:
Was the change previously discussed in an issue or on the forum?
No.
Checklist
[ ] I have added documentation for relevant changes (in the manual).changelog/unreleased/that describes the changes for our users (see template).