store | blogs | forums | twitter | facebook | wiki | mailing lists | downloads | support portal
Atomic Secure Linux
It is currently Wed Jun 19, 2013 6:30 pm

» Feed - Atomicorp

All times are UTC - 5 hours [ DST ]




Post new topic Reply to topic Share/Bookmark  [ 15 posts ] 
Author Message
 Post subject: problem with sessions
Unread postPosted: Tue May 08, 2012 2:00 pm 
Offline
Forum Regular
Forum Regular

Joined: Sun Mar 29, 2009 6:52 pm
Posts: 348
Hi guys.

I see you just pushed a php upgrade which was due to a CVE for security reasons.

Now there is a problem. I have built a site which was using sessions. Before the update everything was fine. After the update I simply couldn't log in ! I cheched the logs and found nothing. Then a customer contacted me who could see session errors (permission denied) and then I found out there was a session issue now.

I checked and found out a parallels kb which describes that you change the folder of session save in the control panel and you go and create under the private folder a folder for sessions which needs to have as user permissions user:psacln.
http://kb.parallels.com/en/7056

I still don't know how many have been impacted by this. But it is very strange. Both sites were working just fine just before the update !
This makes me believe the problem was caused by the php update.

Does anybody else confirm that ? Most cms wll probably not be affected since they store their sessions in database. However there are php applications that save sessions the "old way".

I really need an update from the ASL guys.


the errors were the following
Code:
 [warn] [client ] mod_fcgid: stderr: PHP Warning: session_start() [<a href='function.session-start'>function.session-start</a>]: open(/var/lib/php/session/sess_hgv6ibrkf72sdfgdger, O_RDWR) failed: Permission denied (13) in /var/www/vhosts/blahhh.com/httpdocs/main.php on line 1, referer: http://www.blahhh.com/login.php
----------------------------------------------
 [warn] [client ] mod_fcgid: stderr: PHP Warning: Unknown: open(/var/lib/php/session/sess_hgv6ibrkf72s6lgdfghreg, O_RDWR) failed: Permission denied (13) in Unknown on line 0, referer: http://blahhh.com/login.php
----------------------------------------------
[warn] [client ] mod_fcgid: stderr: PHP Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php/session) in Unknown on line 0, referer: http://blahhh.com/login.php


On the other site as I said there were zero errors. Which troubles me a lot.

Regards

_________________
Hello IT.
Phone : Blah Blah ....
Have you tried turning it on and off again ?
Phone : Blah Blah ....
....
I'm sorry, are you from the Past ?!
http://www.youtube.com/watch?v=-E4fm4Wqego


Top
 Profile  
 
 Post subject: Re: problem with sessions
Unread postPosted: Wed May 09, 2012 6:43 am 
Offline
Long Time Forum Regular
Long Time Forum Regular

Joined: Thu Dec 09, 2004 11:19 am
Posts: 1876
On a non-.13 system:

Code:
# ls -al /var/lib/php/
total 1960
drwxr-xr-x  3 root root    4096 Mar  4 16:37 .
drwxr-xr-x 26 root root    4096 Apr 13 10:12 ..
drwx-wx-wt  2 root root 1994752 May  9 11:40 session


Is this the same as yours?

Incidentally, I note the KB you linked to only applies to Plesk earlier than 10.4.

It also lists perms for the sessions directory that are different to the ones on my system.

I'm wondering if Plesk changes perms during install, and that the .13 php set them back to a default or something?

_________________
--------------------------------
<advert>
If you want to rent a UK-based VPS that comes with friendly advice and support from a fellow ART fan, please get in touch.
</advert>


Top
 Profile  
 
 Post subject: Re: problem with sessions
Unread postPosted: Wed May 09, 2012 7:00 am 
Offline
Forum Regular
Forum Regular

Joined: Sun Mar 29, 2009 6:52 pm
Posts: 348
faris wrote:
On a non-.13 system:

Code:
# ls -al /var/lib/php/
total 1960
drwxr-xr-x  3 root root    4096 Mar  4 16:37 .
drwxr-xr-x 26 root root    4096 Apr 13 10:12 ..
drwx-wx-wt  2 root root 1994752 May  9 11:40 session


Is this the same as yours?

Incidentally, I note the KB you linked to only applies to Plesk earlier than 10.4.

It also lists perms for the sessions directory that are different to the ones on my system.

I'm wondering if Plesk changes perms during install, and that the .13 php set them back to a default or something?


Nope.
My permissions are drwxrwx--- 2 root apache 7512064 May 9 11:01 session
I will try changing the permissions now and let you know if it worked.

I have no idea how this happened. All I know is that sessions wouldn't work after the upgrade and they only worked after I did this change on the kb. It is very strange...

_________________
Hello IT.
Phone : Blah Blah ....
Have you tried turning it on and off again ?
Phone : Blah Blah ....
....
I'm sorry, are you from the Past ?!
http://www.youtube.com/watch?v=-E4fm4Wqego


Top
 Profile  
 
 Post subject: Re: problem with sessions
Unread postPosted: Wed May 09, 2012 7:09 am 
Offline
Forum Regular
Forum Regular

