Repository navigation
unix_selinux
Andrea Paolini edited this page Dec 15, 2022
·
3 revisions
semodule --list-modules=full
Look at /var/log/audit/audit.log . Are you getting any deny?
grep " denied " /var/log/audit/audit.log
Based on audit.log, you can generate the rules for a custom policy modules.
See why it is failing:
grep "mydaemon" /var/log/audit/audit.log | audit2why
See the proposed rules:
grep "mydaemon" /var/log/audit/audit.log | audit2allow -m my-daemon
Does it seem OK? Generate the module. If you prefix your custom rules with "my-" those will be easier to find.
grep "mydaemon" /var/log/audit/audit.log | audit2allow -M my-daemon
This will generate a my-daemon.pp and a my-daemon.te files
Install the new module with priority 300
semodule -X 300 -i my-daemon.pp
Now you can remove the *.te and the *.pp file
If you have the module file in text format in ''my-daemon.te'' :
checkmodule -M -m -o my-daemon.mod my-daemon.te
semodule_package -o my-daemon.pp -m my-daemon.mod
semodule -X 300 -i my-daemon.pp
rm my-daemon.mod my-daemon.pp my-daemon.te
restorecon -v myfile
touch /.autorelabel and reboot
Work in progress...