<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="https://www.stress-free.co.nz"  xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>stressfree - selinux</title>
 <link>https://www.stress-free.co.nz/tech/selinux</link>
 <description></description>
 <language>en</language>
<item>
 <title>Mounting CIFS shares at login with SELinux enabled</title>
 <link>https://www.stress-free.co.nz/mounting_cifs_shares_at_login_with_selinux_enabled</link>
 <description>
  &lt;div class=&quot;field-body&quot;&gt;
    &lt;div class=&quot;image&quot;&gt;&lt;img src=&quot;/sites/default/files/u63/selinux.jpg&quot; title=&quot;undefined&quot; width=&quot;100&quot; height=&quot;100&quot; onmouseover=&quot;undefined&quot; onmouseout=&quot;undefined&quot; /&gt;&lt;/div&gt;&lt;p&gt;&lt;a href=&quot;http://www.nsa.gov/selinux/&quot;&gt;SELinux&lt;/a&gt; is as painful to use sometimes as it is powerful when it comes to locking down server permissions. Unfortunately even with distributions such as Red Hat which &lt;a href=&quot;http://www.redhat.com/security/innovative/selinux/&quot;&gt;supports SELinux out of the box&lt;/a&gt;, you will still experience problems. &lt;/p&gt;&lt;p&gt;One such issue I came across recently was automounting CIFS shares on boot using &lt;a href=&quot;http://www.hscripts.com/tutorials/linux-services/netfs.html&quot;&gt;netfs&lt;/a&gt;. At startup the netfs service was returning an &quot;error 13 - error opening credentials file&quot; when attempting to mount the CIFS shares. The problem was the SELinux was not allowing the netfs script to access the file that contained the CIFS authorisation details.&lt;/p&gt;&lt;p&gt;For example, my &lt;strong&gt;/etc/fstab&lt;/strong&gt; had the following entry:&lt;/p&gt;&lt;p class=&quot;codesnippet&quot;&gt;//WINDOWSSERVER/SHARE          /mnt/windowsshare             cifs    credentials=/etc/samba/auth.cifs        0 0&lt;/p&gt;&lt;p&gt;And in the &lt;strong&gt;/etc/samba/auth.cifs&lt;/strong&gt; file were the following details:&lt;/p&gt;&lt;p class=&quot;codesnippet&quot;&gt;username=windowsuser&lt;br /&gt;password=windowspassword&lt;/p&gt;&lt;p&gt;The solution to the problem was to change a SELinux boolean parameter with the following command (&lt;a href=&quot;http://www.engardelinux.org/modules/index/list_archives.cgi?list=fedora-selinux&amp;amp;page=0189.html&amp;amp;month=2008-02&quot;&gt;found here&lt;/a&gt;):&lt;/p&gt;&lt;p class=&quot;codesnippet&quot;&gt;setsebool -P allow_mount_anyfile 1&lt;/p&gt;&lt;p&gt;This lets the mount command open any referenced file, effectively side-stepping the netfs error. Sure it is not 100% secure but it works without having to completely disable SELinux which seems to be most people&#039;s answer to any problems.&lt;/p&gt;&lt;!--break--&gt;  &lt;/div&gt;

&lt;ul class=&quot;field-taxonomy-vocabulary-1&quot;&gt;

      &lt;li&gt;
      &lt;a href=&quot;/tech/linux&quot;&gt;linux&lt;/a&gt;    &lt;/li&gt;
      &lt;li&gt;
      &lt;a href=&quot;/tech/samba&quot;&gt;samba&lt;/a&gt;    &lt;/li&gt;
      &lt;li&gt;
      &lt;a href=&quot;/tech/selinux&quot;&gt;selinux&lt;/a&gt;    &lt;/li&gt;
  
&lt;/ul&gt;
</description>
 <pubDate>Sat, 17 May 2008 02:36:57 +0000</pubDate>
 <dc:creator>David</dc:creator>
 <guid isPermaLink="false">508 at https://www.stress-free.co.nz</guid>
</item>
</channel>
</rss>
