-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Add capability of specifying "trusted_proxies" entries in CIDR notation (IPv4) #12036
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
Conversation
|
I may be wrong, but I don't think the check failed because of this PR's changes: |
|
Cool stuff. Could you add ipv6 support as well. As that will now fail hard I think |
|
Good work! If you need some inspiration how to solve it with ipv6 you could look at https://github.com/symfony/http-foundation/blob/3.4/IpUtils.php |
Sure, I'll look into that, although I don't see a reason why it should fail right now, as the regex at Nevertheless, I'll do two things:
|
Okay, I think I see now. You are probably referring to that it would fail when using CIDR notation for IPv6 addresses. That's correct of course. I'm aware that the current/initial implementation only works for IPv4. I should probably have made that clear in the PR subject. My bad. However, I'm working on adding IPv6 too, so I'll add it to this PR as soon as it's done. |
|
@olivermg ah I see now that ipv6 proxies would have just worked just not with CIDR notation. We could also get this is soon and then work on ipv6 CIDR later? |
Yeah, that is what I meant earlier. The behaviour for IPv6 addresses should not change at all with this PR (i.e. it should not introduce a regression).
Sure, just go ahead and merge if that's ok for you. I'll open another PR for IPv6. I'm working on it but it'll take a bit more effort as I'm introducing new classes for that, in order to not pollute the |
rullzer
left a comment
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.
Could you squash your commits into 1?
|
|
||
| /* | ||
| * will work after having implemented IPv6 CIDR | ||
| public function testGetRemoteAddressIPv6WithMatchingCidrTrustedRemote() { |
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.
Could you remove this for now?
| } | ||
|
|
||
| /* | ||
| * will work after having implemented IPv6 CIDR |
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.
And this
Signed-off-by: Oliver Wegner <[email protected]>
|
Sure, done. |
MorrisJobke
left a comment
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.
Code makes sense, tested and works 👍
|
@olivermg Thanks for your contribution - feel free to have a look at other small issues in our issue tracker: https://github.com/nextcloud/server/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22 And welcome to the community 🎉 |
Thanks a lot :-) I'm glad I could contribute something hopefully useful. |
|
CI failure is unrelated -> merging. |
|
server/config/config.sample.php Lines 1499 to 1506 in 3eb5ac9
config.sample.php 🚀
|
|
Yes, I'll add some samples/documentation for CIDR to that |
|
Regarding the documentation in |
|
Its also not that magic. It’s a script that runs daily and updates the documentation automatically;) |
This enhances the handling of "trusted_proxies" config param. It adds the capability to define IPv4 ranges in CIDR notation (e.g.
192.168.0.0/24) instead of just single IP addresses as before.Fixes #6550