jueves, 6 de febrero de 2014

Running Google Cloud's "gcutil" behind a socks proxy with tsocks and ssh tunnel

Suppose you have to use google's cloud platform "gcutil" tool to connect to one or more nodes on a project hosted on google cloud platform but you don't have a direct internet connection although  you still can set up a ssh connection to a gateway who has the ability to connect directly to Internet.

Given this scenario you can follow this simple steps to accomplish your task:

1. Open a terminal and ssh to your gateway using the following command

ssh -D 1080 user@gateway_ip

2. Install tsocks package (Debian/Ubuntu or RedHat/CentOS) 

sudo apt-get install tsocks 


yum install tsocks 

3.  Edit your tsocks.conf file like this:

# your local network/mask
local =
# local =

# Paths
# For this example this machine needs to access as 
# well as port 80 on the network through
# the socks 5 server at (if this machines hostname was 
# "socks.hello.com" we could also specify that, unless --disable-hostnames
# was specified to ./configure).

path {
reaches =
reaches =
server = localhost
server_type = 5
default_user = delius
default_pass = hello

# Default server
# For connections that aren't to the local subnets or to
# the server at should be used (again, hostnames could be used
# too, see note above)
# your local ssh-socks server
server =
# Server type defaults to 4 so we need to specify it as 5 for this one
server_type = 5
# The port defaults to 1080 but I've stated it here for clarity 
# the port you'd just select in the previous ssh connection
server_port = 1080 

4. Launch gcutil 

tsocks ./gcutil node-id 

And that's all. 
Publicar un comentario