Fresh Installation - Admin Login Access Denied

e107 CMS » Forums » e107 v1.x Support » Installation / Upgrade support << Previous thread | Next thread >>
neosin
Apr 04 2012, 10:32AM
Registered Member #29948
Joined: Aug 21 2006, 02:43PM
Posts: 4
I have read the E_token wiki page, it doesn't help.
I have read the Session Path configuration page, mine is setup properly.
I have Cleared My Cache.
I have emptied the server session cache and restarted the server.

I still cannot login to the admin.

Also I should mention that I cannot login on e107.org with Firefox, I have to use IE9. Why this is, I have no idea.

I've looked at the code for your implementation of CSRF and its more complicated that it needs to be. I would recommend looking at how Laravel implements CSRF in a fraction of the amount of code and complexity.
Go to top
Moc
Apr 04 2012, 12:19PM
  • e107 Site administrator
  • e107 Security Team
  • e107 Support Team
  • e107 Documentation Team
Registered Member #44563
Joined: Apr 12 2008, 03:01AM
Location: The Netherlands
Posts: 3514
It has been reported before 2 times now, so there is something wrong indeed though I would have expected far more reports if it would affect all installations so we need to narrow it down. I will get back to you asap with more info.


As for the e-token. It was originally written for the 2.0 version of e107 which is more properly coded. It has been backcoded into the 1.x branch which is much less structured and contains out-dated code and therefore required more hacks to get the e-token to work properly. Hope that the 2.0 will be more attractive to you
Go to top
MysterF
Apr 04 2012, 12:38PM
Registered Member #54659
Joined: Jan 31 2010, 02:19PM
Posts: 320
Can you tell us your php version? I noticed something when changing from php 5.3 to 5.2.17, I wont elaborate until I can see if there is a connection. -)
Go to top
OldNick
Apr 04 2012, 09:04PM
Registered Member #145419
Joined: Apr 04 2012, 08:56PM
Posts: 2
I just happened to try a fresh install today too, and ran into the same problem. In my case, the "cause" of the problem was that I was trying e107 on a local host without using a hostname. Are you trying to get to your server using the IP address?

The cause of my problem appears to be a bug in class2.php. e107 tries to parse out the domain and sub-domain and set those manually. It fails when the server is accessed by IP address and ends up setting the domain to '.'. It seems that my web browser (Firefox) rejects this as an invalid cookie. It never accepts the session cookie and all login attempts fail.
Go to top
neosin
Apr 05 2012, 04:51AM
Registered Member #29948
Joined: Aug 21 2006, 02:43PM
Posts: 4
MysterF wrote ...

Can you tell us your php version? I noticed something when changing from php 5.3 to 5.2.17, I wont elaborate until I can see if there is a connection. -)


PHP v5.3.8
Go to top
neosin
Apr 05 2012, 04:52AM
Registered Member #29948
Joined: Aug 21 2006, 02:43PM
Posts: 4
OldNick wrote ...

I just happened to try a fresh install today too, and ran into the same problem. In my case, the "cause" of the problem was that I was trying e107 on a local host without using a hostname. Are you trying to get to your server using the IP address?

The cause of my problem appears to be a bug in class2.php. e107 tries to parse out the domain and sub-domain and set those manually. It fails when the server is accessed by IP address and ends up setting the domain to '.'. It seems that my web browser (Firefox) rejects this as an invalid cookie. It never accepts the session cookie and all login attempts fail.



Yes I am developing on localhost using the 127.0.0.1 ip range.
Your experience is similar to mine.
Go to top
Moc
Apr 07 2012, 03:17AM
  • e107 Site administrator
  • e107 Security Team
  • e107 Support Team
  • e107 Documentation Team
Registered Member #44563
Joined: Apr 12 2008, 03:01AM
Location: The Netherlands
Posts: 3514
Both of you please check this: [-link-]
Use the e107 debug addon to find all PHP warnings, errors and notices. Look for similar warnings such as the one given in the wiki I linked.

Go to top
MysterF
Apr 07 2012, 06:59AM
Registered Member #54659
Joined: Jan 31 2010, 02:19PM
Posts: 320
neosin wrote ...

MysterF wrote ...

Can you tell us your php version? I noticed something when changing from php 5.3 to 5.2.17, I wont elaborate until I can see if there is a connection. -)


PHP v5.3.8

Can you try and see if it works with a version of php 5.2 in stead of 5.3? i.e. php 5.2.17
Go to top
GregTampa
Apr 17 2012, 08:47AM
Registered Member #26429
Joined: Apr 03 2006, 07:08PM
Posts: 68
might want to change your internet settings /security on your local zone...
Go to top
OldNick
Apr 17 2012, 08:33PM
Registered Member #145419
Joined: Apr 04 2012, 08:56PM
Posts: 2
From what I can tell, this has nothing to do with session settings or php version. It's not a client problem. The problem is in class2.php, on line 125. If the hostname for the site is an IP address, the domain name used to set the cookie is set to FALSE. On my test set up, I changed this line to:

$domain = $_SERVER['HTTP_HOST'];


