I'am wondering if openssh is used as the underlying ssh program, could you have 
fish:proxy config line which executes the following command:

ssh remote-host  -o'ProxyCommand ssh-tunnel.pl www-proxy www-proxy-port remote-host 
remote-host-port'

It would be nice if you could have the perl script as a C++ program integrated into 
lftp.


#!/usr/bin/perl -w
#
# ssh-tunnel.pl
#
# Usage: ssh-tunnel.pl ssl-proxy port destination_host port
#
# This script can be used by ssh as a "ProxyCommand" to
# traverse a www-proxy/firewall that supports the http CONNECT
# command described in
# http://home.netscape.com/newsref/std/tunneling_ssl.html
#
# Example, connect to host named "remote" outside of your firewall:
#
# $ ssh remote -o'ProxyCommand ssh-tunnel.pl www-proxy 80 remote 22'
#
# Better yet, insert the ProxyCommand definition for host "remote" in
# your $HOME/.ssh/config file:
#
#      .
#      .
#    Host remote
#      ProxyCommand /usr/local/bin/ssh-tunnel.pl www-proxy 80 %h %p
#      .
#      .
#
# Written by Urban Kaveus <[EMAIL PROTECTED]>
# deleted by declan, not actually required just specify AF_INET
# and SOCK_STREAM explicitly
#require 'sys/socket.ph';
# replace references to &SOCK_STREAM with $SOCK_STREAM and
# &AF_INET with $AF_INET
# Parse command line arguments

if ( $#ARGV != 3 ) {
    print STDERR "Usage: $0 ssl-proxy port destination port\n";
    exit(1);
}
$AF_INET = 2;

#
#
#
#if ($ENV{"OSTYPE"} eq "SunOS5") {
        $SOCK_STREAM = 2;
#} else {
#       $SOCK_STREAM = 1;
#}
#
#
#

$sslproxy    = shift;
$proxyport   = shift;
$destination = shift;
$destport    = shift;

# Set up network communication

($protocol) = (getprotobyname("tcp"))[2];
($proxyip)  = (gethostbyname($sslproxy))[4];
$localaddr  = pack('S n a4 x8', $AF_INET, 0, "\0\0\0\0");
$proxyaddr  = pack('S n a4 x8', $AF_INET, $proxyport, $proxyip);

socket (PROXY, $AF_INET, $SOCK_STREAM, $protocol) or
    die("Failed to create socket: $!\n");
bind (PROXY, $localaddr) or
    die("Failed to bind socket");
connect (PROXY, $proxyaddr) or
    die("Failed to connect to $sslproxy port $proxyport");

# Force flushing of socket buffers

select (PROXY);  $| = 1;
select (STDOUT); $| = 1;

# Send a "CONNECT" command to proxy:

print PROXY "CONNECT $destination:$destport HTTP/1.0\r\n\r\n";

# Wait for HTTP status code, bail out if you don't get back a 2xx code.

$_ = <PROXY>;
($status) = (split())[1];

die("Received a bad status code \"$status\" from proxy server. \n")
    if ( int($status/100) != 2 );

# Skip through remaining part of MIME header

while(<PROXY>) {
    chomp;   # Strip <LF>
    last if /^[\r]*$/;  # Empty line or a single <CR> left
}

# Start copying packets in both directions.

if($child = fork) { # Parent process
    while (sysread(STDIN,$_,4096)) {
        print PROXY;
    }
    sleep 2;
    kill(15,$child) if $child;
}

else { # Child process
    while (sysread(PROXY,$_,4096)) {
        print STDOUT;
    }
}


You could then also add  a config line fish:socks which executes:

ssh remote-host  -o'ProxyCommand socksify  www-proxy www-proxy-port remote-host 
remote-host-port'

where socksify is like the dante socksify program which is similar to the above case, 
except you don't need to check on the first HTTP lines and you have to link it with 
the socks5 library.

Is this of interest ?

Regards

 Markus



--

This e-mail may contain confidential and/or privileged information. If you are not the 
intended recipient (or have received this e-mail in error) please notify the sender 
immediately and destroy this e-mail. Any unauthorized copying, disclosure or 
distribution of the material in this e-mail is strictly forbidden.


Reply via email to