-
Notifications
You must be signed in to change notification settings - Fork 617
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
tcp+sni route with allow=ip:something does not seem to work #576
Comments
I’ll take a look today. Thank you for the report. |
@KEZHwMlXV1vFzs6QvY8v5WjX5 I can't reproduce the issue locally. I've created a branch with increased DEBUG level logging. Could you build that branch and report the results? |
The branch is here: https://github.com/fabiolb/fabio/tree/issue-576-ip-access You should be able to checkout and |
yep it does not even arrive at that part of the code. From what I can see it already stops here Line 77 in faf228d
and in my case IP is nil and the allow opts is correctly set in the map ip is already nil within AccessDeniedTCP while c.RemoteAddr().String() in that function is the public client IP:SourcePort is it okay to feed https://golang.org/pkg/net/#ParseIP with an IP:PORT combo instead of only an IP? -> no it's not ok. We might want something like this (found at https://stackoverflow.com/a/41602018) if addr, ok := conn.RemoteAddr().(*net.TCPAddr); ok {
fmt.Println(addr.IP.String())
} |
ok when I change the function to this it works for me. diff --git a/route/access_rules.go b/route/access_rules.go
index 3901042..b3ce639 100644
--- a/route/access_rules.go
+++ b/route/access_rules.go
@@ -64,7 +64,8 @@ func (t *Target) AccessDeniedHTTP(r *http.Request) bool {
// AccessDeniedTCP checks rules on the target for TCP proxy routes.
func (t *Target) AccessDeniedTCP(c net.Conn) bool {
- ip := net.ParseIP(c.RemoteAddr().String())
+ addr := c.RemoteAddr().(*net.TCPAddr)
+ ip := net.ParseIP(addr.IP.String())
if t.denyByIP(ip) {
return true
} |
@KEZHwMlXV1vFzs6QvY8v5WjX5 Nice catch. Doing the assertion to a |
I pushed to the same branch and created #577 |
positive. It passed my checks. |
@KEZHwMlXV1vFzs6QvY8v5WjX5 awesome, I'll merge it. Thanks again. |
I added routes like this:
Then from a host that is not in 10.0.0.0/8 I try a curl like this:
curl -v -k --resolve from.intern.net:443:$OUTEXTERNALIP https://from.intern.net
And fabio is happy to serve the request instead of denying it. Is this not compatible using tcp+sni? I thought that
https://github.com/fabiolb/fabio/blob/master/proxy/tcp/sni_proxy.go#L102
handled that?
The text was updated successfully, but these errors were encountered: