bislinks bislinks - 1 month ago 8
Perl Question

Perl/CGI not working for /home/user/cgi but working for /var/www/cgi-bin

My Server is

CentOS7

Apache 2.4

SELinux enabled.

Perl/CGI is working for /var/www/cgi-bin directory but not working for /home/user/cgi directory.

error-log shows the following errors for test.pl:

[Fri Jan 08 19:53:05.725795 2016] [cgi:error] [pid 7311] [client *:33769] End of script output before headers: test.pl
[Fri Jan 08 19:54:10.981964 2016] [cgi:error] [pid 7314] [client *:33770] End of script output before headers: test.pl


perl -w test.pl shows no error on command line.

SELinux settings for /home/user/cgi directory is

drwxr-xr-x.  4 unconfined_u:object_r:httpd_sys_script_exec_t:s0 user user   83 Jan  8 20:05 .
drwxr-xr-x. 11 unconfined_u:object_r:user_home_dir_t:s0 user user 4096 Jan 7 12:08 ..
-rwxr-xr-x. 1 unconfined_u:object_r:httpd_sys_script_exec_t:s0 user user 90 Jan 8 20:05 test.pl


Content of test.pl

#!/usr/bin/perl

print "Content-type: text/html; charset=utf-8\n\n";
print "Hello\n\n";


httpd.conf


Options Indexes FollowSymLinks Includes ExecCGI
AddHandler cgi-script .cgi .pl
Require all granted
DirectoryIndex index.pl index.cgi


Link to httpd related sebool options:
sebool
Greatly appreciate help...

Answer

I got it.

The problem was caused by this line:

SuexecUserGroup "#1000" "#1000"

Problem resolved once I removed that directive.