Perl's LWP modules not working with CSF

Post Reply
GoWilkes
Junior Member
Posts: 29
Joined: 15 Nov 2010, 20:57

Perl's LWP modules not working with CSF

Post by GoWilkes »

I don't know how long this has been going on, I only recently discovered it in my error logs. Many years ago, though, I used to write Perl scripts and import the output from a PHP file using LWP::Simple. Like so:

Code: Select all

#!/usr/bin/perl 

use LWP::Simple;

$getHeader = get('http://www.example.com/header.php');

print "Content-type: text/html\n\n";
print $getHeader;
exit;
I recently saw a ton of these errors in my log, though:

Code: Select all

[Fri Nov 08 21:17:09.931673 2019] [cgi:warn] [pid 1983] [client 123.45.67.89:47530] AH01220: Timeout waiting for output from CGI script /home/example/public_html/cgi-bin/script.cgi, referer: http://www.example.com

[Fri Nov 08 21:17:09.932056 2019] [cgi:error] [pid 1983] [client 123.45.67.89:47530] Script timed out before returning headers: script.cgi, referer: http://www.example.com
When I looked at the scripts with errors, I found that I was getting a fatal error when trying to load the PHP file.

I tried LWP::UserAgent, but it didn't work, either.

After much poking and prodding, I finally discovered that if I disable CSF then the scripts work! So the problem appears to be a security issue, something (somewhere) is blocking something (somewhere) that's required by LWP.

I didn't have any IPs in the Temporary Deny, and only 2 in the Permanent Deny. So I commented those two out and re-enabled CSF... the scripts worked fine! So one of those IPs, right?

I wanted to whitelist the IP so this doesn't happen again, so I tried to trace it down. I uncommented one of them, restarted it, and the scripts still worked. So it has to be the other one.

For the sake of testing, I uncommented it, too, then restarted. And... the scripts still worked.

So now I'm at a loss. I didn't actually change anything, but restarting CSF seemed to clear the issue. But if that's the case, how do I make sure this problem doesn't happen again?
Post Reply