Tuesday, July 31, 2007

SELinux

I was struggling to install MT4 on a fresh CentOS installation. Building a LAMP Server was a decent guide, but I got stuck at setting up MT4. The 'mt-wizard.cgi' could not find it's own 'mt-static' directory. But the directory would navigate just fine from a browser client. Was MT4-RC1 broken?

I went to the MT::App:Wizard Perl module and edited the function which was testing for {mt-dir}/mt-static/styles.css file, which is how MT determines the location of 'mt-static' folder within its own installation. Adding simple print statements gave the state of the LWP::UserAgent variable.

print STDERR $response->status_line

This output (to the Apache error log of this VirtualHost) an error message similar to "500 Connection refused to {servername}:80. Permission denied". I tried writing my own test perl scripts using LWP::UserAgent and LWP::Simple to verify if either MT4 or Perl themselves weren't broken within the environment.

Finally found /var/log/messages log file that recorded each attempt and access denied. The log file was very helpful. Learnt about SELinux's role over Apache as a security measure. So I tried modifying the local policy as described, but it didn't work. So finally had to change SELinux mode from enforcing to permissive in it's config file at /etc/selinux/config.

SELINUX=permissive

Have to learn more about SELinux and it's role in Linux, Apache, etc.