PostgreSql and ssh port tunneling
Posted: Fri Feb 08, 2013 1:14 pm
Sorry ma bad Englis. 
Because no postgressql ssl possibility in Purebasic, I'm looking for a solution how to use PostgreSQL through SSH tunnel. I found a small program Plink and I would like to use it this way to just extract it from exe and run hidden. But hidden it does not work. Does anyone have any ideas, or does anyone know any other program to establish the SSH channel and it must run from command line. Also it must be small and one exe because that i can include this to my exe.
Thanks

Because no postgressql ssl possibility in Purebasic, I'm looking for a solution how to use PostgreSQL through SSH tunnel. I found a small program Plink and I would like to use it this way to just extract it from exe and run hidden. But hidden it does not work. Does anyone have any ideas, or does anyone know any other program to establish the SSH channel and it must run from command line. Also it must be small and one exe because that i can include this to my exe.
Thanks
Code: Select all
Global tunnelId.l
Global tunneli_thread.l
Procedure LooTunnel(a.l)
tunnelId = RunProgram("c:\plink.exe", "karu@192.168.1.247 -L 192.168.1.1:63333:192.168.1.227:5432 -P 22 -pw uhuu", "", #PB_Program_Write | #PB_Program_Read)
;tunnelId = RunProgram("c:\plink.exe", "karu@192.168.1.247 -L 192.168.1.1:63333:192.168.1.227:5432 -P 22 -pw uhuu", "", #PB_Program_Open | #PB_Program_Write | #PB_Program_Read | #PB_Program_Hide) ; -good flags, but they do not work
Repeat : Delay(1) : ForEver
EndProcedure
Procedure HavitaTunnel()
If IsThread(tunneli_thread) : KillThread(tunneli_thread) : EndIf
If IsProgram(tunnelId)
KillProgram(tunnelId)
EndIf
EndProcedure
tunneli_thread = CreateThread(@LooTunnel(), 1)
Delay(10000)
HavitaTunnel()