Hello,




We need to connect to an SFTP server “mydestination.tld” through a proxy
server. I can establish the connection SFTP as follows.



-----------------

*/home/ #* sftp -o User=myuser -o ProxyCommand="nc -X 5 -x my-proxy:1080 %h
%p" mydestination.tld

Connecting to mydestination.tld...

The authenticity of host 'sectrans1.allianz.at (<no hostip for proxy
command>)' can't be established.

RSA key fingerprint is

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added 'mydestination.tld’ (RSA) to the list of known
hosts.

Password:

sftp> ls

PROD  TEST  bin   etc   home  lib   srv   usr   var

sftp> exit

-----------------



But when I use, curl fort he same purpose. It fails with SSH error.



-----------------

# curl -V

curl 7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.27.1 zlib/1.2.3
libidn/1.18 libssh2/1.4.2

Protocols: tftp ftp telnet dict ldap ldaps http file https ftps scp sftp

Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz





# curl -vvv -x my-proxy:1080 sftp://mydestination.tld/

* About to connect() to proxy my-proxy port 1080 (#0)

*   Trying 10.10.10.51... connected

* Connected to my-proxy (10.10.10.51) port 1080 (#0)

* Failure establishing ssh session

* Closing connection #0

curl: (2) Failure establishing ssh session

----------------



>From the server, I can SFTP using curl if we don’t use a proxy.



--------------

#  curl -vvv  sftp://direct-sftp-server.tld/ -u user

Enter host password for user 'user':

* About to connect() to direct-sftp-server.tld 22 (#0)

*   Trying 10.10.10.93... connected

* Connected to sla03925.srv.allianz (10.10.10.93) port 22 (#0)

* SSH MD5 fingerprint: d1b498a488ac879a090acd09daa1d4bb

* SSH host check: 0, key:

* SSH authentication methods available: publickey,gssapi-keyex,gssapi-
with-mic,password

* Using ssh private key file

* SSH public key authentication failed: Unable to extract public key from
private key file: Unable to open private key file

* Initialized password authentication

* Authentication complete

dr-xr-xr-x  412 root     root            0 Sep  5 19:30 proc

drwxr-xr-x  106 root     root         4096 Jan 23 11:08 home

drwxrwxrwx   11 root     root         4096 Feb  6 07:26 disk2

-rw-r--r--    1 root     root            4 Dec 11  2015 .kdhrystones

--------------



So, the issue is when we use proxy to SFTP with curl it fails. Please help
on this



I could find same issue discussed https://curl.haxx.se/mail/
archive-2012-03/0021.html , but it’s very old and hope the pateches already
present in the latest installed version?
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html

Reply via email to