[CLUE-Tech] Socket forwarding.

David Anselmi anselmi at americanisp.net
Thu Jan 9 10:15:57 MST 2003


Anyone know of a way to connect an inet socket to a unix socket?  SSH 
can forward a local port to a remote port, it would be cool if it could 
forward a local port to a remote unix domain socket.

This works:

ssh -L 2525:mailhost:25 mailhost

and now anything I send locally to 2525 goes to the remote smtp server. 
  The server thinks the connection is local though with an inet socket 
there is no concept of a user who opened the connection.

This would be cool:

ssh -L 2000:remotehost:/tmp/mysocket remotehost

Now anything I send locally to 2000 goes into the mysocket socket on the 
remote machine.  The server thinks the connection belongs to whatever 
user my ssh connection logged in as and doesn't have any concept that 
I'm on a different machine.

Why do I ask?

You can talk to a Postgresql database on port 5432 or on a unix domain 
socket.  By default only local connections are allowed to either inet or 
unix sockets.  The unix sockets know who you are but the inet ones use 
the ident protocol to find out.  That isn't much of a security issue but 
it is an additional layer of complexity.

Maybe this would make a useful patch to ssh.

Dave




More information about the clue-tech mailing list