Rsync through intermediate server (SSH tunnelling?)

Kernels & Hardware, configuring network, installing services

Rsync through intermediate server (SSH tunnelling?)

Postby dudumomo » 2017-09-25 05:11

Hello,

I need to rsync a project (torproject) on my server (Stockage) but using an intermediary. (another server)

Without the intermediary, I simply need to run:
Code: Select all
rsync -rt --delete rsync.torproject.org::amnesia-archive /media/Stockage/Mirrors/Tails
Now, with the intermediary, I'm facing difficulties.

I have created a ssh key and I can connect now from my Stockage server to the intermediary without issue, but now I want to run the Rsync command and it does not work.
I would like to do it in 1 command line, to use only when needed.

I've tried this:
Code: Select all
rsync -rt --delete --progress -e "ssh user@intermediate.server ssh" rsync.torproject.org::amnesia-archive /media/Stockage/Mirrors/Tails
But I got:
Code: Select all
ssh: connect to host rsync.torproject.org port 22: Connection refused
rsync: did not see server greeting
rsync error: error starting client-server protocol (code 5) at main.c(1666) [Receiver=3.1.2]

Obviously the syntax looks incorrect.

Any idea what it should be?

Thank you
Freedif, my blog with plently of tutorials to install opensource apps
Idipops, my newly created social network for pro (In Ruby and AngularjS)
dudumomo
 
Posts: 36
Joined: 2012-01-28 09:13

Re: Rsync through intermediate server (SSH tunnelling?)

Postby reinob » 2017-09-25 05:59

rsync can use *either* the rsync protocol or ssh.

You want to connect to a rsync server (rsync.torproject.org::amnesia-archive), so you can't use ssh for it.
If the torproject server allows rsync via ssh, then what you want will work. But it doesn't, as you can see ("connection refused").

If not, you have no solution to your problem. Unless of course you rsync from your intermediate server (if you control it and have space for it) and then rsync from your initial server to the intermediate one.
reinob
 
Posts: 510
Joined: 2014-06-30 11:42

Re: Rsync through intermediate server (SSH tunnelling?)

Postby dudumomo » 2017-09-25 09:05

A friend helped me with this.

Here is the command needed
Code: Select all
RSYNC_CONNECT_PROG='ssh -l user intermediateserver nc %H 873' rsync -rt --delete --progress rsync.torproject.org::amnesia-archive /media/Stockage/Mirrors/Tails


You will need netcat.

Works well now, and in 1 line.

I wasn't aware of such environment.

Hope it can helps others
Freedif, my blog with plently of tutorials to install opensource apps
Idipops, my newly created social network for pro (In Ruby and AngularjS)
dudumomo
 
Posts: 36
Joined: 2012-01-28 09:13

Re: Rsync through intermediate server (SSH tunnelling?)

Postby reinob » 2017-09-26 07:00

That's a cool solution!

(and it's actually described in the manual :)
reinob
 
Posts: 510
Joined: 2014-06-30 11:42

Re: Rsync through intermediate server (SSH tunnelling?)

Postby reinob » 2017-09-26 07:05

reinob wrote:That's a cool solution!

(and it's actually described in the manual :)


NOTE however that the rsync protocol does not do any encryption on its own. So your connection between the intermediate (proxy) server and the destination (rsync daemon) -- which is what netcat is doing -- will be clear-text.
reinob
 
Posts: 510
Joined: 2014-06-30 11:42


Return to System configuration

Who is online

Users browsing this forum: No registered users and 10 guests

fashionable