Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Dec 1999 08:32:27 +1030
From:      Mark Newton <newton@internode.com.au>
To:        John and Jennifer Reynolds <jjreynold@home.com>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: anybody using tn-gw-nav to tunnel ssh through a proxy?
Message-ID:  <19991217083227.A3471@internode.com.au>
In-Reply-To: <14425.10973.878258.39420@whale.home-net>
References:  <14425.10973.878258.39420@whale.home-net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Dec 16, 1999 at 11:09:33AM -0700, John and Jennifer Reynolds wrote:

 > but upon trying to ssh from work to my box I get this error message:
 >   Local: Corrupted check bytes on input.
 
tn-gw isn't 8-bit-clean;  you'll need to patch it.  Try something like
this:  it creates a new tn-gw-> prompt command called "rawopen" which 
gives you an 8-bit-clean link to whatever host/port you specify.

... and check with your IT security folks before running nos-tun
over it, won't you? :-)

   - mark



*** tn-gw.c.orig	Fri Jul  4 10:05:22 1997
--- tn-gw.c	Mon Jul  7 10:48:15 1997
***************
*** 61,66 ****
--- 61,67 ----
  static	unsigned char		prebuf[BUFSIZ];
  static	int			prebufc;
  static	int			kludgeraw = 0;
+ static  int                     gimme8bit = 0;
  
  static	time_t			ontime;
  static	time_t			offtime;
***************
*** 78,83 ****
--- 79,85 ----
  static	int	cmd_connect();
  static	int	cmd_passwd();
  static	int	cmd_xforward();
+ static  int     cmd_rawconn();
  
  typedef	struct	{
  	char	*name;
***************
*** 88,93 ****
--- 90,96 ----
  	"connect",	"   connect hostname [serv/port]",	cmd_connect,
  	"telnet",	"   telnet hostname [serv/port]",	cmd_connect,
  	"open",		0,					cmd_connect,
+ 	"rawopen",      "   rawopen hostname [serv/port]",      cmd_rawconn,
  	"x-gw",		"   x-gw [hostname/display]",		cmd_xforward,
  	"help",		"   help/?",				cmd_help,
  	"quit",		"   quit/exit",				cmd_quit,
***************
*** 316,322 ****
  
  		if(!kludgeraw && FD_ISSET(0,&rdy)) {
  			if(rfd == -1) {
! 				say(0,"Remote server has closed connection");
  				goto leave;
  			}
  			x = read(0,xuf,sizeof(xuf));
--- 319,325 ----
  
  		if(!kludgeraw && FD_ISSET(0,&rdy)) {
  			if(rfd == -1) {
! 				if (!gimme8bit) say(0,"Remote server has closed connection");
  				goto leave;
  			}
  			x = read(0,xuf,sizeof(xuf));
***************
*** 342,348 ****
  			}
  
  			if(write(rfd,clientnull,x) != x) {
! 				say(0,"Remote server has closed connection");
  				goto leave;
  			}
  			outbytcnt += x;
--- 345,351 ----
  			}
  
  			if(write(rfd,clientnull,x) != x) {
! 				if (!gimme8bit) say(0,"Remote server has closed connection");
  				goto leave;
  			}
  			outbytcnt += x;
***************
*** 356,362 ****
  		if(rfd != -1 && FD_ISSET(rfd,&rdy)) {
  			x = read(rfd,xuf,sizeof(xuf));
  			if(x <= 0) {
! 				say(0,"Remote server has closed connection");
  				goto leave;
  			}
  			if(write(0,xuf,x) != x)
--- 359,365 ----
  		if(rfd != -1 && FD_ISSET(rfd,&rdy)) {
  			x = read(rfd,xuf,sizeof(xuf));
  			if(x <= 0) {
! 				if (!gimme8bit) say(0,"Remote server has closed connection");
  				goto leave;
  			}
  			if(write(0,xuf,x) != x)
***************
*** 738,744 ****
  	} else
  		syslog(LLEV,"permit host=%s/%s destination=%s",rladdr,riaddr,av[1]);
  
! 	if(port != TNPORT) {
  		unsigned char	xuf[9];
  
  		xuf[0] = IAC;
--- 741,753 ----
  	} else
  		syslog(LLEV,"permit host=%s/%s destination=%s",rladdr,riaddr,av[1]);
  
! 	/* 19970704 newton@atdot.dotat.org
! 	 * "gimme8bit" flag used to determine whether this actually happens.
!          * Normally, if the proxy isn't connecting to port 23 it will 
!          * intercept telnet IAC sequences, meaning that we can't get an
!          * 8-bit clean connection.  If gimme8bit is true, this behaviour
!          * will be suppressed. */
! 	if((port != TNPORT) && (!gimme8bit)) {
  		unsigned char	xuf[9];
  
  		xuf[0] = IAC;
***************
*** 753,758 ****
--- 762,769 ----
  		if(write(0,xuf,9) != 9)
  			return(1);
  		kludgeraw = 1;
+ 	} else if (gimme8bit) {
+                 syslog(LLEV, "RAW connection requested");
  	}
  
  	if((rfd = conn_server(av[1],port,0,buf)) < 0) {
***************
*** 768,774 ****
  	return(2);
  }
  
! 
  
  baddest(fd,dest)
  int	fd;
--- 779,793 ----
  	return(2);
  }
  
! static  int
! cmd_rawconn(ac, av, cbuf)
! int     ac;
! char    *av[];
! char    *cbuf;
! {
!         gimme8bit = 1;
!         return(cmd_connect(ac, av, cbuf));
! }
  
  baddest(fd,dest)
  int	fd;



-- 
Mark Newton                               Email:  newton@internode.com.au (W)
Network Engineer                          Email:  newton@atdot.dotat.org  (H)
Internode Systems Pty Ltd                 Desk:   +61-8-82232999
"Network Man" - Anagram of "Mark Newton"  Mobile: +61-416-202-223


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19991217083227.A3471>