<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Jun 16, 2014 at 12:19 PM, 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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000"><div><div class="h5">
    <br>
    <div>On 06/12/2014 10:14 AM, Richard Shaw
      wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">On Thu, Jun 12, 2014 at 6:56 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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
              <div bgcolor="#FFFFFF" text="#000000">
                <div>
                  <div>
                    <blockquote type="cite">
                      <div dir="ltr">
                        <div class="gmail_extra">
                          <div class="gmail_quote">
                            <div>The full unifi software is java with a
                              mongodb database backend and works fine. I
                              have a RPM I created, the only problem I
                              haven&#39;t been able to fix is the selinux
                              issues, one for the private mongodb
                              instance, and then the ports it binds to. </div>
                          </div>
                        </div>
                      </div>
                    </blockquote>
                  </div>
                </div>
                Please open a bugzilla for the SELinux issues.</div>
            </blockquote>
            <div><br>
            </div>
            <div>Before I open a BZ, here&#39;s what I have in my spec file
              which from what I understand should be persistent...</div>
            <div><br>
            </div>
            <div>
              <div>%posttrans</div>
              <div>/usr/sbin/semanage fcontext -e /var/lib/mongod
                &quot;/var/lib/unifi/logs(/.*)?&quot;</div>
              <div>/usr/sbin/semanage fcontext -e /var/lib/mongod
                &quot;/var/lib/unifi/data(/.*)?&quot;</div>
              <div>/usr/sbin/semanage port -m -t mongod_port_t 27117</div>
            </div>
            <div><br>
            </div>
            <div>Or should this be handled in a policy?</div>
            <div><br>
            </div>
            <div>Thanks,</div>
            <div>Richard</div>
          </div>
        </div>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
    </blockquote></div></div>
    I think your post install should look like.<br>
    <br>
    <div>/usr/sbin/semanage fcontext -e /var/log/mongod
      &quot;/var/lib/unifi/logs&quot;</div>
    <div>/usr/sbin/semanage fcontext -e /var/lib/mongod
      &quot;/var/lib/unifi/data&quot;</div><div class="">
    <div>/usr/sbin/semanage port -m -t mongod_port_t 27117</div>
    <br></div>
    Don&#39;t use the regex. Also I would figure the logs should be labeled
    mongod_log_t rather then mongod_lib_t.<br></div></blockquote><div><br></div><div>What is the concern with regex? It is specific to packaging? Most of the examples I found online used that method... As far as the label, since everything is getting dumped in /var/lib I figured that would be OK. </div>
<div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000">
If this is a standard location for this code, we should put it into
    the base package.</div></blockquote><div><br></div><div>There is not a standard install location, the install will &quot;work&quot; as long as everything stays in the same relative location (the unifi directory). Since it writes a lot of stuff I figured /var was the best (only?) real option. </div>
<div><br></div><div>Following the example of a draft wiki I can&#39;t find anymore I had modified the scripts to this instead of using %posttrans:</div><div><div>%post</div><div>semanage fcontext -a -t mongod_var_lib_t \<br>
</div><div>    &quot;%{_sharedstatedir}/unifi/logs(/.*)?&quot; 2&gt;/dev/null || :</div><div>semanage fcontext -a -t mongod_var_lib_t \</div><div>    &quot;%{_sharedstatedir}/unifi/data(/.*)?&quot; 2&gt;/dev/null || :</div>
<div>restorecon -R %{_sharedstatedir}/unifi/logs || :</div><div>restorecon -R %{_sharedstatedir}/unifi/data || :</div><div>semanage port -m -t mongod_port_t 27117 || :</div><div><br></div><div>%postun<br></div><div>if [ $1 -eq 0 ] ; then  # final removal<br>
</div><div>semanage fcontext -d -t mongod_var_lib_t \</div><div>    &quot;%{_sharedstatedir}/unifi/logs(/.*)?&quot; 2&gt;/dev/null || :</div><div>semanage fcontext -d -t mongod_var_lib_t \</div><div>    &quot;%{_sharedstatedir}/unifi/data(/.*)?&quot; 2&gt;/dev/null || :</div>
<div>fi</div></div><div><br></div><div>Thanks,</div><div>Richard</div></div></div></div>