Replies: 3 comments 1 reply
-
|
rsync just runs rsync as a remote command in a remote shell via ssh and passes some parameters to it so that the remote process knows what to do (being a server): You see: using rsync it is possible to execute any executable on a remote shell as it is possible by just using ssh directly. Thus the best thing is to create a chroot environment, run an sshd there and provide rsync and all required libraries. By the way, giving rsync SUID root access would arise the need to ensure that any root rights are dropped when not needed anymore and to verify they're really gone (sounds funny, but is really important - that has been exploited already) before starting doing any work for any non-root user while leaving root rights unchanged if the user has actually logged in as root. |
Beta Was this translation helpful? Give feedback.
-
|
I don't see how your remark about SSH is relevant. The question here is about rsync features, not remote shell security. Depending on the design requirements, SSH can either provide a full-featured shell or be restricted to a specific rsync invocation in Rsync per se is already extravagant enough in a modern user-facing service. We keep it as a funny nostalgic feature. Option (2) with executables inside would look like '90s FTP chroots, which would be too extravagant/ugly/not funny. When you say "verify root rights drop", do you mean that Meanwhile, we ended up with a patch to rsync that implements exactly what's described in this conversation: https://github.com/sagb/rsync-super |
Beta Was this translation helpful? Give feedback.
-
|
Well, 1.5 years ago it was a feature request. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Suppose you want a multiuser rsync server in a zero-trust environment. You need a chroot.
You could run rsync in daemon mode or "chain-proxy" as described under "USING RSYNC-DAEMON FEATURES VIA A REMOTE-SHELL CONNECTION" in the
man rsync. The major drawback is its reliance on its own password authentication instead of today's industry-standard SSH keys. Even if you find a trick to overcome this, the overall setup would be a security headache.Rsync in non-daemon mode can be started from a chroot by an external program. This means the user will see the executable and libraries lying around, which might confuse them or provoke them to tamper with these files and attempt to escape.
As a final nail in the coffin, you might start filtering user input, trying to restrict them to specific directories, either with rrsync or, say, GNU Rush regexes. This approach is quite naive and only viable in an enterprise setting, but not against targeted attacks on the internet.
The solution would be the capability to chroot+chdir+setuid without daemon mode, controlled by command-line options that are forcibly set by sshd or a restricted shell.
The downside is that you need to run rsync as root, either using the SUID bit or running it from the aforementioned Rush, which is SUID. To me, this seems more manageable than the scenarios described in points (1), (2), and (3).
Beta Was this translation helpful? Give feedback.
All reactions