git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Martin Langhoff" <martin.langhoff@gmail.com>
To: "Bill Lear" <rael@zopyra.com>
Cc: git@vger.kernel.org
Subject: Re: git protocol over port-forwarding
Date: Thu, 15 Mar 2007 10:07:27 +1300	[thread overview]
Message-ID: <46a038f90703141407k6302cc87w27691980a65e96b5@mail.gmail.com> (raw)
In-Reply-To: <17912.16608.852664.321837@lisa.zopyra.com>

On 3/15/07, Bill Lear <rael@zopyra.com> wrote:
> This fails, and I was wondering if anyone has any experience using
> port-forwarding and the git protocol, or if it is not presently
> possible.

We do it all the time. We have an internal server for git hosting, and
to use git+ssh you have to be inside the firewall. If you are outside,
you have to run through several SSH hops to get through the firewall.
We automate this using ssh-agent and keys forwarding.

To get ssh to work for you transparently, what you need to do is to
setup a special Host entry for your git server. For example, I have a

Host gitproxied.yourdomain
    ProxyCommand ssh firewallhost "perl -MSocket -e
'\$h=shift;socket(X,PF_INET,SOCK_STREAM,getprotobyname(\"tcp\"));connect(X,sockaddr_in(22,inet_aton(\$h)));\$x=fileno(X);vec(\$r,\$x,1)=1;vec(\$r,0,1)=1;\$|=1;\$0=\"connect
to \$h\";while(1){1 until
select(\$ro=\$r,undef,\$eo=\$r,undef);if(vec(\$ro,\$x,1)){recv(X,\$buf,2000,0);print
\$buf;}elsif(vec(\$ro,0,1)){sysread(STDIN,\$buf,2000)or
last;send(X,\$buf,0);}elsif(vec(\$eo,0,1)||vec(\$eo,\$x,1)){last}}'
git.yourdomain"

as I have several hops to go through, "firewallhost" has another Host
entry, describing how to get to it.

With this, when I'm outside the lan I can ssh into the "git" host by
invoking "ssh gitproxied.yourdomain", sftp and scp work too. So I
often have an "extra" remote called originproxied or similar.

cheers,


martin

      parent reply	other threads:[~2007-03-14 21:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-14 18:37 git protocol over port-forwarding Bill Lear
2007-03-14 21:05 ` Julian Phillips
2007-03-14 22:04   ` Bill Lear
2007-03-14 22:14     ` Martin Langhoff
2007-03-14 23:14       ` Jakub Narebski
2007-03-15  0:33         ` Bill Lear
2007-03-15  1:32           ` Bill Lear
2007-03-15  4:29         ` Martin Langhoff
2007-03-14 22:30     ` Julian Phillips
2007-03-14 21:07 ` Martin Langhoff [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46a038f90703141407k6302cc87w27691980a65e96b5@mail.gmail.com \
    --to=martin.langhoff@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=rael@zopyra.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).