RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1213540 - [RHEL7] New cobbler dir definitions needed in /var/lib/tftpboot
Summary: [RHEL7] New cobbler dir definitions needed in /var/lib/tftpboot
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: selinux-policy
Version: 7.3
Hardware: All
OS: Linux
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Simon Sekidde
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On: 1213530
Blocks: 1213534 1213535 1213539
TreeView+ depends on / blocked
 
Reported: 2015-04-20 17:52 UTC by Stephen Herr
Modified: 2015-11-19 10:32 UTC (History)
8 users (show)

Fixed In Version: selinux-policy-3.13.1-32.el7
Doc Type: Bug Fix
Doc Text:
Clone Of: 1213530
Environment:
Last Closed: 2015-11-19 10:32:39 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2300 0 normal SHIPPED_LIVE selinux-policy bug fix update 2015-11-19 09:55:26 UTC

Description Stephen Herr 2015-04-20 17:52:00 UTC
+++ This bug was initially created as a clone of Bug #1213530 +++

Description of problem:
The Cobbler daemon needs to be able to write certain files to the /var/lib/tftpboot directory to support PXE booting. A recent Cobbler update adds two new sub-directories that it needs to be able to write (images2 and aarch64), so their default selinux policy needs to be updated.

Version-Release number of selected component (if applicable):
All

How reproducible:
Always

Steps to Reproduce:
0. Be running with selinux in Enforcing.
1. Install a Cobbler daemon that is new enough to include aarch64 bootloader support (for example from Spacewalk 2.3 or newer upstream cobblers).
2. Get cobbler bootloaders for aarch64 (ex. by installing cobbler-loaders from Spacewalk 2.3)
3. Run "cobbler sync" to copy bootloaders into /var/lib/tftpboot
4. restorecon -R -v /var/lib/tftpboot/
5. "cobbler sync" again.

Actual results:
Sync fails due to a "permission denied" error thanks to not-updated selinux contexts. Relevant two line snip from /var/log/cobbler/cobbler.log:
Fri Apr 17 16:17:14 2015 - INFO | Exception occured: <type 'exceptions.IOError'>
Fri Apr 17 16:17:14 2015 - INFO | Exception value: [Errno 13] Permission denied: '/var/lib/tftpboot/aarch64/grub.cfg'

Expected results:
Sync succeeds successfully, no selinux denial.

Additional info:
A "permanent workaround" for this issue is to add the selinux context definitions for the new directories by hand using semanage (provided by the policycoreutils-python rpm):
# semanage fcontext -a -t cobbler_var_lib_t "/var/lib/tftpboot/aarch64(/.*)?"
# semanage fcontext -a -t cobbler_var_lib_t "/var/lib/tftpboot/images2(/.*)?"
# restorecon -R -v /var/lib/tftpboot/

This type of policy update is very standard for cobbler / tftpboot interaction, see for example this portion of the output of greping for tftpboot in file_contexts:
# grep tftpboot /etc/selinux/targeted/contexts/files/file_contexts
/var/lib/tftpboot(/.*)?         system_u:object_r:tftpdir_rw_t:s0
/var/lib/tftpboot/etc(/.*)?     system_u:object_r:cobbler_var_lib_t:s0
/var/lib/tftpboot/ppc(/.*)?     system_u:object_r:cobbler_var_lib_t:s0
/var/lib/tftpboot/grub(/.*)?    system_u:object_r:cobbler_var_lib_t:s0
/var/lib/tftpboot/s390x(/.*)?   system_u:object_r:cobbler_var_lib_t:s0
/var/lib/tftpboot/images(/.*)?  system_u:object_r:cobbler_var_lib_t:s0
...

We just need to do the same thing for the two new directories that cobbler needs to write, something like:
/var/lib/tftpboot/aarch64(/.*)? system_u:object_r:cobbler_var_lib_t:s0
/var/lib/tftpboot/images2(/.*)? system_u:object_r:cobbler_var_lib_t:s0

Comment 2 Milos Malik 2015-04-21 06:47:19 UTC
Please attach the list of SELinux denials:

# ausearch -m avc -m user_avc -m selinux_err -i -ts today

