-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
caddytls: Fix MatchRemoteIP
provisoning with multiple CIDR ranges
#4522
Conversation
What does this fix, exactly? Please show an example config that was broken without this change. |
caddy version: v2.4.6 json config like this:
Above is a simple json config which is used to allow authorized source IP addresses to establish TLS connections, assuming 1.1.1.1 is the allowed IP, caddy works fine when the ranges field contains only itself or when other IPs are inserted above 1.1.1.1 (e.g. 8.8.8.8), but when inserted below 1.1.1.1, caddy does not work properly, and it outputs the following error log:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yeah that makes sense now. Thanks! Good find.
MatchRemoteIP
provisoning with multiple CIDR ranges
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the linter is unhappy, actually:
/home/runner/work/caddy/caddy/modules/caddytls/matchers.go:89:29: cannot use cidrs (variable of type []*net.IPNet) as *net.IPNet value in argument to append
I think you need to use the spread operator for these, since they're already slices
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unpack slice...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Thanks for finding and fixing this! |
No description provided.