{"id":3958,"date":"2015-09-08T12:35:07","date_gmt":"2015-09-08T12:35:07","guid":{"rendered":"http:\/\/blog.bachi.net\/?p=3958"},"modified":"2015-11-20T13:48:22","modified_gmt":"2015-11-20T13:48:22","slug":"selinux-on-fedora","status":"publish","type":"post","link":"https:\/\/blog.bachi.net\/?p=3958","title":{"rendered":"SELinux on Fedora"},"content":{"rendered":"<p><a href=\"https:\/\/linux.web.cern.ch\/linux\/centos7\/docs\/rhel\/Red_Hat_Enterprise_Linux-7-SELinux_Users_and_Administrators_Guide-en-US.pdf\">SELinux User&#8217;s and Administrator&#8217;s Guide<\/a> (PDF)<\/p>\n<p><a href=\"https:\/\/de.wikipedia.org\/wiki\/SELinux\">Wikipedia: SELinux<\/a><br \/>\n<a href=\"https:\/\/wiki.centos.org\/HowTos\/SELinux\">CentOS Wiki: SELinux<\/a><br \/>\n<a href=\"http:\/\/www.techrepublic.com\/blog\/linux-and-open-source\/introduction-to-selinux-dont-let-complexity-scare-you-off\/\">Introduction to SELinux: Don&#8217;t let complexity scare you off<\/a><br \/>\n<a href=\"http:\/\/www.techrepublic.com\/blog\/linux-and-open-source\/practical-selinux-for-the-beginner-contexts-and-labels\/\">Practical SELinux for the beginner: Contexts and labels<\/a><\/p>\n<p><a href=\"https:\/\/access.redhat.com\/documentation\/en-US\/Red_Hat_Enterprise_Linux\/6\/html\/Security-Enhanced_Linux\/index.html\">Security-Enhanced Linux &#8211; User Guide<\/a><br \/>\n<a href=\"https:\/\/access.redhat.com\/documentation\/en-US\/Red_Hat_Enterprise_Linux\/6\/html\/Security-Enhanced_Linux\/chap-Security-Enhanced_Linux-Introduction.html#sect-Security-Enhanced_Linux-Introduction-Benefits_of_running_SELinux\">2.1. Benefits of running SELinux<\/a><br \/>\n<a href=\"https:\/\/access.redhat.com\/documentation\/en-US\/Red_Hat_Enterprise_Linux\/6\/html\/Security-Enhanced_Linux\/sect-Security-Enhanced_Linux-Enabling_and_Disabling_SELinux-Disabling_SELinux.html\">5.4.2. Disabling SELinux<\/a><\/p>\n<h3>TFTP<\/h3>\n<h4>Problem<\/h4>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ tftp 10.20.30.40 -c get \/app-nand.bin\r\nError code 0: Permission denied\r\n<\/pre>\n<h4>Solution<\/h4>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ cd \/var\/lib\/tftpboot\r\n$ ls -alZ \r\ndrwxrwxrwx. root root system_u:object_r:tftpdir_rw_t:s0 .\r\ndrwxr-xr-x. root root system_u:object_r:var_lib_t:s0   ..\r\n-rwxrwxrwx. root root system_u:object_r:user_home_t:s0 app-nand.bin\r\n\r\n$ cd ..\r\n$ restorecon -Rv tftpboot\r\nrestorecon reset \/var\/lib\/tftpboot\/app-nand.bin context system_u:object_r:user_home_t:s0-&gt;system_u:object_r:tftpdir_rw_t:s0\r\nrestorecon set context \/var\/lib\/tftpboot\/app-nand.bin-&gt;system_u:object_r:tftpdir_rw_t:s0 failed:'Operation not permitted'\r\n\r\n$ sudo restorecon -Rv tftpboot\r\nrestorecon reset \/var\/lib\/tftpboot\/app-nand.bin context system_u:object_r:user_home_t:s0-&gt;system_u:object_r:tftpdir_rw_t:s0\r\n\r\n$ cd tftpboot\r\n$ ls -alZ \r\ndrwxrwxrwx. root root system_u:object_r:tftpdir_rw_t:s0 .\r\ndrwxr-xr-x. root root system_u:object_r:var_lib_t:s0   ..\r\n-rwxrwxrwx. root root system_u:object_r:tftpdir_rw_t:s0 app-nand.bin\r\n\r\n$ tftp 172.21.6.53 -c get \/app-nand.bin\r\n$\r\n<\/pre>\n<p><a href=\"https:\/\/docs.fedoraproject.org\/en-US\/Fedora\/19\/html\/Security_Guide\/sect-Managing_Confined_Services-Samba-Configuration_examples.html\">Configuration examples<\/a><br \/>\n<a href=\"https:\/\/docs.fedoraproject.org\/en-US\/Fedora\/11\/html\/Security-Enhanced_Linux\/sect-Security-Enhanced_Linux-Working_with_SELinux-SELinux_Contexts_Labeling_Files.html\">SELinux Contexts &#8211; Labeling Files<\/a><\/p>\n<p><a href=\"https:\/\/de.wikipedia.org\/wiki\/Discretionary_Access_Control\">Discretionary Access Control (DAC)<\/a>, bei allen Linux Systemen f\u00fcr Files\/Directories<br \/>\n<a href=\"https:\/\/de.wikipedia.org\/wiki\/Role_Based_Access_Control\">Role Based Access Control (RBAC)<\/a>, bei SELinux f\u00fcr Prozesse<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ ls -Z file1\r\n-rw-rw-r--  user1  group1  unconfined_u:object_r:user_home_t:s0  file1\r\n       DAC: &lt;user&gt; &lt;group&gt; &lt;user&gt;       &lt;role&gt;   &lt;type&gt;    &lt;level&gt;\r\n<\/pre>\n<p>[code]<br \/>\n$ cat \/etc\/selinux\/targeted\/contexts\/files\/file_contexts.homedirs<br \/>\n# User-specific file contexts, generated via libsemanage<br \/>\n# use semanage command to manage system users to change the file_context<\/p>\n<p># Home Context for user unconfined_u<br \/>\n\/home\/[^\/]*\/.+              unconfined_u:object_r:user_home_t:s0<br \/>\n\/home\/[^\/]*\/.maildir(\/.*)?  unconfined_u:object_r:mail_home_rw_t:s0<br \/>\n\/home\/[^\/]*     -d          unconfined_u:object_r:user_home_dir_t:s0<br \/>\n\/home\/[^\/]*     -l          unconfined_u:object_r:user_home_dir_t:s0<br \/>\n\/home\/[^\/]*\/abc &#8212;          unconfined_u:object_r:mozilla_home_t:s0<br \/>\n\/home\/[^\/]*\/tmp -d          unconfined_u:object_r:user_tmp_t:s0<\/p>\n<pre class=\"brush: plain; title: GUI Tools; notranslate\" title=\"GUI Tools\">\r\n$ system-config-selinux\r\n\r\n$ yum install policycoreutils-devel\r\n$ yum install policycoreutils-gui\r\n$ sepolicy gui\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>SELinux User&#8217;s and Administrator&#8217;s Guide (PDF) Wikipedia: SELinux CentOS Wiki: SELinux Introduction to SELinux: Don&#8217;t let complexity scare you off Practical SELinux for the beginner: Contexts and labels Security-Enhanced Linux &#8211; User Guide 2.1. Benefits of running SELinux 5.4.2. Disabling SELinux TFTP Problem $ tftp 10.20.30.40 -c get \/app-nand.bin Error code 0: Permission denied Solution [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3958","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/3958","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3958"}],"version-history":[{"count":12,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/3958\/revisions"}],"predecessor-version":[{"id":4322,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/3958\/revisions\/4322"}],"wp:attachment":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3958"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3958"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3958"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}