Hi Stefan,

Am 09.07.2015 um 13:46 schrieb Stefan Eissing:
I need some help with establishing a test baseline. I checked out the test 
framework from  https://svn.apache.org/repos/asf/httpd/test/framework/trunk, 
followed the README and ran the tests against a freshly installed 2.4.x in 
/opt/httpd/2.4-plain. It did PASS with the default httpd.conf, but many tests 
were skipped due to modules missing.

I tried enable some more modules like mod_ssl or mod_rewrite and all of these 
attempts led to test failures and perl errors such as
"t/security/CVE-2011-3368-rewrite.t .. 1/3 # Failed test 1 in 
t/security/CVE-2011-3368-rewrite.t at line 13
Can't call method "print" on an undefined value at 
t/security/CVE-2011-3368-rewrite.t line 19.
"
My perl is the default Ubuntu 14.04 perl 5.18.

Is this a failure on my part or is the system supposed to operate like this? I 
am a bit confused...

I typically use the default config from fresh build I do with configure flags --enable-modules=reallyall and --enable-load-all-modules.

I don't get failures as described by you above. I typically run the perl framework with perl plus locally installed modules. To instal modules as a normal user separate from the system installed perl I use local::lib. The stuff I add is Bundle::ApacheTest and recent versions of Test::Harness, Crypt::SSLeay, Net:SSLeay, IO::Socket::SSL, LWP::Protocol::https, HTTP::DAV (plus whatever cpan automatically adds as further dependencies). The list probably could be shortened, but that's the cruft I accumulated over time. When building the HTTPS/SSL parts one must be careful to use the same OpenSSL version that one uses to build the web server. Sometimes this is a bit tricky.

The failure in line 19 you describe happens at the end of the following snippet:

my $sock = Apache::TestRequest::vhost_socket();
ok $sock && $sock->connected;

my $req = "GET @"."localhost/foobar.html HTTP/1.1\r\n".
   "Host: " . Apache::TestRequest::hostport() . "\r\n".
    "\r\n";

ok $sock->print($req);

So it seems $sock is not defined. And indeed the failure in line 13 is the ok check in the second code line above. So the test could not connect to the vhost.

Using t/TEST (try help or -help or -h to see the options) you can also just start the web server configured for the tests without immediately running them. You can then try to connect yourself.

You can also edit LogLevel in Apache-Test/lib/Apache/TestConfig.pm and increase it before the perl Makefile.PL and the t/TEST to get more log output.

Not likely but maybe your system openssl is used by perl and can't connect to a vhost powered by some other OpenSSL that you build your web server against?

The vhost_socket() used by the test is defined in lib/Apache/TestRequest.pm as:

sub vhost_socket {
    my $module = shift;
    local $Apache::TestRequest::Module = $module if $module;

    my $hostport = hostport(Apache::Test::config());

    my($host, $port) = split ':', $hostport;
    my(%args) = (PeerAddr => $host, PeerPort => $port);

    if ($module and $module =~ /ssl/) {
        require Net::SSL;
local $ENV{https_proxy} ||= ""; #else uninitialized value in Net/SSL.pm
        return Net::SSL->new(%args, Timeout => UA_TIMEOUT);
    }
    else {
        require IO::Socket;
        return IO::Socket::INET->new(%args);
    }
}

Maybe you can add some debug output to STDOUT there to see to which socket it tries to connect and where it fails.

Finally: any locally active pieces of security software intercepting the connect?

Regards,

Rainer

Reply via email to