pure-ftpd configuration behind load-balancer

Discussion in 'Installation/Configuration' started by nhybgtvfr, Apr 9, 2015.

  1. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    I'm trying to get the pure-ftpd working on an ispconfig3 server (latest version on Ubuntu 14.04), the server is behind a load-balancer (haproxy 1.5).
    being behind the load-balancer, I need to configure it for passive mode, and masquerade a public ip.
    I have another server behind this load balancer, running proftpd. which is working fine.
    I have the following iptables rules on the load-balancer:
    -A PREROUTING -d -p tcp -m tcp --dport 6100:6200 -j DNAT --to-destination
    -A PREROUTING -d -p tcp -m tcp --dport 6100:6200 -j DNAT --to-destination
    -A POSTROUTING -s -j SNAT --to-source
    -A POSTROUTING -s -j SNAT --to-source

    the haproxy is configured with:
    listen ubuntu12-ftp
    mode tcp
    bind-process 1
    option tcplog
    balance leastconn
    server ubuntu12 check

    listen hyh-ftp
    bind #transparent
    mode tcp
    bind-process 1
    log global
    option tcplog
    server hyh #send-proxy

    on the server with proftpd, I had to edit the configuration to get it to work, these are the relevant settings
    PassivePorts 6100 6200
    AllowForeignAddress on

    for pure-ftpd, I've created the following files in etc/pure-ftpd/conf.d
    ForcePassiveIP contents:
    PassivePortRange contents: 6100 6200

    when I try to ftp to this server I get:

    Status: Connecting to
    Status: Connection established, waiting for welcome message...
    Status: Connected
    Status: Retrieving directory listing...
    Command: PWD
    Response: 257 "/" is your current location
    Command: TYPE I
    Response: 200 TYPE is now 8-bit binary
    Command: PASV
    Response: 500 Unknown command
    Command: PORT 192,168,0,28,48,49
    Response: 500 I won't open a connection to (only to
    Error: Failed to retrieve directory listing is the adsl router ip from my end. is the physical nic's ip on the internal interface of the load balancer.
    the load balancer is 1 of a pair, with a floating ip of on the internal side, this floating ip is the ftp servers default gateway.

    what else do I need to do to get pure-ftpd working? I've tried using transparent, or send-proxy in the haproxy configuration, neither helped.


Share This Page