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

Add PROXY protocol support #3098

Merged
merged 15 commits into from
Aug 2, 2017
Merged

Add PROXY protocol support #3098

merged 15 commits into from
Aug 2, 2017

Conversation

jefferai
Copy link
Member

@jefferai jefferai commented Aug 2, 2017

Fixes #799

Ping #815

@jefferai jefferai added this to the 0.8.0 milestone Aug 2, 2017
Copy link
Contributor

@chrishoffman chrishoffman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall. Just a few comments.

"tls_disable": "1",
"address": "127.0.0.1:8200",
"tls_disable": true,
"proxy_protocol": "use_if_authorized",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if a nested proxy_protocol block would be nicer here, with keys of behavior and allowed_addrs.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the answer is "yes" although we don't do that with tls, so I worry it would be sort of a "okay, why are they changing this up now" issue UX wise. We could support that later on and move tls and proxy both.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See 5dea9eb for a quick change to address this at the moment.

Listener: listener,
}

if config.Behavior == "use_if_authorized" || config.Behavior == "deny_if_unauthorized" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you move this up into your switch statement above?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

"net"
"sync"

proxyproto "github.com/armon/go-proxyproto"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to be missing from the vendor directory.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, stupid me, I got sockaddr and forgot proxyproto. Added.

AllowedAddrs []*sockaddr.SockAddrMarshaler `json:"allowed_addrs"`
}

func (p *ProxyProtoConfig) SetAllowedAddrs(addrs interface{}) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method could really use some unit tests to ensure the allowed addresses are being set correctly.

@chrishoffman
Copy link
Contributor

Also, can you add some docs for the config options. The behaviors especially took me a bit to get.

@jefferai
Copy link
Member Author

jefferai commented Aug 2, 2017

Yeah, I'll make sure to add docs before merging this.

Copy link
Contributor

@briankassouf briankassouf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one small comment

}
}

if config.Behavior == "use_if_authorized" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is a standard or not, but this name is pretty confusing to me. Should it be use_if_unauthorized?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe this should properly be "use_if_allowed" but I thought that might be even more confusing. Alternately I could change the name to "AuthorizedAddrs" instead of AllowedAddrs? (or maybe AuthorizedHosts?)

@jefferai jefferai merged commit 608322b into master Aug 2, 2017
@jefferai jefferai deleted the proxy branch August 2, 2017 22:24
@jantman
Copy link
Contributor

jantman commented Aug 2, 2017

@jefferai I can barely explain how happy I am to see this! Thank you sooo much!

@jefferai
Copy link
Member Author

jefferai commented Aug 2, 2017

:-D

@hairyhenderson
Copy link

🎉 Thanks @jefferai! This is awesome! 😀

@posito
Copy link

posito commented Aug 9, 2017

@jefferai any documentation on how to use this awesomeness? Am I reading wrong but it doesn't look like this part of the 0.8.0 release ?

@chrishoffman
Copy link
Contributor

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

Successfully merging this pull request may close these issues.

6 participants