[CentOS] Getting perl CGI programs to work on CentOS 5 server

Mon Sep 22 16:42:58 UTC 2008
Paul Heinlein <heinlein at madboa.com>

On Mon, 22 Sep 2008, Andrew Allen wrote:

> I'm trying to get perl CGI programs to work from the cgi-bin 
> (actually a sub-directory cgi-bin/various) and have set appropriate 
> permissions using chmod 755. I'm currently testing using the 
> simplest cgi program, you know the one: [....]
>
> This has worked absolutely fine in the past, but now when I invoke 
> it, either nothing appears in the browser (Mozilla Firefox) or I get 
> "Internal Server Error" - any ideas please?

Is SELinux enabled? If so, the problem will show up in the audit logs:

   ausearch -c httpd -m avc

In general, you'll want to

1. make sure the security context on the CGI script and the directory
    tree that contains it is httpd_sys_script_exec_t, and

2. make sure that no SELinux booleans are in the way, httpd_enable_cgi
    in particular:

      getsebool httpd_enable_cgi

    If it's set to "off," then you'll want to enable it:

      setsebool httpd_enable_cgi=1

-- 
Paul Heinlein <> heinlein at madboa.com <> http://www.madboa.com/