Miredo, a ipv6 over ipv4 tunnel tool is running without being confined. So here is a policy file for it. That's my first policy, and while I tested it ( and the tunnel is working ), that's also the first policy I wrote, based on various internet documentation. So some stuff could likely be missing ( like some interfaces ), or the policy could be overengineered, or too fragile, so I would welcome feedback on it. I tested on fedora 15, just installed miredo-client, started it, and tried to ping ipv6 enabled web site ( www.free.fr , in this case ). There is no message in /var/log/audit/audit.log, and everything work fine.
Created attachment 518336 [details] Type enforcement policy for miredo
Created attachment 518337 [details] interface for miredo policy
Created attachment 518338 [details] File context for miredo policy
require { type tun_tap_device_t; type random_device_t; type sysctl_kernel_t; type proc_net_t; type shell_exec_t; type bin_t; type ifconfig_exec_t; type proc_t; } Should never be used within a te file, that is being submitted for upstream use. You need to use interfaces. audit2allow -R Is helpful in finding interfaces that match the AVC's that you were seeing.
# for executing client_hook with bash # should we use corecmd_exec_shell ? allow miredo_helper_t shell_exec_t:file { read execute open }; allow miredo_helper_t bin_t:lnk_file read; Should be corecmd_exec_shell(miredo_helper_t) allow miredo_client_hook_t proc_t:file { read open getattr }; kernel_read_system_state(miredo_client_hook_t) allow miredo_t random_device_t:chr_file { read open }; dev_read_random(miredo_t) # miredo read ngroups_max and others files for changing dropping privileges allow miredo_t sysctl_kernel_t:file { read open }; allow miredo_t sysctl_kernel_t:dir search; Does miredo ever write to these devices? kernel_rw_kernel_sysctl(miredo_t) allow miredo_t proc_t:file read; kernel_read_system_state(miredo_t) allow miredo_t proc_net_t:file read; kernel_read_network_state(miredo_t) Interface definitions are stored in /usr/share/selinux/devel/include/...
I do not understand the comment #4, audit2allow tell me to use the various types with requires : # grep 1313436933.639:702307 /var/log/audit/audit.log | audit2allow -R require { type ifconfig_t; type miredo_client_hook_t; class process { siginh noatsecure rlimitinh }; } #============= miredo_client_hook_t ============== #!!!! This avc has a dontaudit rule in the current policy allow miredo_client_hook_t ifconfig_t:process { siginh rlimitinh noatsecure }; But i see the point about using interfaces, that's indeed clearer. There is lots of them, and it was not obvious at first sight which one would be useful. I will correct this and upload a new version of the .te file later after testing.
Are you running with dontaudit disabled. semodule -B will turn them back on and these AVC's will dissappear.
Yes, the avc was just here to act as a example. I disabled dontaudit to catch some avc that were silently ignored Trying to apply what you told me, I face a problem : + make -f /usr/share/selinux/devel/Makefile Compiling targeted miredo module /usr/bin/checkmodule: loading policy configuration from tmp/miredo.tmp miredo.te":87:ERROR 'syntax error' at token 'dev_read_random' on line 13776: dev_read_random(miredo_t) And a quick search show that dev_read_random do not seems to exist on f15. Regarding writing to /proc, I found by reading code that miredo write 0 to /proc/sys/net/ipv6/conf/teredo/accept_redirects , and I didn't catched it with my tests. However, it also fail silently ( and yet open a potential security problem with icmp redirect ). So read write access should be added to file with the sysctl_net_t , I assume that kernel_rw_net_sysctls is the proper interface.
Ok, so the missing interface is dev_read_urand . I removed all requires in the .te, and I will test and upload the new version for comment.
Created attachment 518520 [details] Type enforcement policy for miredo Newer version of the type enforcement policy
Created attachment 519237 [details] miredo.te patch I made some fixes and attached the patch for your .te file.
This message is a notice that Fedora 15 is now at end of life. Fedora has stopped maintaining and issuing updates for Fedora 15. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At this time, all open bugs with a Fedora 'version' of '15' have been closed as WONTFIX. (Please note: Our normal process is to give advanced warning of this occurring, but we forgot to do that. A thousand apologies.) Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, feel free to reopen this bug and simply change the 'version' to a later Fedora version. Bug Reporter: Thank you for reporting this issue and we are sorry that we were unable to fix it before Fedora 15 reached end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged to click on "Clone This Bug" (top right of this page) and open it against that version of Fedora. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. The process we are following is described here: http://fedoraproject.org/wiki/BugZappers/HouseKeeping