Repository navigation
Description
Describe the bug
Some opencloud commands work on the storage of the storage-users service directly, in a process of their own, next to the running server:
opencloud storage-users uploads sessions --cleanopencloud storage-users uploads delete-stale-nodesopencloud posixfs scanopencloud storage-users revisions cleanup(new in feat: clean up old revisions according to a cleanup strategy #3778)
Whatever these commands create on the storage belongs to the user that runs them, with permissions only for that user:
- lock files (
lockedfile.OpenFile(…, 0600), created the first time a node is locked and never removed, see Treesize propagation seems to be broken #1793), - lock folders of the hybrid metadata backend (mode 0700),
- metadata files.
If an admin runs such a command as root on a bare-metal installation where the server runs as opencloud, the server afterwards gets "permission denied" when it locks these nodes. Writing, moving or deleting the affected files then fails. Nothing tells the admin that the command was run as the wrong user, and the damage only shows later.
None of these commands checks the user it runs as. The admin documentation only mentions the required ownership for posix in general ("All files and directories must be owned by the same user and group under which the OpenCloud process is running"), not for the commands.
Steps to reproduce
- On a bare-metal installation, run OpenCloud as the user
opencloud. - As
root, run a command that locks nodes that have no lock file yet, e.g.opencloud storage-users revisions cleanup --all --strategy 1000after files were added to a posix storage from outside. Keeping 1000 versions deletes nothing, but the cleanup locks every file it visits. - Change one of these files through OpenCloud.
Expected behavior
The command refuses to run, or at least warns, when it runs as another user than the owner of the storage.
Actual behavior
The command runs and creates lock files owned by root. OpenCloud then fails to lock these files.
Suggestion
A shared check for these commands: compare the effective uid with the owner of the storage root, and warn (or refuse, which needs a team decision) when they differ, naming the right user, e.g. sudo -u opencloud …. revisions cleanup prints such a warning since #3778, its helper storageOwnerWarning could become the shared one. With Docker, docker exec already runs commands as the user of the container, so only bare-metal installations are affected.
Setup
opencloud main, bare-metal installation, all storage-users drivers (decomposed, decomposeds3, posix).
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsQualification
Activity