Joined: Sun Mar 29, 2009 6:52 pm
Posts: 348
Yeap. Its working now. S**t. That was weird ...

Probably others will have experienced the same thing after the php upgrade. I suggest you guys take a look on that issue on your servers ...

_________________
Hello IT.
Phone : Blah Blah ....
Have you tried turning it on and off again ?
Phone : Blah Blah ....
....
I'm sorry, are you from the Past ?!
http://www.youtube.com/watch?v=-E4fm4Wqego


Top
 Profile  
 
 Post subject: Re: problem with sessions
Unread postPosted: Sat Oct 06, 2012 6:16 pm 
Offline
New Forum User
New Forum User

Joined: Sat Oct 06, 2012 6:08 pm
Posts: 3
Location: Spain
Hello,

An older topic, but as I face the same problem I post here.

I just updated php on my Centos 5 vps from 5.2.17 to 5.3.17 from the atomic repo.

Since then I spent quite a few hours trying to figure out why some logins on some of my domains didn´t work anymore.

Thanks to this topic I found out why.

I do not want to upgrade my plesk, the kb article suggestion seems a lot of change for something that was working without a prob before the php update.

I tried to chmod the /var/lib/php/sessions folder to 777 but that was not good enough.

Is there any chance of a fix for this that doesnt involve upgrading plesk?

Thanks, greetings.


Top
 Profile  
 
 Post subject: Re: problem with sessions
Unread postPosted: Sun Oct 07, 2012 4:58 pm 
Offline
Forum Regular
Forum Regular

Joined: Sun Mar 29, 2009 6:52 pm
Posts: 348
Hello,

php sessions folder has nothing to do with plesk. It only has to do with PHP. So chmod 777 this folder and do an apache restart and it should fix the login problems you are facing. Every time the php is updated from thme repository this folder needs permissions to be changed to 777. Alternatively go to php.ini set a new folder name create the new folder, make it 777 and then when php updates it will not mess up with your custom folder.

By the way Plesk 9 and 10 and 11 work fine with php 5.3.x.

Hope I helped you out.


Dogs and things wrote:
Hello,

An older topic, but as I face the same problem I post here.

I just updated php on my Centos 5 vps from 5.2.17 to 5.3.17 from the atomic repo.

Since then I spent quite a few hours trying to figure out why some logins on some of my domains didn´t work anymore.

Thanks to this topic I found out why.

I do not want to upgrade my plesk, the kb article suggestion seems a lot of change for something that was working without a prob before the php update.

I tried to chmod the /var/lib/php/sessions folder to 777 but that was not good enough.

Is there any chance of a fix for this that doesnt involve upgrading plesk?

Thanks, greetings.

_________________
Hello IT.
Phone : Blah Blah ....
Have you tried turning it on and off again ?
Phone : Blah Blah ....
....
I'm sorry, are you from the Past ?!
http://www.youtube.com/watch?v=-E4fm4Wqego


Top
 Profile  
 
 Post subject: Re: problem with sessions
Unread postPosted: Sun Oct 07, 2012 6:12 pm 
Offline
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin

Joined: Wed Dec 31, 1969 8:00 pm
Posts: 7460
Location: earth
Quote:
[root@c6-64-qa ~]# ll /var/lib/php/
total 4
drwxrwx--- 2 root apache 4096 Jul 3 12:56 session

[root@c6-64-qa ~]# rpm -q php
php-5.3.3-14.el6_3.x86_64

[root@c6-64-qa ~]# yum -y upgrade php
<snip>

[root@c6-64-qa ~]# ll /var/lib/php/
total 4
drwxrwx--- 2 root apache 4096 Sep 18 2012 session

[root@c6-64-qa ~]# rpm -q php
php-5.3.17-10.el6.art.x86_64



So no, not true. Upgrading php has no effect on the permissions on /var/lib/php/session.


Top
 Profile  
 
 Post subject: Re: problem with sessions
Unread postPosted: Mon Oct 08, 2012 2:14 am 
Offline
Forum Regular
Forum Regular

Joined: Sun Mar 29, 2009 6:52 pm
Posts: 348
Hello Scott,

If the /var/lib/php/sessions folder is set to 777 and you upgrade php then this folder will turn into mod 770.
I am sure !



scott wrote:
Quote:
[root@c6-64-qa ~]# ll /var/lib/php/
total 4
drwxrwx--- 2 root apache 4096 Jul 3 12:56 session

[root@c6-64-qa ~]# rpm -q php
php-5.3.3-14.el6_3.x86_64

[root@c6-64-qa ~]# yum -y upgrade php
<snip>

[root@c6-64-qa ~]# ll /var/lib/php/
total 4
drwxrwx--- 2 root apache 4096 Sep 18 2012 session

[root@c6-64-qa ~]# rpm -q php
php-5.3.17-10.el6.art.x86_64



So no, not true. Upgrading php has no effect on the permissions on /var/lib/php/session.

_________________
Hello IT.
Phone : Blah Blah ....
Have you tried turning it on and off again ?
Phone : Blah Blah ....
....
I'm sorry, are you from the Past ?!
http://www.youtube.com/watch?v=-E4fm4Wqego


