Remote connection via tunnel works on GUI but not on script

Advertisement

fred-ige
Guest

Remote connection via tunnel works on GUI but not on script

Hi,
We try to autonomize a file transfer via an SSH tunnel.
We are able to do the work using the GUI.
We use the automatic script template generation to initialize our script.
Unfortunately we are not able to pass the tunnel.
the last line of the logfile is:
[Tunnel] Closing connection.
What could be wrong in the script generated by WinSCP ?

Thank you for your help
best regards
Fred

First line of the script:
open scp://toto@machine2reach/ -hostkey="ssh-ed25519 255 KZVgstPyWqGudK6uz5P3ROzuI5BVb7mvHHoEoGak4B0=" -privatekey="C:\Users\MRRPRO\.ssh\id_rsa.ppk" -rawsettings KEX="rsa,ecdh,dh-gex-sha1,dh-group14-sha1,WARN,dh-group1-sha1" ProxyHost="ssh.domain.fr" ProxyPort=22 ProxyUsername="toto" Tunnel=1 TunnelHostName="ssh.domain.fr" TunnelUserName="toto" TunnelPublicKeyFile="C:%5CUsers%5CMRRPRO%5C.ssh%5Cid_rsa.ppk"
The log file associate is:
. 2022-04-26 16:28:42.266 WinSCP Version 5.17.7 (Compilation 10640) (OS 10.0.19043 - Windows 10 Enterprise)
. 2022-04-26 16:28:42.266 Configuration: nul
. 2022-04-26 16:28:42.266 Log level: Normal
. 2022-04-26 16:28:42.266 Local account: DESKTOP-9H35PVM\MRRPRO
. 2022-04-26 16:28:42.266 Working directory: C:\Users\MRRPRO\.ssh
. 2022-04-26 16:28:42.266 Process ID: 13952
. 2022-04-26 16:28:42.266 Command-line: "C:\Program Files (x86)\WinSCP\WinSCP.exe"  /ini=nul /script="C:\Users\MRRPRO\Desktop\scpsrv11.txt" /log="C:\Users\MRRPRO\Desktop\winscp.log"
. 2022-04-26 16:28:42.266 Time zone: Current: GMT+2, Standard: GMT+1 (Paris, Madrid), DST: GMT+2 (Paris, Madrid (heure d’été)), DST Start: 27/03/2022, DST End: 30/10/2022
. 2022-04-26 16:28:42.266 Login time: mardi 26 avril 2022 16:28:42
. 2022-04-26 16:28:42.266 --------------------------------------------------------------------------
. 2022-04-26 16:28:42.266 Script: Retrospectively logging previous script records:
> 2022-04-26 16:28:42.266 Script: open scp://toto@server2reach/ -hostkey="ssh-ed25519 255 KZVgstPyWqGudK6uz5P3ROzuI5BVb7mvHHoEoGak4B0=" -privatekey="C:\Users\MRRPRO\.ssh\id_rsa.ppk" -rawsettings KEX="rsa,ecdh,dh-gex-sha1,dh-group14-sha1,WARN,dh-group1-sha1" ProxyHost="" ProxyPort=22 Tunnel=1 TunnelHostName="ssh.domain.fr" TunnelUserName="toto" TunnelPublicKeyFile="C:%5CUsers%5CMRRPRO%5C.ssh%5Cid_rsa.ppk"
. 2022-04-26 16:28:42.266 --------------------------------------------------------------------------
. 2022-04-26 16:28:42.266 Session name: toto@server2reach (Ad-Hoc site)
. 2022-04-26 16:28:42.266 Host name: server2reach (Port: 22)
. 2022-04-26 16:28:42.266 User name: toto (Password: No, Key file: Yes, Passphrase: No)
. 2022-04-26 16:28:42.266 Tunnel: Yes
. 2022-04-26 16:28:42.266 Tunnel: Host name: ssh.domaine.fr (Port: 22)
. 2022-04-26 16:28:42.266 Tunnel: User name: toto (Password: No, Key file: Yes)
. 2022-04-26 16:28:42.266 Tunnel: Local port number: 0
. 2022-04-26 16:28:42.266 Transfer Protocol: SCP
. 2022-04-26 16:28:42.266 Ping type: Off, Ping interval: 30 sec; Timeout: 15 sec
. 2022-04-26 16:28:42.266 Disable Nagle: No
. 2022-04-26 16:28:42.266 Proxy: None
. 2022-04-26 16:28:42.266 Send buffer: 262144
. 2022-04-26 16:28:42.266 SSH protocol version: 2; Compression: No
. 2022-04-26 16:28:42.266 Bypass authentication: No
. 2022-04-26 16:28:42.266 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: Yes
. 2022-04-26 16:28:42.266 GSSAPI: Forwarding: No; Libs: gssapi32,sspi,custom; Custom: 
. 2022-04-26 16:28:42.266 Ciphers: aes,chacha20,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2022-04-26 16:28:42.266 KEX: rsa,ecdh,dh-gex-sha1,dh-group14-sha1,WARN,dh-group1-sha1
. 2022-04-26 16:28:42.266 SSH Bugs: Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto
. 2022-04-26 16:28:42.266 Simple channel: Yes
. 2022-04-26 16:28:42.266 Return code variable: Autodetect; Lookup user groups: Auto
. 2022-04-26 16:28:42.266 Shell: default
. 2022-04-26 16:28:42.266 EOL: LF, UTF: Auto
. 2022-04-26 16:28:42.266 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes; Follow directory symlinks: No
. 2022-04-26 16:28:42.266 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No; Exit code 1 is error: No
. 2022-04-26 16:28:42.266 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2022-04-26 16:28:42.266 Cache directory changes: Yes, Permanent: Yes
. 2022-04-26 16:28:42.266 Recycle bin: Delete to: No, Overwritten to: No, Bin path: 
. 2022-04-26 16:28:42.266 DST mode: Unix;Timezone offset: 0h 0m
. 2022-04-26 16:28:42.266 --------------------------------------------------------------------------
. 2022-04-26 16:28:42.266 Opening tunnel.
. 2022-04-26 16:28:42.266 Autoselected tunnel local port number 50001
. 2022-04-26 16:28:42.266 [Tunnel] Looking up host "ssh.domain.fr" for SSH connection
. 2022-04-26 16:28:42.276 [Tunnel] Connecting to xx.xx.xx.xx port 22
. 2022-04-26 16:28:42.276 [Tunnel] We claim version: SSH-2.0-WinSCP_release_5.17.7
. 2022-04-26 16:28:42.296 [Tunnel] Remote version: SSH-2.0-OpenSSH_7.4p1 Debian-10+deb9u7
. 2022-04-26 16:28:42.296 [Tunnel] Using SSH protocol version 2
. 2022-04-26 16:28:42.296 [Tunnel] Doing ECDH key exchange with curve Curve25519 and hash SHA-256
. 2022-04-26 16:28:42.396 [Tunnel] Server also has ecdsa-sha2-nistp256/ssh-rsa host keys, but we don't know any of them
. 2022-04-26 16:28:42.396 [Tunnel] Host key fingerprint is:
. 2022-04-26 16:28:42.396 [Tunnel] ssh-ed25519 255 f9:1f:61:eb:a6:ac:1a:2d:8a:31:de:1c:82:23:5e:b8 sq+KpQEjmhelSG1BofJ2mS6auZzdbLjEvqd6mcHcSIc=
. 2022-04-26 16:28:42.396 [Tunnel] Closing connection.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,378
Location:
Prague, Czechia

Re: Remote connection via tunnel works on GUI but not on script

Your script misses tunnel hostkey. If you had the latest version of WinSCP, the log would say that. Though even your version should say that on the console.

The current stable version of WinSCP indeed does not include tunnel host key in the generated code/script.
You can use the beta version to generate a script with tunnel hostkey:
Issue 2006 – Include host key of tunnel session in generated code

Reply with quote

fred-ige
Guest

Re: Remote connection via tunnel works on GUI but not on script

Hi Martin,
Thank you a lot, now it works!
Regards

Reply with quote

Advertisement

You can post new topics in this forum