OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Subscriber unable to gain access

Are you responsible for making OJS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
What to do if you have a technical problem with OJS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a development question, try the OJS Development subforum.

Subscriber unable to gain access

Postby AndyP » Tue Apr 24, 2007 7:49 am

We have a subscriber who is unable to see full text articles. Their subscription is via IP address, not a log in. When I add our own IP to their subscription I have no problem viewing the full text whilst not logged in to the site.

Their IP address ranges are entered in the form:

192.22.127.0-192.22.127.255;193.26.192.0-193.26.215.255

These are not the actual numbers. I have asked them to use http://www.whatismyipaddress.com/ to confirm that the machine they are testing the system from is within the range and it seems to be fine.

Any suggestions?
AndyP
 
Posts: 57
Joined: Wed Mar 22, 2006 8:21 am

Postby asmecher » Tue Apr 24, 2007 9:29 am

Hi Andy,

Depending on their ISP, they may be behind an array of proxy servers; if so, their IP will change unpredictably. You might need to assign an entire subnet, or you might be best off giving that user a login-based subscription.

Regards,
Alec Smecher
Open Journal Systems Team
---
Don't miss the First International PKP Scholarly Publishing Conference
July 11 - 13, 2007, Vancouver, BC, Canada
http://ocs.sfu.ca/pkp2007/
asmecher
 
Posts: 8832
Joined: Wed Aug 10, 2005 12:56 pm

Re: Subscriber unable to gain access

Postby AndyP » Mon Sep 03, 2007 9:04 am

Hi Alec

We appear to be having problems with some subscriptions that use proxy servers (but not others). OJS seems to be reading the private IP address for authentication rather than the proxy address.

Do you have any suggestions?

Thanks

Andy
AndyP
 
Posts: 57
Joined: Wed Mar 22, 2006 8:21 am

Re: Subscriber unable to gain access

Postby asmecher » Mon Sep 03, 2007 10:24 am

Hi Andy,

Unfortunately, there seems to be a bit of variability with respect to the particular server environment variables that are used to provide information such as proxy IPs etc. You may have to do a little bit of investigation on your server to find out what variable is being used. It's referenced in classes/core/Request.inc.php in the getRemoteAddr function.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8832
Joined: Wed Aug 10, 2005 12:56 pm

Re: Subscriber unable to gain access

Postby AndyP » Tue Sep 04, 2007 4:32 am

Hi Alec

The code appears to get the HTTP_X_FORWARDED_FOR ip address, in preference to the REMOTE_ADDR. In cases where there are multiple ip address's it is taking the first one (which from what I've read would be the address of the user rather than the proxy).

From what I can ascertain, some users with proxy servers are gaining access, whilst others aren't. If I change the code to give preference to REMOTE_ADDR rather than the HTTP_X_FORWARDED_FOR ip will this block access to other users?

I have read that some servers use the variable HTTP_X_FORWARDED - should I be trying to detect this as well?

The current code is:

function getRemoteAddr() {
static $ipaddr;
if (!isset($ipaddr)) {
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ipaddr = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else if (isset($_SERVER['REMOTE_ADDR'])) {
$ipaddr = $_SERVER['REMOTE_ADDR'];
}
if (!isset($ipaddr) || empty($ipaddr)) {
$ipaddr = getenv('REMOTE_ADDR');
}
if (!isset($ipaddr) || $ipaddr == false) {
$ipaddr = '';
}

// If multiple addresses are listed, take the first. (Supports ipv6.)
if (preg_match('/^([0-9.a-fA-F:]+)/', $ipaddr, $matches)) {
$ipaddr = $matches[1];
}
HookRegistry::call('Request::getRemoteAddr', array(&$ipaddr));
AndyP
 
Posts: 57
Joined: Wed Mar 22, 2006 8:21 am


Return to OJS Technical Support

Who is online

Users browsing this forum: No registered users and 4 guests