That way, a valid domain name is used when the cookie is set. It's probably not a good idea to do this for a real/production site. I have no idea why the domain was originally set to FALSE in the IP case.
Go to top
MysterF
Apr 17 2012, 09:29PM
Registered Member #54659
Joined: Jan 31 2010, 02:19PM
Posts: 320
On a real website to prevent browsing via IP instead of domain name, you add this little line in htaccess (at least that's how I do it, for SEO reasons):

#----------------------------------------------------------------------
#redirect any requests using the IP address or the non-canonical hostname
#make sure rewrite engine is on, if not add it
#----------------------------------------------------------------------
RewriteCond %{HTTP_HOST} ^[0-9]+(\.[0-9]+){3}
RewriteRule (.*) http://www.your-domain.com/$1 [R=301,L]
[ Edited Apr 17 2012, 09:30PM ]
Go to top
Abney Park
Apr 26 2012, 12:34PM
Registered Member #145634
Joined: Apr 22 2012, 12:25PM
Location: South England ( UK )
Posts: 17
I too had this problem when installing e107 on one of my home machines today. I am using easyPHP as my local 'offline' web server. ( localhost / 127.0.0.1 ) Updated a few other 'online' sites recently without problems.

OS: Windows 7 Ultimate x64
PHP 5.3.9
Apache 2.2.21 VC9
MySQL 5.5.20

First off i installed e107 1.0.1 it installed fine but when i tried to login i got the ' Access Denied' message. This happened on all 5 of the major browsers.

Anyway i still had e107 1.0.0 core so installed that and it all seemed fine and i could log in. When i updated this install to version 1.0.1 the ' Access Denied' message came up again and i was unable to login. ( again same with all 5 major browsers )

After reading this thread i replaced class2.php from 1.0.1 with the version from 1.0.0 and i was then able to login again.

This means that the problem is in class2.php. Basicly the same issue as OldNick as i was installing e107 on my local machine.

If you compare the versions of class2.php more specifically the function 'cookie'

class2.php e107 1.0.1
function cookie($name, $value, $expire=0, $path = e_HTTP, $domain = "", $secure = 0)
{
	if(!e_SUBDOMAIN || (defined('MULTILANG_SUBDOMAIN') && MULTILANG_SUBDOMAIN === TRUE))
	{
		$domain = ".".e_DOMAIN;
	}

	setcookie($name, $value, $expire, $path, $domain, $secure);
}


class2.php e107 1.0.0
function cookie($name, $value, $expire=0, $path = e_HTTP, $domain = "", $secure = 0)
{
	if(defined('MULTILANG_SUBDOMAIN') && MULTILANG_SUBDOMAIN === TRUE)
	{
		$domain = e_DOMAIN;
	}
	setcookie($name, $value, $expire, $path, $domain, $secure);
}


Simply change

$domain = ".".e_DOMAIN;


on line 1616 in class2.php in version 1.0.1 to

$domain = e_DOMAIN;


found in version 1.0.0 and it will fix the problem nice and easy without any faffing about.

Hope this helps some others who are having same issue
[ Edited Apr 26 2012, 12:56PM ]
Go to top
Website
nlstart
Jun 27 2012, 03:16PM
nlstart
  • e107 Site administrator
  • e107 Core developer
  • e107 Translation Team Leader
Registered Member #29855
Joined: Aug 18 2006, 01:12AM
Location: Utrecht, The Netherlands
Posts: 5488
I can confirm that working locally with a link like http://127.0.0.1/yourwebsite does return ' access denied', even on a freshly installed website (v1.0.1 or v1.0.2 svn).

Unfortunately EasyPHP has this set-up as their default way of approaching an address. However, EasyPHP also supports (by default) calling your website with http://localhost/yourwebsite , so you can use that as an alternative.

On their Apache instructions EasyPHP refers to this decision with the help text:
"Due to incompatibilities with Windows Vista/Seven, 'localhost' is no longer used. Use '127.0.0.1' instead. For details, see FAQ"

There are some known possible issues for Windows Vista/Seven in combination with EasyPHP:
  • [5.3.3, Vista/Seven] Blank page or Warning: mysql_connect() [function.mysql-connect]: [2002] A connection attempt failed because the connected party did not (trying to connect via tcp://localhost:3306)
  • [5.3.3, Vista/Seven] Unexpected end of MySql... See log file?
  • [5.3.X, Vista/Seven/IPv6 enabled] Got connection problem with mysql and access to phpMyAdmin
Source: http://www.easyphp.org/faq.php
Go to top
Website
CaMer0n
Jun 27 2012, 04:09PM
CaMer0n
  • e107 Main site administrator
  • e107 Core developer
  • e107 Design Team
Registered Member #1013
Joined: Feb 27 2003, 06:41AM
Location: Las Vegas, NV, USA
Posts: 766
Should be corrected now in svn.
Go to top
nlstart
Jun 29 2012, 05:00PM
nlstart
  • e107 Site administrator
  • e107 Core developer
  • e107 Translation Team Leader
Registered Member #29855
Joined: Aug 18 2006, 01:12AM
Location: Utrecht, The Netherlands
Posts: 5488
Go to top
Website
 

Jump:     Back to top

Syndicate this thread: rss 0.92 Syndicate this thread: rss 2.0 Syndicate this thread: RDF
Powered by e107 Forum System