Bug 962752 - sepolicy generate: Errors when running setup script for generated admin_user policy
sepolicy generate: Errors when running setup script for generated admin_user ...
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: policycoreutils (Show other bugs)
7.0
All Linux
medium Severity medium
: rc
: ---
Assigned To: Daniel Walsh
Michal Trunecka
:
Depends On:
Blocks: 917049
  Show dependency treegraph
 
Reported: 2013-05-14 07:41 EDT by Michal Trunecka
Modified: 2014-09-30 19:34 EDT (History)
3 users (show)

See Also:
Fixed In Version: policycoreutils-2.1.14-63.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-09-10 08:17:58 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
sepolicy-generate.patch (7.06 KB, patch)
2013-06-19 05:55 EDT, Miroslav Grepl
no flags Details | Diff

  None (edit)
Description Michal Trunecka 2013-05-14 07:41:53 EDT
Description of problem:

Setup script throws
  1) Warnings about deprecated macros
  2) Errors about missing requirements that make the script fail


Policy generated by following command:
   sepolicy generate -n testpolicy --admin_user -a firewalld


Here follows the output of setup script:

# ./testpolicy.sh 
Building and Loading Policy
+ make -f /usr/share/selinux/devel/Makefile testpolicy.pp
Compiling targeted testpolicy module
testpolicy.te:7: Warning: pcscd_manage_pub_files(passwd_t) has been deprecated
testpolicy.te:7: Warning: pcscd_manage_pub_pipes(passwd_t) has been deprecated
/usr/bin/checkmodule:  loading policy configuration from tmp/testpolicy.tmp
/usr/bin/checkmodule:  policy configuration loaded
/usr/bin/checkmodule:  writing binary representation (version 17) to tmp/testpolicy.mod
Creating targeted testpolicy.pp policy package
rm tmp/testpolicy.mod tmp/testpolicy.mod.fc
+ /usr/sbin/semodule -i testpolicy.pp
libsepol.print_missing_requirements: testpolicy's global requirements were not met: bool testpolicy_read_user_files (No such file or directory).
libsemanage.semanage_link_sandbox: Link packages failed (No such file or directory).
/usr/sbin/semodule:  Failed!



Version-Release number of selected component (if applicable):
policycoreutils-2.1.14-40.el7.x86_64
Comment 1 Daniel Walsh 2013-05-16 13:16:00 EDT
Fixed in policycoreutils-2.1.14-44
Comment 2 Michal Trunecka 2013-05-24 04:15:44 EDT
There is still the message about deprecated macro:

testpolicy.te:7: Warning: pcscd_manage_pub_files(passwd_t) has been deprecated
testpolicy.te:7: Warning: pcscd_manage_pub_pipes(passwd_t) has been deprecated

It concerns the following options:

--admin_user  
--dbus  
--desktop_user 
--sandbox  
--term_user 
--x_user
Comment 3 Michal Trunecka 2013-06-14 05:22:02 EDT
libsepol error is back in  policycoreutils-2.1.14-46.2.el7.x86_64
Comment 4 Daniel Walsh 2013-06-18 13:07:37 EDT
   sepolicy generate -n testpolicy --admin_user -a firewalld

really should be

   sepolicy generate -n testpolicy --confined_admin -a firewalld
Comment 5 Daniel Walsh 2013-06-18 13:10:36 EDT
Depracated wanings should be fixed in selinux-policy-3.12.1-53.el7.noarch
Comment 6 Michal Trunecka 2013-06-19 03:18:52 EDT
Ok, I see. Then the following part of sepolicy generate --help message should be removed:

... [ --admin_user -a  ADMIN_DOMAIN | ...

The man page is correct regarding this.
Comment 7 Miroslav Grepl 2013-06-19 05:54:06 EDT
Ok, how about

... [ --admin_user -r  TRANSITIONING_DOMAIN | ...

# sepolicy generate -n testpolicy --admin_user -r wine

which will generate rules for administrative user and 

# cat testpolicy.te

...
...
...

optional_policy(`
    wine_run(testpolicy_t, testpolicy_r)
')
Comment 8 Miroslav Grepl 2013-06-19 05:55:45 EDT
Created attachment 762828 [details]
sepolicy-generate.patch
Comment 9 Daniel Walsh 2013-06-19 10:11:35 EDT
--admin_user -r  TRANSITION_ROLE
Comment 10 Miroslav Grepl 2013-06-19 10:17:12 EDT
(In reply to Daniel Walsh from comment #9)
> --admin_user -r  TRANSITION_ROLE

Better.
Comment 11 Daniel Walsh 2013-06-19 13:30:10 EDT
fixed in policycoreutils-2.1.14-56.el7
Comment 12 Michal Trunecka 2013-06-20 08:36:19 EDT
Yes, it's working fine.

Only last thing, the man page should be altered accordingly (-r option with admin_user).



And a bit off topic not deserving new bug, but the following line is doubled in man page:
       sepolicy generate --inetd [-n NAME] [-w WRITE_PATH ] command
       sepolicy generate --inetd [-n NAME] [-w WRITE_PATH ] command
Comment 13 Daniel Walsh 2013-06-21 08:48:37 EDT
fixed in policycoreutils-2.1.14-57.el7
Comment 14 Michal Trunecka 2013-06-24 09:09:42 EDT
There is still the old way in man page (policycoreutils-2.1.14-59.el7.x86_64):
       sepolicy generate --admin_user [-a ADMIN_ROLE] -n NAME
Comment 15 Daniel Walsh 2013-06-27 10:09:39 EDT
rpm -q policycoreutils
policycoreutils-2.1.14-59.fc20.x86_64

I don't see this with the rawhide package.

man sepolicy-generate | grep admin_user
       sepolicy generate --admin_user -n NAME
       --admin_user
Comment 16 Michal Trunecka 2013-06-27 10:27:00 EDT
That is interesting then. To be sure, I erased and reinstalled the policycoreutils-python and -devel packages, but still:

# rpm -q policycoreutils
policycoreutils-2.1.14-60.el7.x86_64

# man sepolicy-generate | grep admin_user
       sepolicy generate --admin_user [-a ADMIN_ROLE] -n NAME
       --admin_user
Comment 17 Daniel Walsh 2013-07-11 15:18:59 EDT
fixed in policycoreutils-2.1.14-63.el7
Comment 18 Michal Trunecka 2013-07-16 07:12:49 EDT
I really regret to annoy you with this again.

# rpm -q policycoreutils
policycoreutils-2.1.14-63.el7.x86_64

# man sepolicy-generate | grep admin_user
       sepolicy generate --admin_user [-a TRANSITION_ROLE] -n NAME

Here it should be -r, not -a  ----------^
Comment 19 Miroslav Grepl 2013-09-10 08:17:58 EDT
$ man sepolicy-generate | grep admin_user
       sepolicy generate --admin_user [-r TRANSITION_ROLE] -n NAME
       --admin_user

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