Allow running storage-proxy as root #2270
Labels
comp:storage-proxy
Related to Storage proxy component
urgency:4
As soon as feasible, implementation is essential.
Milestone
Since we allow
sudo
for specific customer sites, often users create files and directories in vfolder mounts as root. Though this is NOT a recommended behavior or intended usage as we providesudo
to customize the image filesystem, not vfolder mounts, still it will be useful to run storage-proxy as root to clean up vfolders containing potentially root-created files due to various reasons.Currently, if we configure
uid
andgid
fields instorage-proxy.toml
and execute the storage proxy as root, it will self-downgrade its privilege to the given uid/gid after binding the service sockets upon startup.Let's add a new boolean flag option
run-as-root
, so that the storage-proxy processes keep running as root while changing the ownership of any created files and directories inside vfolder mounts to the configureduid
andgid
.Places to ensure the file ownership for API-created files and directories:
ai.backend.common
files.AsyncFileWriter
: add an optional kwarg to override the created file's ownershipai.backend.storage
api.client
prepare_tus_session_headers()
: when creating.upload
folder to store tus upload session datatus_upload_part()
: pass uid/gid toAsyncFileWriter
, set uid/gid of anymkdir
callsvfs.BaseVolume
create_vfolder()
clone_vfolder()
: set the target vfolder's ownership only, not the copied contentsmkdir()
add_file()
: refactor to useAsyncFileWriter
?prepare_upload()
Note
If you change
run-as-root
setting of an existing storage-proxy, quota scopes created afterwards may be owned by root while existing ones is owned by a user account.The text was updated successfully, but these errors were encountered: