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

AWS Network Load Balancer uses PROXY protocol version 2 with TLVs #12

Closed
scampbell123 opened this issue May 8, 2019 · 6 comments
Closed
Assignees
Labels

Comments

@scampbell123
Copy link

scampbell123 commented May 8, 2019

Hi, I've got 2 Proftpd servers running on AWS EC2 instances behind an ELB (Network Load Balancer). I need the end-user client IPs in my transfer logs for audit purposes. I've downloaded/configured/installed the mod_proxy_protocol.c file. It loads fine into my proftpd config. I loaded it last, after all my other LoadModule entries.

My Directives:

 ProxyProtocolEngine on
 AllowForeignAddress on
 ProxyProtocolVersion haproxyV2

Once I enabled the "Proxy Protocol v2" in AWS, I get these errors in my proftpd logs:

mod_proxy_protocol/0.1: error reading proxy info: Invalid argument
mod_proxy_protocol.c: error initializing session: Operation not permitted

My gut says that the ProxyProtocolVersion does not support AWS ELBs right now. Has anyone else gotten this to work? Does it really only work with the haproxy package?

Thanks for any guidance,
Scott

@Castaglia Castaglia self-assigned this May 8, 2019
@Castaglia
Copy link
Owner

In your proftpd.conf, you might enable mod_proxy_protocol trace logging to get more information:

TraceLog /path/to/proftpd-trace.log
Trace proxy_protocol:20

Please provide that generated trace logging, when you can. Thanks!

@scampbell123
Copy link
Author

scampbell123 commented May 8, 2019

Sure thing. Here it is below:

2019-05-08 14:49:42,660 [19914] <proxy_protocol:19>: waiting for max of 3 secs while polling socket 0 using select(2)
2019-05-08 14:49:42,660 [19914] <proxy_protocol:17>: received proxy protocol V2 LOCAL command, ignoring
2019-05-08 14:49:43,600 [19915] <proxy_protocol:19>: waiting for max of 3 secs while polling socket 0 using select(2)
2019-05-08 14:49:43,600 [19915] <proxy_protocol:17>: received proxy protocol V2 TCP/IPv4 transport family (84 bytes)
2019-05-08 14:49:43,600 [19915] <proxy_protocol:3>: proxy protocol V2 TCP/IPv4 transport family sent 84 bytes, expected 12 bytes
2019-05-08 14:49:43,995 [19916] <proxy_protocol:19>: waiting for max of 3 secs while polling socket 0 using select(2)
2019-05-08 14:49:43,996 [19916] <proxy_protocol:17>: received proxy protocol V2 LOCAL command, ignoring
2019-05-08 14:49:44,198 [19917] <proxy_protocol:19>: waiting for max of 3 secs while polling socket 0 using select(2)
2019-05-08 14:49:44,198 [19917] <proxy_protocol:17>: received proxy protocol V2 LOCAL command, ignoring

@Castaglia
Copy link
Owner

Castaglia commented May 25, 2019

I think this might be our culprit:

proxy protocol V2 TCP/IPv4 transport family sent 84 bytes, expected 12 bytes

Now to see how/why this might be occurring. The preceding:

received proxy protocol V2 LOCAL command, ignoring

might also be involved, if the module is not properly reading and ignoring the rest of that LOCAL command.

@Castaglia Castaglia added the bug label Mar 21, 2020
@Castaglia
Copy link
Owner

I have a local instance of HAproxy, configured for FTP load balancing, using PROXY protocol v2. I can see the TCP checks, but in the mod_proxy_protocol logs, I don't see the "LOCAL" message yet. Still trying to reproduce this behavior locally.

@Castaglia
Copy link
Owner

Hmm. I think the "LOCAL" messages a red herring. Instead, reading closely over the PROXY protocol spec, I see:

If the length specified in the PROXY protocol header indicates that additional
bytes are part of the header beyond the address information, a receiver may
choose to skip over and ignore those bytes, or attempt to interpret those
bytes.

So perhaps the AWS NLB is sending these additional bytes as part of TLVs. I will try to reproduce these.

@Castaglia Castaglia changed the title AWS Network Load Balancer Protocol Version 2 AWS Network Load Balancer uses PROXY protocol version 2 with TLVs Mar 22, 2020
Castaglia added a commit that referenced this issue Mar 22, 2020
Issue #12: Implement support for PROXY protocol v2 TLVs.
@Castaglia
Copy link
Owner

This should now be fixed in the master branch; I'll be making a release shortly. Thanks!

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

No branches or pull requests

2 participants