App-CamelPKI
view release on metacpan or search on metacpan
'File::Slurp' => 0,
'File::Find' => 0,
'Cwd' => 0,
'Errno' => 0,
'LWP::Simple' => 0,
'LWP::UserAgent' => 0,
# 0.20 release comes with UTF-8 bugfixes :
'Convert::ASN1' => 0.20,
'IO::Socket::SSL' => 0, # App::CamelPKI::SysV::Apache
'Catalyst::View::TT' => 0,
'HTTP::Request::Form' => 0,
'HTML::TreeBuilder' => 0,
'HTTP::Request::Common' => 0,
'HTTP::Request' => 0,
'URI::URL' => 0,
'Module::ScanDeps' => 0,
},
add_to_cleanup => [ '*.gz', 'Build', 'META.yml' ],
create_makefile_pl => 'passthrough',
);
$builder->create_build_script();
1;
File::Find: 0
File::Path: 0
File::Slurp: 0
File::Spec: 0
File::Spec::Functions: 0
File::Spec::Unix: 0
File::Temp: 0
File::Which: 0
FindBin: 0
HTML::TreeBuilder: 0
HTTP::Request: 0
HTTP::Request::Common: 0
HTTP::Request::Form: 0
IO::File: 0
IO::Socket::SSL: 0
LWP::Simple: 0
LWP::UserAgent: 0
Module::Build: 0
Module::Build::Compat: 0
Module::ScanDeps: 0
Test::Builder: 0
Test::Group: 0
Test::More: 0
So, to resume, under Ubuntu, for minimum requirements (tests won't all be runned) :
In this case, the php front-end won't be usable with this apache instance(which is, by the way, not a good idea).
#apt-get install apache2 apache2-threaded-dev libapache2-mod-perl2 build-essential libnet-ssleay-perl libssl-dev
If you want to run the entire test suite, you need some other functionnalities. Install the with :
#apt-get install libapache2-mod-php5 php5-common php5-cli php5-curl
2. Installation of the Perl Modules :
You have to install some perl modules from CPAN in order to make work the application.
cpan > install Module::Build File::Slurp MIME::Base64 Error DateTime Sys::Hostname IO::Socket::INET Config::General Config::Tiny XML::Simple Catalyst Catalyst::Plugin::ConfigLoader Catalyst::Plugin::Static::Simple Catalyst::Action::RenderView Catalys...
And if you want to run the full test suite and for devs environments:
cpan> install Module::ScanDeps Test::NoBreakpoints Test::Pod::Coverage Catalyst::Helper
For the moment, App::Crypt::OpenSSL::CA won't install because of failing tests. These tests fails
because they aren't coded. You can install it by hand or by forcing it, making sure that only tests 12 and 13 of
lib/Crypt/OpenSSL/CA are failing.
3. Extract the App-CamelPKI archive and create your own app_camelpki.yml (a sample can be found 'app_camelpki.yml.sample').
lib/App/CamelPKI/Action/JSON.pm view on Meta::CPAN
return 1;
}
=begin internals
=head2 _request_body($c)
Returns the content of the POST request, if any.
Note that there seems to be plans in Catalyst to provide a hand-made
HTTP::Request to controller tests, but as of 5.7006 it is undocumented
and doesn't seem to accept POST requests with a body. Therefore,
_request_body will shamelessy attempt to read global variable
$App::CamelPKI::Action::JSON::request_body_for_tests, and return its value
if defined; L<App::CamelPKI::Test> hooks into this band aid to pass the
JSON request body.
=end internals
=cut
t/acceptance-get-CA.t view on Meta::CPAN
}
$webserver->start(); END { $webserver->stop(); }
$webserver->tail_error_logfile();
my $port = $webserver->https_port();
sub request {
my ($uri) = @_;
$uri = "/$uri" unless $uri =~ m|^/|;
my $url = "https://localhost:$port$uri";
my $req = HTTP::Request->new(GET => $url);
return LWP::UserAgent->new->request($req);
}
=head1 NAME
B<acceptance-get-CA.t> - Fetches the CA certification chain and the
CRL over plain HTTP/S (that is, non-JSON, non-authenticated).
=cut
t/lib/App/CamelPKI/Test.pm view on Meta::CPAN
use Test::Group;
use File::Find;
use File::Path ();
use File::Spec::Functions qw(catfile catdir);
use File::Slurp;
use File::Temp ();
use POSIX ":sys_wait_h";
use File::Which ();
use IO::Socket::SSL;
use LWP::UserAgent;
use HTTP::Request;
#pour formulaires
use URI::URL;
use HTTP::Request::Common;
use HTTP::Request::Form;
use HTML::TreeBuilder 3.0;
use base 'Exporter';
BEGIN {
our @EXPORT =
qw(openssl_path run_thru_openssl run_dumpasn1
run_perl run_perl_ok
certificate_looks_ok
certificate_chain_ok certificate_chain_invalid_ok
x509_schema x509_decoder
t/lib/App/CamelPKI/Test.pm view on Meta::CPAN
my $ua = LWP::UserAgent->new;
my $req = http_request_prepare($url, @args);
my $res = http_request_execute($req, @args);
my $tree = HTML::TreeBuilder->new;
$tree->parse($res->content);
$tree->eof();
my @Forms = $tree->find_by_tag_name('FORM');
die "No forms in page" unless @Forms;
my $f = HTTP::Request::Form->new($Forms[0], $url);
foreach my $part (keys(%$structure)){
$f->field($part, $structure->{$part});
}
my $response = http_request_execute($f->press($button), @args);
return $response;
}
=item I<formcall_remote($url, $struct, %args)>
Like L</jsonreq_remote> but instead of returning an L<HTTP::Response>
t/lib/App/CamelPKI/Test.pm view on Meta::CPAN
die $content;
}
=item I<http_request_prepare($url, %args)>
=item I<http_request_execute($request, %args)>
These functions factor code between L</jsonreq_remote>,
L</plaintextcall_remote> and such, although they may also be called
directly. I<http_request_prepare> creates and returns and returns a GET
L<HTTP::Request> object that the caller may further tweak, prior to
passing it along to I<http_request_execute>, which in turn does the HTTP/S
request and returns an L<HTTP::Response> object. Named arguments are
the same as in L</jsonreq_remote>, L</plaintextcall_remote> or
L</jsoncall_remote>.
=cut
sub http_request_prepare {
my ($url) = @_;
return HTTP::Request->new("GET", $url);
}
sub http_request_execute {
my ($req, %args) = @_;
die "Bad argument $req" unless eval { $req->isa("HTTP::Request") };
# Trust me, snarfing this undocumented variable really is the
# most elegant way of causing LWP to use a client certificate.
# I've gone through these hoops many, many times.
local @LWP::Protocol::http::EXTRA_SOCK_OPTS;
if ($args{-key} && $args{-certificate}) {
my $keysdir = catdir(tempdir(), "test_ssl_client_keys");
if (! -d $keysdir) {
mkdir($keysdir) or die "Cannot mkdir($keysdir): $!\n";
}
write_file(my $clientcertfile = catfile($keysdir, "cert.pem"),
( run in 0.494 second using v1.01-cache-2.11-cpan-de7293f3b23 )