Feeds:
Posts
Comments

Posts Tagged ‘ssh’

We have been tweaking the retrieval parameters for repository access via SSH. Did you know you can get around firewalls that block port 22? Thats right, we have now added support for this.

To successfully circumvent a firewall which blocks port 22, you can use port 443 (most firewalls will let this through, it is the widely used SSL protocol). You will also need to change the host you are pointing to. These are the basic steps:

  1. Set the environment variable ‘SSH_PORT’ to 443
  2. Anywhere that you were using ‘patch-tag.com’ before via the SSH method, replace this with ‘ssh.patch-tag.com’

Setting the SSH_PORT environment variable on windows

Method 1: On the command-line

Before you use darcs get or darcs pull, type this command:

set SSH_PORT=443

Method 2: Set a permanent environment variable for your user

  1. Right-click My Computer
  2. Left-click Properties
  3. Left-click the Advanced tab
  4. Left-click Environment Variables
  5. Left-click New in the “User variables” section
  6. Enter the variable name ‘SSH_PORT’ and the variable value ‘443’
  7. Left-click OK
  8. Left-click OK
  9. You will need to restart any command prompts for this to take effect

Setting the SSH_PORT environment variable on Linux/Unix/Mac OS X

Method 1: on the command-line

Before you use darcs get or darcs pull, type this command:

export SSH_PORT=443

Method 2: Set a permanent environment variable for your user

Assuming you are using bash, you would type this:

echo "export SSH_PORT=443" >> ~/.bashrc

This adds the exported variable to the startup script for your shell. To refresh your current shell with the new settings:

. ~/.bashrc

Putting it all together

Once you’ve set up the environment variable, you just need to change the host from ‘patch-tag’ to ‘ssh.patch-tag.com’.

So if you were using this before:

darcs get johndoe@patch-tag.com:/privaterepos/myrepo

It now becomes:

darcs get johndoe@ssh.patch-tag.com:/privaterepos/myrepo

Update: SSH_PORT is broken if you use putty on Windows

There is a bug in darcs when using putty as your ssh client on Windows. The above metioned method will not work if you use putty on Windows. These are my findings with putty 0.60 and darcs version 2.0.2. The problem is that darcs uses the -p option to specify the ssh port when putty only supports the -P option to specify the port. As a result you get an error when you try to push if you use the SSH_PORT environment variable. I am submitting a bug report for this.

The Workaround

You have to specify three separate environment variables in windows. This assumes you have ssh, sftp, and scp from the Putty project in your path:

set DARCS_SCP=scp -P 443
set DARCS_SFTP=sftp -P 443
set DARCS_SSH=ssh -P 443

Read Full Post »

Follow

Get every new post delivered to your Inbox.