Top
 Profile  
 
 Post subject: Re: problem with sessions
Unread postPosted: Mon Oct 08, 2012 5:32 am 
Offline
New Forum User
New Forum User

Joined: Sat Oct 06, 2012 6:08 pm
Posts: 3
Location: Spain
Chmodding /var/lib/php/sessions to 777 and restarting Apache solved the problem, or at least it made my sessions work again.

If it hasn´t got to do with the php upgrade then maybe one of the dependencies that were installed/upgraded caused this?


Top
 Profile  
 
 Post subject: Re: problem with sessions
Unread postPosted: Mon Oct 08, 2012 7:11 am 
Offline
Long Time Forum Regular
Long Time Forum Regular

Joined: Sat Aug 20, 2005 9:30 am
Posts: 2812
Location: The Netherlands
This problem is fixed in the current Plesk 9/10/11 versions AFAIK: viewtopic.php?f=2&t=5868

Mode 0770 is fine with user root and group apache.

_________________
Lemonbit Internet Dedicated Server Management


Top
 Profile  
 
 Post subject: Re: problem with sessions
Unread postPosted: Mon Oct 08, 2012 9:42 am 
Offline
Long Time Forum Regular
Long Time Forum Regular

Joined: Thu Dec 09, 2004 11:19 am
Posts: 1876
Unfortunately we see session issues with php in fast-cgi mode with the "correct" permissions. It is very annoying. If they were 777 then it would be OK. But that would seem dangerous to me.

_________________
--------------------------------
<advert>
If you want to rent a UK-based VPS that comes with friendly advice and support from a fellow ART fan, please get in touch.
</advert>


Top
 Profile  
 
 Post subject: Re: problem with sessions
Unread postPosted: Mon Oct 08, 2012 10:03 am 
Offline
Long Time Forum Regular
Long Time Forum Regular

Joined: Sat Aug 20, 2005 9:30 am
Posts: 2812
Location: The Netherlands
The most secure way to deal with sessions is to configure a custom session.save_path per site anyway. I don't know why control panels don't set this up automatically, because it would also take away the confusion when a site tries to use a custom longer session lifetime (session.gc_maxlifetime) and finds out it doesn't work (because other sites are using the same directory for their session with a shorter lifetime and wipe out session files for all domains).

It's also pretty easy to read another site's session files if they're all in the same directory.

Oh, and if you're going to configure a custom session.save_path, please make sure you don't allow the webserver to serve session files to the public (for instance via .htaccess -> Deny from all).

_________________
Lemonbit Internet Dedicated Server Management


Top
 Profile  
 
 Post subject: Re: problem with sessions
Unread postPosted: Mon Oct 08, 2012 11:21 am 
Offline
Long Time Forum Regular
Long Time Forum Regular

Joined: Thu Dec 09, 2004 11:19 am
Posts: 1876
That's great advice. Thanks Breun.

What annoys me is:

a) There's a Plesk KB that tells you how to create a directory within the site's folder structure and use it as the session save path, then goes on to say that this isn't necessary as the bug that required it has been fixed.

b) Why doesn't the generic shared path work for php-fcgi? Or maybe I should ask why does it work for mod_php? Neither are root, both are user.group *.apache, yet only mod_php works. The Group on the folder (apache) has rwx. So I'm missing something, as usual!

_________________
--------------------------------
<advert>
If you want to rent a UK-based VPS that comes with friendly advice and support from a fellow ART fan, please get in touch.
</advert>


Top
 Profile  
 
 Post subject: Re: problem with sessions
Unread postPosted: Mon Oct 08, 2012 11:26 am 
Offline
Long Time Forum Regular
Long Time Forum Regular

Joined: Sat Aug 20, 2005 9:30 am
Posts: 2812
Location: The Netherlands
faris wrote:
b) Why doesn't the generic shared path work for php-fcgi? Or maybe I should ask why does it work for mod_php? Neither are root, both are user.group *.apache, yet only mod_php works. The Group on the folder (apache) has rwx. So I'm missing something, as usual!


Mode 0770, owner root and group apache works because mod_php is running code as user apache, which is in the apache group and users in the apache group are allowed to write to /var/lib/php/session. Plesk domain users are not in the apache group (nor root of course), so are indeed not be able to write to /var/lib/php/session if it's 0770 root/apache.

_________________
Lemonbit Internet Dedicated Server Management


Top
 Profile  
 
 Post subject: Re: problem with sessions
Unread postPosted: Mon Oct 08, 2012 12:50 pm 
Offline
Long Time Forum Regular
Long Time Forum Regular

Joined: Thu Dec 09, 2004 11:19 am
Posts: 1876
Ah. yes. Of course. Thanks Breun. apache is in apache, but [ftpuser] is not. I was thinking they were, but of course that wouldn't be right.

_________________
--------------------------------
<advert>
If you want to rent a UK-based VPS that comes with friendly advice and support from a fellow ART fan, please get in touch.
</advert>


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic Share/Bookmark  [ 15 posts ] 

» Feed - Atomicorp

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group