1 use Test::More tests => 4;
8 use POSIX ":sys_wait_h";
15 require 't/common.pl';
17 my $debug = $config{debug};
18 my $stderr = '2>/tmp/stderr';
23 diag("SCEP Client Test: GetCACert");
26 my $cgi_dir = $config{cgi_dir};
30 if (system("$sscep >/dev/null $stderr") != 0) {
31 skip "sscep binary not installed.", 4;
33 if (! (`$config{openssl} version` =~ m{\A OpenSSL\ 0\.9\.8 }xms)) {
34 skip "OpenSSL 0.9.8 not available.", 4;
38 # create configuration
39 open my $HANDLE, ">", "$cgi_dir/scep.cfg";
40 print $HANDLE "[global]\n";
41 print $HANDLE "socket=$config{socket_file}\n";
42 print $HANDLE "realm=I18N_OPENXPKI_DEPLOYMENT_TEST_DUMMY_CA\n";
43 print $HANDLE "iprange=127.0.0.0/8\n";
44 print $HANDLE "profile=I18N_OPENXPKI_PROFILE_TLS_SERVER\n";
45 print $HANDLE "servername=testscepserver1\n";
46 print $HANDLE "encryption_algorithm=3DES\n";
49 ok(copy("bin/scep", $cgi_dir));
50 chmod 0755, $cgi_dir . '/scep';
52 my $scep_uri = "http://127.0.0.1:$config{http_server_port}/cgi-bin/scep";
54 my $cacert_base = "$config{server_dir}/cacert";
64 # recoverable fork error
65 if ($redo_count > 5) {
66 print STDERR "FAILED.\n";
67 print STDERR "Could not fork process\n";
77 print STDERR "FAILED.\n";
78 print STDERR "Could not fork process: $ERRNO\n";
85 # child process pid is available in $pid
88 # use the sscep client to get the CA certificates
89 ok(system("$sscep getca -v -d -u $scep_uri -c $cacert_base $stderr") == 0);
92 ok(-r "$cacert_base-$index");
98 $kid = waitpid(-1, WNOHANG);
104 # parent process pid is available with getppid
106 # start a minimal HTTP server to test the CGI
107 my $http_server = getcwd . "/t/http_server.pl";
109 exec("perl $http_server $config{http_server_port}");