Custom FTP proxy

0 votes
asked Jun 15, 2012 by Michel van den Berg (120 points)
edited Aug 18, 2016 by Lukas Pokorny

I'm unable to connect to an FTP server with the following custom FTP proxy:
https://kb.bluecoat.com/index?page=content&id=KB3438

USER %u@%h %s
PASS %p
ACCT %w

Do you support this?

Applies to: Rebex FTP/SSL

3 Answers

0 votes
answered Jun 15, 2012 by Jan Sotola (16,930 points)
edited Jun 18, 2012

There is no pre-defined proxy type in the FtpProxyType enumeration.

However, if you need to connect through proxy using exactly the mentioned syntax

USER %username@%host %proxyUser
PASS %password
ACCT %proxyPassword

you can do it with the following code:

Ftp ftp = new Ftp();
string username = ""; 
string password = ""; 
string host = "";
string proxyUser = "bob.kent"; 
string proxyPassword = "*****"; 
string proxyHost = "192.168.15.200";
ftp.Connect(proxyHost);
ftp.Login(username + "@" + host + " " + proxyUser, password, proxyPassword);

Note: no setting of the ftp.Proxy property is needed in this situation.

commented Jun 18, 2012 by Michel van den Berg (120 points)
edited Jun 18, 2012

This works! The proxy credentials are the same as the windows credentials... is there any way I can pass these along so that I don't have to ask the user for the proxy credentials?

commented Jun 18, 2012 by Jan Sotola (16,930 points)
edited Jun 18, 2012

I think it is not possible, but I'd like to consult it with my colleague tomorrow. Than I'll write you the final answer.

commented Jan 15, 2016 by kraeppy (100 points)
edited Jan 18, 2016 by kraeppy
i have the same custom proxy settings but the code above doesn't work for me -.-

i have to set proxy settings ( proxytype = FtpUser and host ). otherwise i can't connect to the ftp server and this exception comes up: No connection could be made because the target machine actively refused it.

when connected, the code above does not work throwing the exception "ACCT proxypassword (530)".
(username, password and host were not empty).

who can help me?

- my fault... i connected to the ftp instead of proxy -.-
commented Jan 18, 2016 by Lukas Matyska (56,670 points)
Great, that you solved the issue.
commented Jan 29, 2016 by kraeppy (100 points)
having the same proxy custom settings, how to connect to a SFTP server and especially login?  the login method for sftp does not provide parameters: @username @pw, @account.

thank you in advance!
commented Jan 29, 2016 by Lukas Matyska (56,670 points)
Actually, this is not possible with SFTP, unless your proxy supports SSH. From the syntax of your proxy, it doesn't seem that the proxy supports it.

Maybe you are trying to use FTPS (which is rather called FTP/SSL) instead of SFTP?  To understand differences see http://www.rebex.net/kb/secure-ftp.

However, in that case, the proxy have to support SSL. If not, there is no need to use any secured protocol, because the password from your proxy to the remote host is sent in plaintext.
0 votes
answered Jun 19, 2012 by Lukas Pokorny (109,270 points)
edited Jun 19, 2012

Unfortunately, Jan is right - this is not possible. Essentially, you would need a way to retrieve the current user's username and password, which is not possible for security reasons.

As far as I know, the only way to re-use Windows credentials is using NTLM or Kerberos authentication (both support single-sign-on, sometimes refered to as Windows integrated authentication) and none of them applies here (unless you switch to an HTTP CONNECT proxy).

0 votes
answered Aug 18, 2016 by JohnBonem (140 points)
edited Aug 22, 2016 by Tomas Knopp

Hello. Have the same question. How can i connect to the remote ftp server, using proxy from http://advanced.name ?

commented Aug 18, 2016 by Lukas Pokorny (109,270 points)
They seem to offer proxies that support multiple protocols at once and recommend using SOCKS5 (see http://advanced.name/faq). To connect to a SOCKS5 proxy using Rebex FTP/SSL, use the following code:

    var ftp = new Ftp();
    ftp.Proxy.ProxyType = FtpProxyType.Socks5;
    ftp.Proxy.Host = "1.2.3.4"; // replace with proxy address
    ftp.Proxy.Port = 1080; // replace with proxy port
    //ftp.Proxy.UserName = "user01"; // use your user name
    //ftp.Proxy.Password = "password"; // use your password

    ftp.Connect("test.rebex.cz", SslMode.Explicit); // use the desired host name and SSL mode

However, I have been unable to try this with their free proxies - most of them seem to prohibit FTP (see the note at the end of http://advanced.name/freeproxy).
...