Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for running behind load balancers / Kubernetes #54

Closed
marshallbrekka opened this issue Dec 26, 2017 · 0 comments
Closed

Support for running behind load balancers / Kubernetes #54

marshallbrekka opened this issue Dec 26, 2017 · 0 comments

Comments

@marshallbrekka
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant