You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As you are obviously aware, the PASV command must return a public ip back to the client as part of its response.
This is currently supported by the PublicHost setting, or the fallback to the LocalAddr() on net.Conn object.
However if running in Kubernetes cluster behind a load balancer on AWS (either an ELB or NLB) there will be multiple public IPs for a given hostname.
This can be problematic as the IP the ftp server resolves the hostname to may not be the same one the client resolved to.
This is a real problem as we've seen clients in the wild error out if the returned PASV IP did not match the IP it had connected to.
Fortunately both the ELB and NLB support the proxy protocol, which can be used to retrieve the private ip of the load balancer, and then lookup its corresponding public ip.
Rather than building all of that functionality into the ftp server its self, I think it would make more sense to allow the user to provide an existing net.Listener, and a resolver function to return a public ip.
I've submitted a PR that modifies the ClientContext to expose the LocalAddr, and a PublicIpResolver that takes said context and can return a public ip.
I'm open to other ways of addressing this, but I figured this was the smallest change possible that kept the specifics of my use case out of scope of this project.
The text was updated successfully, but these errors were encountered:
As you are obviously aware, the PASV command must return a public ip back to the client as part of its response.
This is currently supported by the
PublicHost
setting, or the fallback to theLocalAddr()
on net.Conn object.However if running in Kubernetes cluster behind a load balancer on AWS (either an ELB or NLB) there will be multiple public IPs for a given hostname.
This can be problematic as the IP the ftp server resolves the hostname to may not be the same one the client resolved to.
This is a real problem as we've seen clients in the wild error out if the returned PASV IP did not match the IP it had connected to.
Fortunately both the ELB and NLB support the proxy protocol, which can be used to retrieve the private ip of the load balancer, and then lookup its corresponding public ip.
Rather than building all of that functionality into the ftp server its self, I think it would make more sense to allow the user to provide an existing net.Listener, and a resolver function to return a public ip.
I've submitted a PR that modifies the ClientContext to expose the LocalAddr, and a
PublicIpResolver
that takes said context and can return a public ip.I'm open to other ways of addressing this, but I figured this was the smallest change possible that kept the specifics of my use case out of scope of this project.
The text was updated successfully, but these errors were encountered: