Closed (outdated)
Project:
Drupal core
Version:
6.x-dev
Component:
base system
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
3 Nov 2009 at 07:36 UTC
Updated:
2 Mar 2016 at 22:18 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
david straussAssigning to me.
Comment #2
damien tournoud commentedI would do the array_map() on the same line as the explode. Is there a need to trim the IP address from REMOTE_ADDR?
This do not perform as strictly as intended:
We need something like:
This review is powered by Dreditor.
Comment #3
david straussYes. IPs listed in XFF are delimited by commas which may or may not be followed by spaces.
Untrue. It's unnecessary to loop as you've suggested. It's not possible for incoming requests to forge entires to the right of ones added by your own proxies. The only side-effect to the array_diff() is that we extract potentially forged items to the left of the user's actual IP, but that won't affect the result.
Show at least one case where it makes a difference.
Comment #4
david straussSetting back to "needs review," despite the tiny critique about combining the trim and explode onto one line.
Comment #5
david straussOh, REMOTE_ADDR. I had read "XFF." No, there's no need to trim that. I agree that we should tack it on following the trim.
Comment #7
catchThis is a duplicate of #621748: ip_address() is broken for multi-tier architectures - which has tests. Marking duplicate so they can be combined.
Comment #8
david strauss@catch You just marked this a duplicate of itself.
Comment #9
catchWhoops, meant #258397: IP address identification not broad enough
Comment #10
sun.core commented7X29YcLCtUMmeqrdQz67VW3RXwU.patch queued for re-testing.
Comment #12
catchBack to duplicate.
Comment #13
catchThe other issue was never combined with this one and didn't fix the specific issue, but has since been committed, so re-opening this, sorry :(
Comment #14
grendzy commentedDavid's fix, with additional test for the multi-tier environment. REMOTE_ADDR is no longer trimmed. Also includes some minor style / doc fixes.
Comment #15
dries commentedCommitted to CVS HEAD for inclusion in Drupal 7. This should probably be backported to Drupal 6.
Comment #16
mikeytown2 commentedsubscribe from #705718: ip_address() in bootstrap.inc returns invalid ip address when using 2 proxies
Direct backport from 7.x attached
Comment #17
grendzy commentedI think it's good that the reverse_proxy_header variable is included in the backport, but there's some additional documentation that goes with it in
default.settings.phpComment #18
mikeytown2 commentedadded in the documentation to default.settings.php
Comment #19
janusman commentedI think the testing bot is ignoring the patch due to the -D6 in the name. Attaching same patch from #18, renamed.
Comment #20
mikeytown2 commented@janusman
This patch is for 6.x it was already applied for 7.x
Have you tested this on 6.x yet?
Comment #22
grendzy commentedbad bot! This is a D6 patch.
Comment #23
vacilando commentedThis is a problem for Pantheon as well. Subscribing.
Comment #24
_-. commentedDid this patch make it into Drupal7 _release_? Or, n/a 'til next point release ... ?
Comment #25
mikeytown2 commentedI use this patch; anyone else want to test and give it the thumbs up so we can RTBC this?
This is in D7
Comment #26
canishk commented#14: 621748_multi_tier.patch queued for re-testing.
Comment #27
verta commented#19: drupal-621748-19.patch queued for re-testing.
(edit: just trying to figure out how to get this patch tested.)
Comment #29
mikeytown2 commented@verta
That patch needs to be re-rolled from git.
Comment #30
verta commentedOK, thanks.
Comment #31
dmitriy.trt commentedWhat about situation when we don't know exact IP address of trusted proxy? But we're sure that proxy exists. For example, we have a load balancer with dynamic internal IP address. So, we can't just add its IP to the list of reverse_proxy_addresses in settings.php, because it would work until the next IP address change.
My suggestion is to support "*" in reverse_proxy_addresses variable in addition to fixed IP addresses.
Comment #32
grendzy commentedDmitriy.trt: see #1310250: Improve reverse proxy ip address handing commenting and documentation.
Comment #33
dmitriy.trt commentedSetting
$_SERVER['REMOTE_ADDR']directly in settings.php is not perfect solution, but it is acceptable. Thanks.Comment #34
bradjones1No action for over a year indicates this isn't critical; also if this is still present in 7.x or 8.x, should be marked 8.x and backported as appropriate.
Comment #35
mikeytown2 commentedThis is fixed in 7.x (#15) and thus 8.x as well.
Main reason this isn't getting a lot of attention is most people who have this issue switch to pressflow. I'll see if I get some time today and do a re-roll of this.
Comment #36
robloachUpdated the patch. Would appreciate some testing.
Comment #37
jkealy commentedRob,
I'm going to test the patch this week. I'll let you know how it goes.
Best regards,
John Kealy
Comment #38
jkealy commentedRob,
Patch passed test on staging and was moved to production. The patch has solved the infinite redirect problem we were getting earlier on IP based logins. Thanks!
Cheers,
JK
Comment #39
agileware commentedCan confirm patch #36 works in production.