Uh oh!
There was an error while loading. Please reload this page.
Add capability of specifying "trusted_proxies" entries in CIDR notation (IPv4) - #12036
Conversation
olivermg
commented
Oct 25, 2018
I may be wrong, but I don't think the check failed because of this PR's changes: |
rullzer
commented
Oct 25, 2018
Cool stuff. Could you add ipv6 support as well. As that will now fail hard I think |
kesselb
commented
Oct 25, 2018
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:
|
olivermg
commented
Oct 26, 2018
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. |
Uh oh!
There was an error while loading. Please reload this page.
rullzer
commented
Oct 29, 2018
@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.
Could you squash your commits into 1?
| /* | ||
| * will work after having implemented IPv6 CIDR | ||
| public function testGetRemoteAddressIPv6WithMatchingCidrTrustedRemote() { |
| } | ||
| /* | ||
| * will work after having implemented IPv6 CIDR |
Signed-off-by: Oliver Wegner <void1976@gmail.com>
olivermg
commented
Oct 30, 2018
Sure, done. |
MorrisJobke
left a comment
There was a problem hiding this comment.
Code makes sense, tested and works 👍
MorrisJobke
commented
Oct 30, 2018
@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 🎉 |
olivermg
commented
Oct 30, 2018
Thanks a lot :-) I'm glad I could contribute something hopefully useful. |
MorrisJobke
commented
Oct 30, 2018
CI failure is unrelated -> merging. |
kesselb
commented
Oct 30, 2018
server/config/config.sample.php Lines 1499 to 1506 in 3eb5ac9 config.sample.php 🚀 |
olivermg
commented
Oct 30, 2018
Yes, I'll add some samples/documentation for CIDR to that |
Regarding the documentation in |
MorrisJobke
commented
Oct 31, 2018
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