Virtualmin 3.96 mod_php forced off (how to revert to old behavior)

31 posts / 0 new
Last post
#1 Fri, 11/30/2012 - 14:37
lp86

Virtualmin 3.96 mod_php forced off (how to revert to old behavior)

I have various installs of Roundcube and Phpmyadmin on hundreds of machines, and this update has just disabled all of them.

I have removed the "php_admin_value engine Off" from the httpd.conf file and this has fixed it temporarily.

I need to know how to stop this from being reapplied (if that would happen) and how to stop it from being added to newly created virtual servers.

I checked in the default Apache configuration in the server template and this isn't even mentioned there.

Fri, 11/30/2012 - 16:33
JamieCameron

What PHP execution mode do you have set for these domains? If it is CGI or fcgid mode, then Virtualmin's disable of mod_php shouldn't have any effect.

Also, do you have a sharded install of phpMyAdmin, perhaps using a symlink from each domain's directory?

''

Fri, 11/30/2012 - 18:48
lp86

All domains are using fcgid, the PHP files in each domain work correctly, I use mod_php for Roundcube/Phpmyadmin. This is the easiest to support and keep updated on all of these machines.

Fri, 11/30/2012 - 18:57 (Reply to #3)
JamieCameron

So how did you set that up exactly? Do you have your domain configured to use mod_php just for one directory?

''

Fri, 11/30/2012 - 19:35
lp86

I just used the default configuration for new virtual sites (all sites are using cfgid the default), I put a new configuration file in /etc/httpd/conf.d with this in it.

Nothing had to be done to any site at all, I just had to put the roundcube/phpmyadmin files in their directory and the configuration in /etc/httpd/conf.d and it worked great.

AddHandler php5-script .php AddType text/html .php

to turn on mod_php for that directory. It worked wonderfully, it was available for all sites, and it is easy to maintain and update on multiple servers.

Fri, 11/30/2012 - 19:49 (Reply to #5)
JamieCameron

Could you post the file that you created in /etc/httpd/conf.d ?

''

Fri, 11/30/2012 - 19:52
lp86
# Roundcube 0.8.x for Virtualmin
# Updated 08.27.2012 lp
alias /webmail /usr/sw0/roundcube
<Directory /usr/sw0/roundcube/>
Options -Indexes
AllowOverride All
Allow from all
AddHandler php5-script .php
AddType text/html .php
</Directory>

I tried adding a "php_admin_value engine on" but that did not work.

Fri, 11/30/2012 - 22:42 (Reply to #7)
JamieCameron

Ok, the problem here is that mod_php is disabled for the domain (via the setting in the virtualhost blocks), but the roundcube alias will try to use mod_php to execute PHP scripts.

You can delete the php_admin_value Engine off directive from all your domains to fix the issue. However, this does open you up to an exploit by un-trusted domain owners.

Alternately, you can use Virtualmin to install roundcube into each domain separately.

''

Fri, 11/30/2012 - 22:47
lp86

Installing a separate copy for each domain is not a option. That would be a nightmare to support not to mention needing a database for each site.

There needs to be a option to stop this line from being added to the httpd.conf file. Or I need a way to counteract it.

I have a bit of perl that will wipe that from the httpd.conf file, Will it come back when changes are made to the domain? And I need to stop it from being added for new domains as well.

What file or configuration setting is making this "php_admin_value engine off" go in the configuration file?

Fri, 11/30/2012 - 22:53 (Reply to #9)
JamieCameron

Wait a few days, and we will release a Virtualmin update that makes it optional if this php_admin_value directive is added or not.

''

Fri, 11/30/2012 - 22:59
lp86

Excellent, Thank you!

Sun, 12/02/2012 - 04:12
helpmin

@lp86 I am jus curious.

Could you explain why you are not concerned about the security vulnerability? Maybe you have a different way of dealing with it?

Sun, 12/02/2012 - 05:37
bison

Hi JamieCameron or others.

Same problem here, I just upgraded to virtualmin 3.96, and now I cant get access to the phpmyadmin

when I try to access, the browser ask what to do with the index.php file ?????

How and WHERE can I correct this....

I`m in the middle of some db corrections, and now I´m stuck !

Best regards Bison

Sun, 12/02/2012 - 16:43
lp86
  • Open "/etc/httpd/conf/httpd.conf" with a editor, vi/nano/etc
  • Remove all instances of "php_admin_value engine Off"
  • Then restart Apache "/sbin/service httpd restart"
Sun, 12/02/2012 - 17:32
lenka

hi,

i am having the same problem but can't locate /etc/httpd/conf/httpd.conf

i have no httpd directory in etc?

my site is down but emails working and its been like this since friday! HELP!!

cheers lenka

Sun, 12/02/2012 - 17:56 (Reply to #15)
JamieCameron

If you are on Debian or Ubuntu, the config files are in /etc/apache2/sites-enabled

''

Sun, 12/02/2012 - 18:19
lenka

i only have:

php5 (directory) php.ini

in my etc directory?

Mon, 12/03/2012 - 03:16
Locutus

Another way to do this: Use a central installation of RoundCube on its own ghost in a Virtualmin vserver. Add Apache mod_rewrite redirects to that to all domains. I use this:

Http://webmail.customerdomain.tld -> https://webmail1.tiahost.de

I think this is probably the cleanest way to do this.

Mon, 12/10/2012 - 09:10
Pierrot

Hello,

Just discovered the same problem here, with these additionnal infos:

I have a bunch of sites, declared as virtual hosts and using fcgid, they do work fine with "Engine Off".

But on that same VPS, I have 9 sites sharing a common install of "spip" CMS: just one install of the core of the CMS in the master-site folder, one database for each domain. So the CMS is installed in the master-site "public_html", where I have a "sites" folder containing specifics for each slave-site (like a Drupal multi-site). Then each slave-site (declared as a virtual host to be able to have mail) has a Website redirect from its "/" to "/home/master/public_html" ...

The 8 slave-site have the same symptoms where Firefox asks what to do with the php file (like when php is not interpreted) ... The master-site does not have that problem !! After many many tests, we finally found out that we could fix the problem by just removing the "Engine Off" setting for each of the 8 slaves sites, we did this from Virtualmin (Webmin->servers->Apache->select a virtual server->PHP->Config values for PHP on top).

I'm kind of annoyed knowing now that this a security issue ... do you have any references about it ? is this major or just borderline ?

And yes, I'm also afraid of having to do this after each update of virtualmin ... could update at least not change the existing settings ?

Thanks! Pierre.

Mon, 12/10/2012 - 09:52
helpmin

This is a major security issue (like the other issue that was fixed followsymlinks). For example if you have untrusted sites (e.g. a site that could be easily hacked, but you thought the site was "isolated") or untrusted users ("who could be curious enough to peek into others config files").

Some also argue, that this well known (and very easy to exploit) security issue has been there for a long time, so that if somebody on your server were interested to collect your config passwords etc they probably did already :-)

Mon, 12/10/2012 - 15:50
Pierrot

Ok thanks. It applies to me, but I am using these features just for websites I manage. Customers do not have FTP access (there isn't FTP, just SFTP) ... so I guess I'm relatively safe ... But anyway, thanks for these infos.

Mon, 12/10/2012 - 15:57
helpmin

Any user on your server that can run/install php, ruby or python scripts (e.g. joomla, wordpress etc) can exploit this security issue.

Thu, 06/06/2013 - 00:12
untarded

Wait a few days, and we will release a Virtualmin update that makes it optional if this php_admin_value directive is added or not.

Has this been updated?

Thu, 06/06/2013 - 08:08
andreychek

Yup! After performing the upgrade, there will be a notice in Virtualmin asking if you want to perform the change.

-Eric

Thu, 06/06/2013 - 18:48 (Reply to #24)
untarded

I have a fresh install of 4.00 gpl. Can I set this on the server templates?

Thanks

Sat, 06/22/2013 - 09:40 (Reply to #25)
ReArmedHalo

I have fresh install as well but I built php and apache by hand. A friend helped me who also uses virtualmin. I don't have mod_php module at all actually and apache complains about php_admin_value being in the virtual host. Where is the option you are talking about ? Thanks

Wed, 08/19/2015 - 05:25
Junon

It's been a couple years since the original post and I have the same exact issue in the modern version of Virtualmin. Where do I find the option to disable php_admin value creation in httpd.conf ? It's said it appears on an upgrade, but I am assuming this was for when this was a couple years ago. Asking on version upgrade is not very useful today. Please let me know where to find this.

Wed, 08/19/2015 - 11:21 (Reply to #27)
andreychek

Is it an option to disable mod_php? Disabling mod_php will prevent those lines from being added.

That's the simplest way to handle that. Plus you'd end up saving yourself quite a bit of RAM by not having that module loaded in Apache :-)

-Eric

Thu, 11/19/2015 - 11:25
vijayr

I am also having similar issue where php files gets downloaded instead of executing when it is on CGI wrapper or FCGId. It only works when i remove "php_admin_value engine Off" from that particular Virtual Server.

It works fine with "php_admin_value engine Off" when it is on mod_php.

Is it safe to run php via FCGId with "php_admin_value engine Off" removed? If it is safe, how to make sure that line doesn't get added upon creation of a new virtual server.

Thu, 11/19/2015 - 12:33
vijayr

Solution provided by @ChrisLDN worked for me in the below thread https://www.virtualmin.com/node/25521

Solution: The solution that worked for me was to edit /etc/httpd/conf.d/php.conf

and replace these three lines:

<FilesMatch .php$>
SetHandler application/x-httpd-php
</FilesMatch>

with:

AddHandler php5-script .php

More info: http://ilovevirtualmin.com/tag/virtualmin-upgrade-php-5-3-to-php-5-4/

Sun, 05/01/2016 - 03:33
gyorgy.chityil@...

Raised this issue as a bug here https://www.virtualmin.com/node/40560

Topic locked