- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
Our community just got stronger! Explore new identity security resources, connect with experts, and discover more ways to learn and collaborate.
09-15-2021 01:27 AM
I need to access a database, but the port is not available from the office network.
For that I use an ssh tunnel to the host where the DB is running.
However when trying to use CyberArk to establish the tunnel and communicate with the BD the connection fails.
I can set up an SSH tunnel using PAM, but the DB connection fails.
I used the following commands to establish the tunnel
ssh -L 3306:127.0.0.1:3306 <Vault User>@<target user>@<target host<@<proxy address>
ssh -L 3306:127.0.0.1:3306 -t PSMConnect@<proxy address> <Vault user> <target user> <target address> -tunnel <port>
I linked the target's account to a platform where I allowed the tunnel through port 3306
Using DB client (DBeaver) I am getting the following error:
Could not connect to address=(host=127.0.0.1)(port=39749)(type=master) : Could not connect to 127.0.0.1:39749 : unexpected end of stream, read 0 bytes from 4 (socket was closed by server )
Could not connect to 127.0.0.1:39749 : unexpected end of stream, read 0 bytes from 4 (socket was closed by server)
Could not connect to 127.0.0.1:39749 : unexpected end of stream, read 0 bytes from 4 (socket was closed by server)
unexpected end of stream, read 0 bytes from 4 (socket was closed by server)
unexpected end of stream, read 0 bytes from 4 (socket was closed by server)When trying to use curl to connect to port 3309 I am getting the following error:
curl -v 127.0.0.1:3306
* Rebuilt URL to: 127.0.0.1:3306/
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 3306 (#0)
> GET / HTTP/1.1
> Host: 127.0.0.1:3306
> User-Agent: curl/7.55.1
>Accept: */*
>
* Recv failure: Connection was reset
* Closing connection 0
curl: (56) Recv failure: Connection was reset
In the PSMP sshd configuration I activated the following parameters:
AllowTcpForwarding yes
PermitTunnel yesIn the PSMP logs I can see the following messages:
[09/15/2021 | 09:40:51] | :: | PSMPPS003E [a223beea-1600-11ec-9dca-005056a7407b] PSM SSH Proxy exception occurred. 273E [a223beea-1600-11ec-9dca-005056a7407b] Failed to get Tunneling port allocated for session (Codes: -1, -1)
Has anyone had this problem?
09-15-2021 02:26 AM
Few things to consider :
09-15-2021 01:57 AM
Hi Luis,
Did you updated the platform accordingly to allow port 3306 for tunneling ?
https://docs.cyberark.com/Product-Doc/OnlineHelp/PAS/Latest/en/Content/PASIMP/Configuring-SSH-Tunneling-for-PSMP.htm?Highlight=ssh%20tunell
09-15-2021 02:11 AM
Hi Gotz
Yes i updated the platform to allow tunneling on port 3306.
09-15-2021 02:26 AM
Few things to consider :
09-15-2021 06:18 AM
Hello Gotz
Thanks for the answer
Finaly i got the connection to work.
One of the problems was in the FW of the target system which was blocking the traffic.
Another problem was in the DB itself whose user did not have permissions to connect from the PSMP IP address.
Finally, the DB client does not allow using the commands needed to establish the tunnel as required by CyberArk.
So I had to manually log into the command line with the syntax:
ssh -vv -L 3306:127.0.0.1:3306 -t PSMConnect@<proxy address> <Vault user> <target account> <target address> -tunnel 3306
And on the client specify only as address of DB 127.0.0.1 and port 3306.
Click Accept as Solution to acknowledge that the answer to your question has been provided.
The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!
These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!
The LIVEcommunity thanks you for your participation!

