Perl CGI setup.

8 views
Skip to first unread message

Watt

unread,
Oct 19, 2008, 10:03:27 PM10/19/08
to antiweb
I tried to execute a pl cgi. I put in the :cgi (pl) and put the
test.pl file in the root directory. However the file is served as
text file. What would be the right setup to execute the script?
Thanks for your help.



Watt P.

do...@hcsw.org

unread,
Oct 20, 2008, 4:17:09 AM10/20/08
to ant...@googlegroups.com

Sounds like you forgot to reload the conf file after.

Do this as root:

antiweb -reload /var/aw/worker.conf

Once .pl has been registered as a CGI extension it should never
serve the contents of such files. If it does, please report
that because it is a very serious bug (especially if your
scripts contain DB passwds and such). Lighttpd and nginx both
had problems with \0 characters appended to scripts revealing
their contents:

http://www.securityfocus.com/bid/12567/discuss
http://osdir.com/ml/web.nginx.english/2006-04/msg00013.html

I tried my best to make sure this never happens in AW. Pathnames
are never stored in nul terminated C-style strings. Instead,
they are stored in lisp strings which store the length separately
(so they can contain nul characters--although we disallow that
in pathnames anyways).

Anyways where was I? Oh ya, reload your conf file like I say
above and then check the following:

1) Make sure the file ends in .pl

2) Make sure it is world executable:

chmod a+x /var/www/domain.com/test.pl

3) Make sure you print a content-type and a blank line. Here
is a simple script to test with:

#!/usr/bin/perl

print "Content-Type: text/html; charset=utf-8\r\n\r\n";
print "hi";


Once you've got this working, you should be able to "use CGI;"
and all the usual perl CGI stuff. Note there are a few
(IMO non-critical) env variables that aren't supported yet.

Good luck,

Doug

signature.asc
Reply all
Reply to author
Forward
0 new messages