Re: [pure-ftpd] Issues with GCP load balancing multi instance

Boris Astardzhiev <[email protected]> Thu, 27 Feb 2020 18:13:19 +0200
Newsgroups gmane.network.pureftpd.user
Message-ID <CAP=KkTyh=h6GysTmhQ5Do5=9FdsySKgRWo6tn7BVsrWV_YTU3A@mail.gmail.com>
--000000000000820c95059f9100d1
Content-Type: text/plain; charset="UTF-8"

Hello,

Try this. Though it was rejected by maintainer it might help in you case.
https://github.com/jedisct1/pure-ftpd/pull/146/commits/a3405795856be3f34b8dad2cda0a90c82451a5cf
Let me know if it helps.

Regards,
Boris

On Thu, Feb 27, 2020 at 6:03 PM Luca Gervasi <[email protected]> wrote:

> Hi,
> i'm trying to configure pure-ftpd behind a load balancer on GCP. In my
> setup, i want to configure load balancing on port 21, having 2 instances
> with its own public ip to be used for passive ports.
> So: you connect to a common address <mylb.organisation>:21, it
> redistributes to the working instances, each of them then PASV to its own
> ip and the ephemeral port configured. This is the configuration example:
> On instance1:
> PassivePortRange          60000 61000
> ForcePassiveIP            <instance1IP>
>
> On instance2:
> PassivePortRange          60000 61000
> ForcePassiveIP            <instance1IP>
>
> And so far this works:
> Status: Logged in
> 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: 227 Entering Passive Mode (InstanceIP1,234,246)
>
> Problem is that when it goes bind(), it uses the (and how the hell did it
> get the ip?) load balancer ip:
> 2251 bind(9, {sa_family=AF_INET, sin_port=htons(60553),
> sin_addr=inet_addr("<LOADBALANCERIP>")}, 16) = 0
> 12251 alarm(120)                        = 240
> 12251 listen(9, 8                     = 0
> 12251 sendto(3, "<95>Feb 27 14:44:05 pure-ftpd[12251]: ([email protected])
> [DEBUG] 227 Entering Passive Mode (<InstanceIP>,236,137)", 119,
> MSG_NOSIGNAL, NULL, 0) = 119
> 12251 write(6, "227 Entering Passive Mode (<InstanceIP>,236,137)\r\n", 50)
> = 50
>
> So when the client tries to connect to the server, it gets a RST after the
> syn, even if the port is actually listening correctly.
>
> Is there a way to have pure-ftpd binding to 0.0.0.0 or its own ip during
> the passive binding?
>
> Thanks!
>
> Luca
>

--000000000000820c95059f9100d1--