Subject: Re: cvs and ssh
To: David Maxwell <david@vex.net>
From: David Forbes <david@flossy.u-net.com>
List: netbsd-users
Date: 08/05/2001 16:07:24
> Sooner or later, C will need a password - stored vs typed by a user is a
> different discussion. Is your concern re: leaving passwords in a file
> outside the fw? That shouldn't be needed - unless you also intend to
> cron this cvs update or something similar.

There won't be any cron updating...C cannot initiate the modem link.

> > Is it possible to set CVS_RSH to some devious value, so that it uses the
> > basic ssh connection backwards?
>
> Not quite. You can however open an ssh forwarded port and ssh back down
> that.
>
> A%> ssh -R 2200:localhost:22 user@C
> ...
> C%> setenv CVS_RSH 'ssh -p 2200'

Sadly:

shonky:david$ export CVS_RSH='ssh -p 2200'
shonky:david$ export CVSROOT=localhost:/usr/cvsroot
shonky:david$ cd cvstest
shonky:cvstest$ cvs co WinAG
cvs [checkout aborted]: cannot exec ssh -p 2200: No such file or directory
cvs [checkout aborted]: end of file from server (consult above messages if
any)
shonky:cvstest$



However, I have oh so very nearly succeeded.  Write a script called
"localhost" (in the working directory on machine C):

cat <${SSH_TTY} & cat >${SSH_TTY}

Then set:

export CVS_RSH=/bin/sh
export CVSROOT=localhost:/usr/cvsroot

This is a bit of a bodge, but it successfully makes cvs on machine C send
and receive cvs server commands via the existing ssh connection.  Use

ssh -t machineC cvs co WinAG

to do the business.


Now I have the problem of connecting the ssh command to the cvs server
command on machine A.  And I'm oh-so-very-nearly there.  I've been able to
connect them to opposite ends of pseudo-terminal pair (after a bit of
bodging a C program together).  And the catch?  By the time the commands
reach the cvs server process, linefeeds have been expanded to CR-LF pairs,
which confuses the hell out of "cvs server".

So what I need now is a neat command that will just strip the CRs from
STDIN and pass them to STDOUT...and it would appear that I'm just not good
enough with sed to do this relatively simple task.  Any ideas?

Cheers,

David.