sshtunnel icon indicating copy to clipboard operation
sshtunnel copied to clipboard

Unix domain socket connection not possible via ssh tunnel

Open akshay-joshi opened this issue 2 years ago • 1 comments

Hi All

We are using sshtunnel in pgAdmin4 and one of the users reported an issue about Unix socket connection not being possible via sshtunnel please refer to 5964.

We've tried so many combinations to support it, but none of them worked. We just need to confirm whether the use case is possible with the latest sshtunnel module or whether it hasn't yet been implemented.

Testing Scenario: We have two machines with a database server (PostgreSQL) installed on one, and from another machine, we would like to create an ssh tunnel with Unix Domain Socket to connect to the database server.

If we use the below command things are working perfectly fine:

  1. ssh -L 9999:/tmp/postgresql/.s.PGSQL.5432 [email protected]
  2. psql -U postgres -p 9999 -h localhost

'/tmp/postgresql/.s.PGSQL.5432' is the Unix Domain socket of the target machine in the above command. The first command creates an ssh tunnel, and the second command connects to the database server by using the local end of the tunnel (localhost: 9999)

We were not able to achieve the above using sshtunnel. We tried as follows: "python -m sshtunnel -U akshayjoshi -P edb -L localhost:9999 -R /tmp/postgresql/.s.PGSQL.5432 -p 22 localhost -v"

Please refer to the attached screenshot and let me know am I missing something or the above scenario/use case is not possible.

Screenshot 2022-03-02 at 6 47 25 PM

akshay-joshi avatar Mar 02 '22 13:03 akshay-joshi

I believe this is not currently possible: #31 added unix socket support only for the local side, not the remote side. See also #113, which is requesting the remote part.

takluyver avatar Jun 08 '22 14:06 takluyver