[CentOS] SELInux conflict with Postfixadmin

Tue Feb 21 16:55:56 UTC 2017
Robert Moskowitz <rgm at htt-consult.com>


On 02/21/2017 11:46 AM, Zdenek Sedlak wrote:
> On 2017-02-21 17:30, Robert Moskowitz wrote:
>> postfixadmin setup.php is claiming:
>>
>> *Error: Smarty template compile directory templates_c is not writable.*
>> *Please make it writable.*
>> *If you are using SELinux or AppArmor, you might need to adjust their
>> setup to allow write access.*
>>
>>
>> This goes away with 'setenforce 0', so it is an SELinux issue.  I have
>> tried both:
>>
>> restorecon -Rv /usr/share/postfixadmin
>>
>> and
>>
>> chcon -R -t httpd_sys_content_t /usr/share/postfixadmin
>>
>> and they are not the problem.  Googling this message doe snot produce
>> any SELinux advice.
>>
>> Any ideas?
>>
>> thanks
>>
>> _______________________________________________
>> CentOS mailing list
>> CentOS at centos.org
>> https://lists.centos.org/mailman/listinfo/centos
> Hi,
>
> after 'setenforce 0' check the /var/log/audit/audit.log:
>
> # grep /var/log/audit/audit.log | audit2why
>
> to see where  the problem could be.

Playing around a little with this, I added templates_c as the grep 
string and got:

type=AVC msg=audit(1487695678.704:128): avc:  denied  { write } for 
pid=2055 comm="httpd" name="templates_c" dev="sda3" ino=786958 
scontext=system_u:system_r:httpd_t:s0 
tcontext=unconfined_u:object_r:httpd_sys_content_t:s0 tclass=dir 
permissive=1

         Was caused by:
         The boolean httpd_unified was set incorrectly.
         Description:
         Allow httpd to unified

         Allow access by executing:
         # setsebool -P httpd_unified 1

So I tried that, and the error went away.  Going to have to add 
audit2why in my notes.

thanks