Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1512639 - setsebool -P changes file mode of /etc/selinux/targeted/active/users_extra from installation value
Summary: setsebool -P changes file mode of /etc/selinux/targeted/active/users_extra fr...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libsemanage
Version: 7.4
Hardware: x86_64
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Vit Mojzis
QA Contact: Jan Zarsky
URL:
Whiteboard:
: 1561022 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-11-13 18:24 UTC by Skip Wyatt
Modified: 2018-10-30 09:36 UTC (History)
13 users (show)

Fixed In Version: libsemanage-2.5-12.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-10-30 09:35:42 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 3251591 None None None 2017-11-26 16:07:15 UTC
Red Hat Product Errata RHBA-2018:3088 None None None 2018-10-30 09:36:06 UTC
Red Hat Bugzilla 1512014 None None None Never

Description Skip Wyatt 2017-11-13 18:24:29 UTC
Description of problem:
setsebool -P changes file mode of /etc/selinux/targeted/active/users_extra from installation value

Version-Release number of selected component (if applicable):
RHEL 7.4
selinux-policy-targeted-3.13.1-166.el7_4.4.noarch

How reproducible:
Consistent 

Steps to Reproduce:
1. Install system, note that file mode of /etc/selinux/targeted/active/users_extra is 0600 
2. setsebool -P mozilla_plugin_can_network_connect 1
3. New file mode is 0644

Actual results:
File mode changes.

Expected results:
File mode should not change

Additional info:
This will trigger permissions drift and a STIG finding.

Comment 7 Petr Lautrbach 2018-03-05 17:21:22 UTC
It looks like it came with this patch https://github.com/SELinuxProject/selinux/commit/8702a865e08b5660561e194a83e4a363061edc03 which provided some optimization when for setting booleans.

The problem is that it uses for users_extra and seusers default file-mode which is 644. "file-mode" can be changed in /etc/selinux/semanage.conf (file-mode=0600) But it would have a side effect that some of other files would not be readable for users, e.g. matchpathcon would stop work for regular uses.


The patch seems to be just to change from sh->conf->file_mode to 0

--- a/libsemanage/src/direct_api.c
+++ b/libsemanage/src/direct_api.c
@@ -1447,7 +1447,7 @@ rebuild:
                        retval = semanage_copy_file(path,
                                                    semanage_path(SEMANAGE_TMP,
                                                                  SEMANAGE_STORE_SEUSERS),
-                                                   sh->conf->file_mode);
+                                                   0);
                        if (retval < 0)
                                goto cleanup;
                        pseusers->dtable->drop_cache(pseusers->dbase);
@@ -1460,7 +1460,7 @@ rebuild:
                        retval = semanage_copy_file(path,
                                                    semanage_path(SEMANAGE_TMP,
                                                                  SEMANAGE_USERS_EXTRA),
-                                                   sh->conf->file_mode);
+                                                   0);
                        if (retval < 0)
                                goto cleanup;
                        pusers_extra->dtable->drop_cache(pusers_extra->dbase);

Comment 8 Lon Hohberger 2018-03-27 13:54:38 UTC
*** Bug 1561022 has been marked as a duplicate of this bug. ***

Comment 14 errata-xmlrpc 2018-10-30 09:35:42 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://access.redhat.com/errata/RHBA-2018:3088


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