Comment 3 Stephen Herr 2015-04-21 13:15:03 UTC
# ausearch -m avc -m user_avc -m selinux_err -i -ts recent
----
type=SYSCALL msg=audit(04/21/2015 09:08:56.057:17292) : arch=x86_64 syscall=lstat success=no exit=-13(Permission denied) a0=0x7f00180022e0 a1=0x7f001fffd410 a2=0x7f001fffd410 a3=0x652e34366161746f items=0 ppid=1 pid=13774 auid=root uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=1897 comm=cobblerd exe=/usr/bin/python subj=system_u:system_r:cobblerd_t:s0 key=(null) 
type=AVC msg=audit(04/21/2015 09:08:56.057:17292) : avc:  denied  { getattr } for  pid=13774 comm=cobblerd path=/var/lib/tftpboot/aarch64/bootaa64.efi dev=dm-0 ino=1722122 scontext=system_u:system_r:cobblerd_t:s0 tcontext=unconfined_u:object_r:tftpdir_rw_t:s0 tclass=file 
----
type=SYSCALL msg=audit(04/21/2015 09:08:56.057:17291) : arch=x86_64 syscall=stat success=no exit=-13(Permission denied) a0=0x7f00180022e0 a1=0x7f001fffd860 a2=0x7f001fffd860 a3=0x652e34366161746f items=0 ppid=1 pid=13774 auid=root uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=1897 comm=cobblerd exe=/usr/bin/python subj=system_u:system_r:cobblerd_t:s0 key=(null) 
type=AVC msg=audit(04/21/2015 09:08:56.057:17291) : avc:  denied  { getattr } for  pid=13774 comm=cobblerd path=/var/lib/tftpboot/aarch64/bootaa64.efi dev=dm-0 ino=1722122 scontext=system_u:system_r:cobblerd_t:s0 tcontext=unconfined_u:object_r:tftpdir_rw_t:s0 tclass=file 
----
type=SYSCALL msg=audit(04/21/2015 09:08:56.058:17293) : arch=x86_64 syscall=stat success=no exit=-13(Permission denied) a0=0x7f0018004590 a1=0x7f001fffd360 a2=0x7f001fffd360 a3=0x652e34366161746f items=0 ppid=1 pid=13774 auid=root uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=1897 comm=cobblerd exe=/usr/bin/python subj=system_u:system_r:cobblerd_t:s0 key=(null) 
type=AVC msg=audit(04/21/2015 09:08:56.058:17293) : avc:  denied  { getattr } for  pid=13774 comm=cobblerd path=/var/lib/tftpboot/aarch64/bootaa64.efi dev=dm-0 ino=1722122 scontext=system_u:system_r:cobblerd_t:s0 tcontext=unconfined_u:object_r:tftpdir_rw_t:s0 tclass=file 
----
type=SYSCALL msg=audit(04/21/2015 09:08:56.058:17294) : arch=x86_64 syscall=open success=no exit=-13(Permission denied) a0=0x7f0018004590 a1=O_WRONLY|O_CREAT|O_TRUNC a2=0666 a3=0x0 items=0 ppid=1 pid=13774 auid=root uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=1897 comm=cobblerd exe=/usr/bin/python subj=system_u:system_r:cobblerd_t:s0 key=(null) 
type=AVC msg=audit(04/21/2015 09:08:56.058:17294) : avc:  denied  { write } for  pid=13774 comm=cobblerd name=bootaa64.efi dev=dm-0 ino=1722122 scontext=system_u:system_r:cobblerd_t:s0 tcontext=unconfined_u:object_r:tftpdir_rw_t:s0 tclass=file 
----
type=SYSCALL msg=audit(04/21/2015 09:08:56.058:17295) : arch=x86_64 syscall=stat success=no exit=-13(Permission denied) a0=0x7f00180022e0 a1=0x7f001fffd640 a2=0x7f001fffd640 a3=0x652e34366161746f items=0 ppid=1 pid=13774 auid=root uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=1897 comm=cobblerd exe=/usr/bin/python subj=system_u:system_r:cobblerd_t:s0 key=(null) 
type=AVC msg=audit(04/21/2015 09:08:56.058:17295) : avc:  denied  { getattr } for  pid=13774 comm=cobblerd path=/var/lib/tftpboot/aarch64/bootaa64.efi dev=dm-0 ino=1722122 scontext=system_u:system_r:cobblerd_t:s0 tcontext=unconfined_u:object_r:tftpdir_rw_t:s0 tclass=file

Comment 6 Miroslav Grepl 2015-07-08 15:54:55 UTC
Milos,
does

# semanage fcontext -a -t cobbler_var_lib_t "/var/lib/tftpboot/boot(/.*)?"

work correctly?

Comment 7 Milos Malik 2015-07-08 20:22:04 UTC
The AVCs mentioned in comment#5 disappears after applying comment#6.

Comment 14 errata-xmlrpc 2015-11-19 10:32:39 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-2300.html


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