haproxy and secure ftp server.

how to use Haproxy to publish an internal SFTP server.
Jasmin shahrzadAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

nociSoftware EngineerCommented:
It might work by using a TCP Frontend/Backend listening on port 22 and connecting to port 22.

then again why not forward port 22  to  the intended target.
There is nothing in a SSH session that is useful to haproxy for dispatching, the link is encrypted from the start,
no SNI... (SSL isn't used).
It will surely give a better performance .
Jasmin shahrzadAuthor Commented:
What does you mean. can you please detail your suggestion for forward port 22 to the intended target.

i have a a ubuntu (u1)server with ssh on port 107000 there is not login for user ftpuser
then on other ubuntu (u2)box i have haproxy with haproxy.cfg like that
 global
......
.....

default
...
...

listen  ftp-server
        bind    :4141
        mode    tcp
        default_backend sftp-server

backend sftp-server
        server ftp01 u1.mydomain.com:107000 check


what i do wrong here
from filezila
i try sftp://u2.mydomain.com username password port=4141
nociSoftware EngineerCommented:
okee....., SFTP != FTPS ....
SFTP is ftp / cp  over SSH link (scp of sftp from command prompt....)
FTPS = FTP + SSL ... and that is a problem.  

FTP uses a different protocol that uses multiple ports.
in (control) port 21 + (data) port 20 for transport. (although you can change the control port )

The backend needs to connect to the SSH port on a system (you may want to use scponly to prevent ssh shell access).
then you can use scp -oPort=4141  .... or sftp -o Port=4141 ...

port 107000 is not possible as well max value = 65535
and i expect that you need to use 22 there.

more like:
listen  sftp-server
        bind    :4141
        mode    tcp
        default_backend sftp-server

backend sftp-server
         mode tcp
        server sftp01 u1.mydomain.com:22 check

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.