How to force the rsync to use my proxy settings?

8

4

I am installing macports on my Mac OS X and for fetching the binaries from the repository it uses rsync protocol. Unfortunately seems the repository is not accessible by direct connection from my machine. So I ran a local proxy program (supports http, https, ftp and socks) and now trying to find out how to redirect the rsync connection through my proxy. Is there anybody who knows about this? Cheers,

ashkrosh

Posted 2009-12-26T16:10:36.300

Reputation: 201

Answers

8

man rsync is your friend.

You may establish the connection via a web proxy by setting the environment variable RSYNC_PROXY to a host-name:port pair pointing to your web proxy. Note that your web proxy's configuration must support proxy connections to port 873.

So assuming your proxy is on port 3128, RSYNC_PROXY=localhost:3128 should do what you need.

James Polley

Posted 2009-12-26T16:10:36.300

Reputation: 5 892

5

If you use squid for your web proxy, add the two center lines to squid.conf (/etc/squid/squid.conf on most unix systems, or /opt/local/etc/squid/squid.conf in MacPorts):

acl SSL_ports port 443

acl SSL_ports port 873     # ADD THIS FOR RSYNC ACCESS
acl Safe_ports port 873    # ADD THIS FOR RSYNC ACCESS

acl CONNECT method CONNECT

Then, from a shell (if this works you can look at setting it up permanently), type:

export RSYNC_PROXY=proxyhost:proxyport

If your proxy requires a password:

export RSYNC_PROXY=username:password@proxyhost:proxyport

If the above is impossible for you to set up, you can also try this. It requires that you have access via ssh to a server that can act as a proxy.

export RSYNC_CONNECT_PROG='ssh tunnelhost nc %H 873'

The ssh server will have to have 'netcat' installed, almost all do. If not, it can be installed using something similar to:

debian/ubuntu:

apt-get install netcat

centos/redhat

yum install nc

Orwellophile

Posted 2009-12-26T16:10:36.300

Reputation: 451