<div dir="ltr"><pre style="white-space:pre-wrap;color:rgb(0,0,0)">On Sun, 25 Apr 2021 at 17:53, Chris Cowan via rsync
<<a href="https://lists.samba.org/mailman/listinfo/rsync" target="_blank">rsync at lists.samba.org</a>> wrote:
><i>
</i>><i>  I’ve also been looking at several solutions that try to sandbox openssh/rsync.    These include rssh (which should not be used anymore,  because it's Abandon-ware.  But, it is what I am most familiar with), GNU rush, and daethnir/authprogs on github.    None of these seems to be able to provide me the control, with rsync, when  –protect-args is used.  Unless I’m mistaken, the filtering has to be done by the rsync --server --sender process itself, since it's the only thing that has visibility to the filepath passed in the ssh channel.
</i>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I like to use rsync in daemon mode over ssh for that type of thing, because:</blockquote><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
* you don't need a shim, just make the ssh forced command "rsync<br>--server --daemon --config /path/to/some/rsyncd.conf ."<br>* the --daemon turns on extra server side security checks<br>* you always have --protect-args when in daemon mode<br>* you can sandbox the transfer root and other things with settings in<br>the rsyncd.conf</blockquote><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Example rsync.conf for allowing reading of /var/lib/{foo,bar} but<br>writes to only /var/lib/foo :</blockquote><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
use chroot = no
[foo]<br>path = /var/lib/foo<br>read only = no
[bar]<br>path = /var/lib/bar<br>read only = yes
On the client side you use the :: syntax to specify a module in an<br>rsync daemon along with "-e ssh" to get daemon mode over ssh, for<br>example to write to /var/lib/foo/someplace you could:
 rsync -e ssh [OTHER OPTIONS] /tmp/new-foo-things ${hostname}::foo/someplace</blockquote></pre><div>I was aware of similar features with sshd_config for sftp, but never considered this.   (Never ran rsync in daemon mode, to be honest).  The other solutions gave me separate control over scp, sftp, svn+ssh, git, etc ....<br>Will have to read the docs to see what modules are available.  </div><div><br><br></div>-- <br><div dir="ltr" data-smartmail="gmail_signature">Chris Cowan<br><br></div></div>