• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

[BUG?] Wrong selinux contect {WEBSPACEROOT}/tmp/

LinqLOL

Basic Pleskian
Hi,

it seems {WEBSPACEROOT}/tmp/ has the wrong type context for SELinux. On site creation it has unconfined_u:eek:bject_r:user_home_t which makes it impossible for php (fcgi) to write session info to. I changed the type context to tmp_t and now it works. But this is a manual job :-(

Greets.
 
Could you please be more specific and describe this problem with more details? How and where it can be reproduced? Step-by-step instruction would be useful.
 
Sure!

Test Code

<?php
session_start();
$_SESSION['test'] = "TEST";
session_write_close();
?>.


PHP.INI

session.save_path = "/var/www/vhosts/xxxxxx.nl/tmp/"

Symptoms in error_log of site:

[Mon Oct 08 08:58:10 2012] [warn] [client X.X.X.X] mod_fcgid: stderr: PHP Warning: session_start(): open(/var/www/vhosts/tc-webshop.nl/tmp//sess_vl738sb6hp0v43nr61aug07ma6, O_RDWR) failed: Permission denied (13) in /var/www/vhosts/xxxxxxx.nl/httpdocs/wp-content/plugins/woocommerce/woocommerce.php on line 138
[Mon Oct 08 08:58:10 2012] [warn] [client X.X.X.X] mod_fcgid: stderr: PHP Warning: Unknown: open(/var/www/vhosts/xxxxxx.nl/tmp//sess_vl738sb6hp0v43nr61aug07ma6, O_RDWR) failed: Permission denied (13) in Unknown on line 0

Selinux audit

type=AVC msg=audit(1349685910.014:8256): avc: denied { write } for pid=28491 comm="php-cgi" name="tmp" dev=sda3 ino=9832561 scontext=system_u:system_r:httpd_sys_script_t:s0 tcontext=system_u:eek:bject_r:user_home_t:s0 tclass=dir
 
Temp fix

If people having the same problems, i made a small work-around script till Parallels fixes this.
Add the following script to a crontab and execute it once in 2 minutes or so.

Code:
#! /bin/bash
DIR="/var/www/vhosts"
cd $DIR
while read admin; do.
    if tmp="$DIR/$admin/tmp"; [[ -d "$tmp" ]]; then
         # tmp directorie does exist, change context
         echo "Fixing $DIR/$admin/tmp directory";
         chcon -t tmp_t $DIR/$admin/tmp
    fi
done < <( ls -d *.* )
 
Well seems very hard for Parallels to add it and in general with selinux issues we have to find out our own sollutions :)

Instead of using the script above the following commands will be better:

semanage fcontext -a -t tmp_t "/var/www/vhosts/([^/]*)/tmp"
semanage fcontext -a -t tmp_t "/var/www/vhosts/([^/]*)/var/tmp"
 
LinqLOL, do you have addon domains or additional ftp users for a webspace with incorrect selinux contexts? Are there any system users that have home directory inside your webspace (grep /etc/passwd for that). Please post all of them with their home directories (if you're hesitant to provide such information - I'm interested only in the directory nestedness properties, so you can change directory names).
 
@nikolay The servers I saw these problem only have 1 main domain and not addon domains. And no system users with home directory in a webroot.
 
Back
Top