Bug 1670836 - SELinux prevents Cacti upgrade as it prevents writes on some directories
Summary: SELinux prevents Cacti upgrade as it prevents writes on some directories
Keywords:
Status: CLOSED DUPLICATE of bug 1644324
Alias: None
Product: Fedora
Classification: Fedora
Component: cacti
Version: 29
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Morten Stevens
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-01-30 12:26 UTC by Russell Odom
Modified: 2019-01-30 13:46 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-01-30 13:46:51 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Russell Odom 2019-01-30 12:26:56 UTC
Description of problem:
I'm upgrading from cacti-1.2.0-2.fc29.noarch to cacti-1.2.1-1.fc29.noarch; after logging in (having worked around bug 1670725!), I am going through the upgrade screens. On the "Directory Permission Checks" screen (https://example.com/cacti/install/install.php?data={%22Step%22:%224%22,%22Eula%22:true}) I am getting errors:

Required Writable at Install Time Only
/usr/share/cacti/resource/snmp_queries/
Not Writable
/usr/share/cacti/resource/script_server/
Not Writable
/usr/share/cacti/resource/script_queries/
Not Writable
/usr/share/cacti/scripts/
Writable

The "Next" button is greyed out so I cannot proceed past this screen. Disabling SELinux with `setenforce 0` and reloading the page allows me to proceed. After completing the upgrade, I've re-enabled with `setenforce 1`.

Version-Release number of selected component (if applicable):
cacti-1.2.1-1.fc29.noarch

How reproducible:
Haven't tried

Steps to Reproduce:
1. Upgrade Cacti
2. Go through upgrade process to "Directory Permission Checks" screen
3. Observe error above

Actual results:
Upgrade can't continue

Expected results:
Upgrade should be allowed

Additional info:
[root@gigalith ~]# ls -ldZ /usr/share/cacti/resource/snmp_queries/ /usr/share/cacti/resource/script_server/ /usr/share/cacti/resource/script_queries/
drwxr-xr-x. 2 apache apache system_u:object_r:usr_t:s0 4096 Jan 30 12:16 /usr/share/cacti/resource/script_queries/
drwxr-xr-x. 2 apache apache system_u:object_r:usr_t:s0 4096 Jan 30 12:16 /usr/share/cacti/resource/script_server/
drwxr-xr-x. 2 apache apache system_u:object_r:usr_t:s0 4096 Jan 30 12:16 /usr/share/cacti/resource/snmp_queries/

Comment 1 Russell Odom 2019-01-30 12:37:23 UTC
Relevant lines from journal:
Jan 30 12:16:36 host.example.com audit[7156]: AVC avc:  denied  { create } for  pid=7156 comm="php-fpm" name="1481563085c5195a4765ca.tmp" scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:usr_t:s0 tclass=file permissive=1
Jan 30 12:16:36 host.example.com audit[7156]: AVC avc:  denied  { write } for  pid=7156 comm="php-fpm" path="/usr/share/cacti/resource/snmp_queries/1481563085c5195a4765ca.tmp" dev="dm-0" ino=525469 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:usr_t:s0 tclass=file permissive=1
Jan 30 12:16:36 host.example.com audit[7156]: SYSCALL arch=c000003e syscall=257 success=yes exit=7 a0=ffffff9c a1=7fff5141a140 a2=241 a3=1b6 items=0 ppid=20141 pid=7156 auid=4294967295 uid=48 gid=480 euid=48 suid=48 fsuid=48 egid=480 sgid=480 fsgid=480 tty=(none) ses=4294967295 comm="php-fpm" exe="/usr/sbin/php-fpm" subj=system_u:system_r:httpd_t:s0 key=(null)
Jan 30 12:16:36 host.example.com audit: PROCTITLE proctitle=7068702D66706D3A20706F6F6C20777777
Jan 30 12:16:36 host.example.com audit[7156]: AVC avc:  denied  { unlink } for  pid=7156 comm="php-fpm" name="1481563085c5195a4765ca.tmp" dev="dm-0" ino=525469 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:usr_t:s0 tclass=file permissive=1
Jan 30 12:16:36 host.example.com audit[7156]: SYSCALL arch=c000003e syscall=87 success=yes exit=0 a0=7fd335aebeb8 a1=1 a2=7fd335aebebf a3=7fd346d08ef0 items=0 ppid=20141 pid=7156 auid=4294967295 uid=48 gid=480 euid=48 suid=48 fsuid=48 egid=480 sgid=480 fsgid=480 tty=(none) ses=4294967295 comm="php-fpm" exe="/usr/sbin/php-fpm" subj=system_u:system_r:httpd_t:s0 key=(null)
Jan 30 12:16:36 host.example.com audit: PROCTITLE proctitle=7068702D66706D3A20706F6F6C20777777
Jan 30 12:16:36 host.example.com audit[7156]: AVC avc:  denied  { remove_name } for  pid=7156 comm="php-fpm" name="19110479245c5195a47f06a.tmp" dev="dm-1" ino=393575 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:httpd_log_t:s0 tclass=dir permissive=1
Jan 30 12:16:36 host.example.com audit[7156]: AVC avc:  denied  { unlink } for  pid=7156 comm="php-fpm" name="19110479245c5195a47f06a.tmp" dev="dm-1" ino=393575 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:httpd_log_t:s0 tclass=file permissive=1
Jan 30 12:16:36 host.example.com audit[7156]: SYSCALL arch=c000003e syscall=87 success=yes exit=0 a0=7fd335847158 a1=1 a2=7fd33584715f a3=3534323937343031 items=0 ppid=20141 pid=7156 auid=4294967295 uid=48 gid=480 euid=48 suid=48 fsuid=48 egid=480 sgid=480 fsgid=480 tty=(none) ses=4294967295 comm="php-fpm" exe="/usr/sbin/php-fpm" subj=system_u:system_r:httpd_t:s0 key=(null)

This seems to be another missing SELinux permission unrelated to those dirs, relating to a different step of the process; I don't know what the effect would be if it was encountered while SELinux was enabled:
Jan 30 12:16:58 host.example.comk audit[10113]: AVC avc:  denied  { map } for  pid=10113 comm="php" path="/var/lib/cacti/cli/convert_tables.php" dev="dm-1" ino=395222 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:var_lib_t:s0 tclass=file permissive=1

Comment 2 Morten Stevens 2019-01-30 13:46:51 UTC
Write access is only needed during the installtion to these directories:

/usr/share/cacti/resource/snmp_queries/
/usr/share/cacti/resource/script_server/
/usr/share/cacti/resource/script_queries/
/usr/share/cacti/scripts/

Therefore we recommend you to disable selinux with "setenforce 0" only during the installation.
Please check: cacti.README.fedora (https://src.fedoraproject.org/rpms/cacti/blob/master/f/cacti.README.fedora)

With regard to all other selinux related issues with 1.2.x: Please check https://bugzilla.redhat.com/show_bug.cgi?id=1644324

*** This bug has been marked as a duplicate of bug 1644324 ***


Note You need to log in before you can comment on or make changes to this bug.