Bug #7019
closedCould not upload inventory when SELinux is enabled
Description
Rudder 3.1.0, Centos 7:
2015-07-21T11:54:47+0000 error: /default/doInventory/methods/'any'/default/sendInventory/files/'/var/rudder/inventories'[0]: Finished command related to promiser '/var/rudder/inventories' -- an error occurred, returned 22 2015-07-21T11:54:47+0000 error: /default/doInventory/methods/'any'/default/sendInventory/files/'/var/rudder/inventories'[0]: Transformer '/var/rudder/inventories/server-root.ocs' => '/usr/bin/curl -k -f -s --proxy '' --user rudder:rudder -T /var/rudder/inventories/server-root.ocs https://127.0.0.1/inventory-updates/' returned error 2015-07-21T11:54:47+0000 error: /default/doInventory/methods/'any'/default/sendInventory/files/'/var/rudder/inventories'[0]: Finished command related to promiser '/var/rudder/inventories' -- an error occurred, returned 22 2015-07-21T11:54:47+0000 error: /default/doInventory/methods/'any'/default/sendInventory/files/'/var/rudder/inventories'[0]: Transformer '/var/rudder/inventories/server-root.ocs.sign' => '/usr/bin/curl -k -f -s --proxy '' --user rudder:rudder -T /var/rudder/inventories/server-root.ocs.sign https://127.0.0.1/inventory-updates/' returned error
The request returns a 403, and works after a setenforce 0.
Updated by Alexis Mousset over 9 years ago
- Subject changed from Could not upload inventory when SELinux is enbaled to Could not upload inventory when SELinux is enabled
Updated by Alexis Mousset over 9 years ago
in audit.log:
type=AVC msg=audit(1437480952.366:1982): avc: denied { write } for pid=15973 comm="httpd" name="accepted-nodes-updates" dev="dm-1" ino=68976571 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:httpd_sys_content_t:s0 tclass=dir type=AVC msg=audit(1437480952.579:1983): avc: denied { write } for pid=3189 comm="httpd" name="accepted-nodes-updates" dev="dm-1" ino=68976571 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:httpd_sys_content_t:s0 tclass=dir
Updated by Alexis Mousset over 9 years ago
- Related to Bug #7021: When SELinux is enabled, the ncf-api-venv home is owned by root added
Updated by Alexis Mousset over 9 years ago
- Status changed from New to In progress
Adding the httpd_sys_rw_content_t context to the directories receiving inventories in /var/rudder/inventories fixes the issue.
Updated by Alexis Mousset over 9 years ago
The rudder-webapp package contains:
chcon -R --type=httpd_sys_content_t /var/rudder/inventories/incoming chcon -R --type=httpd_sys_content_t /var/rudder/inventories/accepted-nodes-updates
but httpd_sys_content_t is read-only, and chcon changes are temporary.
The is an example of file context packaging on Fedora wiki.
Updated by Alexis Mousset over 9 years ago
- Status changed from In progress to Discussion
- Assignee changed from Alexis Mousset to Matthieu CERDA
Using semanage would add a new dependency (policycoreutils-python). We could also split the selinux-related code into a subpackage to keep it optional, or keep chcon (which does not survive a file system relabel or restorecon).
Matthieu, what do you think is the best option?
Updated by Matthieu CERDA over 9 years ago
- Assignee changed from Matthieu CERDA to Alexis Mousset
- fix the chcon first, to get an immediate fix
- see if we can adjust rudder-packages/rudder-webapp/SOURCES/rudder-webapp.te to declare this directory permissions, and just trigger a restorecon in the package postinst to automatically apply the right perms on it :)
Does it look like a good idea to you ?
Updated by Alexis Mousset over 9 years ago
- Status changed from Discussion to In progress
I found it is also possible to add a .fc file defining file contexts, and it is clearly the right way to do it.
Updated by Alexis Mousset over 9 years ago
- Status changed from In progress to Pending technical review
- Assignee changed from Alexis Mousset to Benoît PECCATTE
- Pull Request set to https://github.com/Normation/rudder-packages/pull/719
Updated by Alexis Mousset over 9 years ago
- Status changed from Pending technical review to Pending release
- % Done changed from 0 to 100
Applied in changeset rudder-packages|1b609150a2275b5758355562f6afdd370c2391c9.
Updated by Benoît PECCATTE over 9 years ago
Applied in changeset rudder-packages|20d2b797885f811a498d6652f84e850e7dd83e4f.
Updated by François ARMAND over 9 years ago
- Status changed from Pending release to Released
This bug has been fixed in Rudder 3.1.1 which was released today.
- Announcement 3.1
- Changelog 3.1
- Download information: https://www.rudder-project.org/site/get-rudder/downloads/