<font face="courier new,monospace"><br></font><br><div class="gmail_quote">On Fri, Feb 14, 2014 at 8:58 AM, Daniel J Walsh <span dir="ltr">&lt;<a href="mailto:dwalsh@redhat.com" target="_blank">dwalsh@redhat.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">-----BEGIN PGP SIGNED MESSAGE-----<br>
Hash: SHA1<br>
<div><div class="h5"><br>
On 02/14/2014 08:42 AM, Fulko Hew wrote:<br>
&gt; I made a package a long time ago, and over the years I&#39;ve been adding new<br>
&gt; features, but the correct? support of SELinux has always eluded me.<br>
&gt; Occasionally I encounter problems with new versions of Fedora and RHEL.<br>
&gt; Recently I was asked to support the installation of my RPM on RHEL 6<br>
&gt; systems, and I find that there are new SELinux feature/requirements.<br>
&gt;<br>
&gt; Its probably me, but I haven&#39;t found any instructions/how-tos that have<br>
&gt; really helped (me) in providing the steps for testing and making a package<br>
&gt; SELinux compatible.  I have something that works on older releases, but<br>
&gt; I&#39;ve probably done it wrong.<br>
&gt;<br>
&gt; There&#39;s lots of documentation about its concepts, but not anything that has<br>
&gt; helped me in porting.<br>
&gt;<br>
&gt; Scenario:<br>
&gt;<br>
&gt; Given a working RPM (with SELinux disabled)... what would the process be<br>
&gt; (with examples) of turning SELinux on, attempting to install and run the<br>
&gt; various applications, viewing security logs, and turning any errors<br>
&gt; detected into correct config files/commands that can be included in a<br>
&gt; spec-file/package.<br>
&gt;<br>
&gt; Thanks<br>
&gt;<br>
&gt; Fulko<br>
&gt;<br>
&gt;<br>
&gt;<br>
</div></div>&gt; -- selinux mailing list <a href="mailto:selinux@lists.fedoraproject.org">selinux@lists.fedoraproject.org</a><br>
&gt; <a href="https://admin.fedoraproject.org/mailman/listinfo/selinux" target="_blank">https://admin.fedoraproject.org/mailman/listinfo/selinux</a><br>
&gt;<br>
SELinux is a labeling system. You need to make sure any content that you<br>
provide to confined services is labeled correctly.  The way you do this is by<br>
using a command like semanage fcontext ...  in a post install and then using<br>
restorecon to fix the labels.<br>
<br>
SELinux also has the concept of booleans which allow users to modify the<br>
policy on the system.  Depending on what you app wants to do you might need to<br>
modify a boolean.<br>
<br>
Finally SELinux expects network ports to match some defaults.  If you want to<br>
change the default Network Port then you have to tell SELinux about this.<br>
<br>
semanage port ...<br>
<br>
SELinux error messages are stored in /var/log/audit/audit.log and called avc<br>
messages.<br>
<br>
ausearch -m avc -ts recent<br>
<br>
Can show you recent avc messages that your system received.<br></blockquote><div><span style="font-family:courier new,monospace"><br>For now, my spec file has a bunch of semanage/restorecon command pairs,<br>for such things as:<br>

<br>semanage fcontext -a -t httpd_sys_script_exec_t   myFile<br>semanage fcontext -a -t httpd_sys_rw_content_t    myOtherFile <br>semanage fcontext -a -t httpd_sys_content_t       yetOtherFiles<br><br>a) Is this the &#39;right&#39; way to do it?<br>

<br>b) an example of the new error/warning is:<br></span><br><span style="font-family:courier new,monospace">Feb 13 14:37:58 livecd kernel: type=1400 audit(1392320278.129:151): avc:  denied  { name_connect } for  pid=4517 comm=&quot;<a href="http://view_status.pl" target="_blank">view_status.pl</a>&quot; dest=27395 scontext=unconfined_u:system_r:httpd_sys_script_t:s0 tcontext=system_u:object_r:port_t:s0 tclass=tcp_socket<br>

<br></span><span style="font-family:courier new,monospace"><br></span></div></div><br>