Closed Bug 481313 Opened 17 years ago Closed 16 years ago

Give aus2 users a unique cookie.

Categories

(AUS Graveyard :: General, defect)

x86
macOS
defect
Not set
critical

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: oremj, Assigned: oremj)

Details

Attachments

(3 files, 1 obsolete file)

Attached patch Implements unique cookie (obsolete) — Splinter Review
Each user that visits aus2 needs to receive a unique cookie. Currently we do this with mod_usertrack, but it doesn't work very well with proxies. The patch below is untested (because I don't have a dev copy of aus2 set up), but should do the trick.
in the patch s/microtime()/microtime(true)/
I have a test env set up here: http://khan.mozilla.org:8080/VerifyAus We can apply the patch and see if acceptance tests work.
Comment on attachment 365336 [details] [diff] [review] Implements unique cookie >+//Are we behind a proxy and given the IP via an alternate enviroment variable? If so, use it. >+if (!empty($_SERVER["HTTP_X_FORWARDED_FOR"])) { >+ $ip = $_SERVER["HTTP_X_FORWARDED_FOR"]; >+} else { >+ $ip = $_SERVER["REMOTE_ADDR"]; >+} As we found out with bugzilla, $_SERVER["HTTP_X_FORWARDED_FOR"] can be an array of proxy servers, so we need to get the correct IP from it... Something like this code that I just took from some website: <?php function get_ip_list() { $tmp = array(); if (isset($_server['http_x_forwarded_for']) && strpos($_server['http_x_forwarded_for'],',')) { $tmp += explode(',',$_server['http_x_forwarded_for']); } elseif (isset($_server['http_x_forwarded_for'])) { $tmp[] = $_server['http_x_forwarded_for']; } $tmp[] = $_server['REMOTE_ADDR']; return $tmp; } ?>
Which of the IPs reflects the client IP, though? That's the one we want.
I think this will work: list($ip) = explode(', ',$_SERVER["HTTP_X_FORWARDED_FOR"]);
Attachment #365336 - Attachment is obsolete: true
Comment on attachment 365347 [details] [diff] [review] Patch with microtime and multiple IP fix. Looks good to me - passes acceptance tests and cookie issued as required.
Attachment #365347 - Flags: review+
Justin, when do you want to push this?
once you guys are satisfied it's ready for production, asap. would *really* like to get this in blocklist at the same time...but I am pretty sure the patch would be a different animal - separate bug?
Blocklist will require a separate patch, but it is blocked on Bug 479070 for now. Mike tested the patch and it appears to be production ready. Let's push tomorrow.
Checked this into AUS.
is this tested and ready to go?
Yeah, from our end. Since it involved a header change and acceptance tests passed wasn't feeling that QA needs to spend time on it. It's tagged for prod.
I'll close this bug out. The production push bug is Bug 480649.
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Attachment #365931 - Flags: review?(morgamic)
Comment on attachment 365931 [details] [diff] [review] Makes cookie name and domain configurable. I'm ok with this, but if someone doesn't update their config file it's gonna bork their AUS install.
Attachment #365931 - Flags: review?(morgamic) → review+
Acceptance tests still applied, patch was committed and tagged.
Status: REOPENED → RESOLVED
Closed: 17 years ago17 years ago
Resolution: --- → FIXED
Assignee: morgamic → oremj
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Attached patch Fix cookie nameSplinter Review
Cookie name was hard coded. This patch fixes the issue. Mike, will you commit this patch? I'll update after.
Attachment #385329 - Flags: review?(morgamic)
Comment on attachment 385329 [details] [diff] [review] Fix cookie name r=reed. I can commit this if you need somebody to.
Attachment #385329 - Flags: review?(morgamic) → review+
Yes please.
Checking in xml/index.php; /cvsroot/mozilla/webtools/aus/xml/index.php,v <-- index.php new revision: 1.24; previous revision: 1.23 done Tagging now.
Status: REOPENED → RESOLVED
Closed: 17 years ago16 years ago
Resolution: --- → FIXED
Tagged, AUS2_PRODUCTION, AUS2_STAGING, AUS2_RTM_200906260000
Can ops run some tests on the logs to ensure this is fixed before metrics runs a longer test (takes 2-3 days)? Please post results.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
(In reply to comment #23) > Can ops run some tests on the logs to ensure this is fixed before metrics runs > a longer test (takes 2-3 days)? Please post results. Ran several requests and only was issued a new cookie when my browser did not submit one.
Status: REOPENED → RESOLVED
Closed: 16 years ago16 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: