POE-Component-SSLify-1.012/0000775000175000017500000000000012431461761013704 5ustar apocapocPOE-Component-SSLify-1.012/SIGNATURE0000644000175000017500000000657112431461761015177 0ustar apocapocThis file contains message digests of all files listed in MANIFEST, signed via the Module::Signature module, version 0.73. To verify the content in this distribution, first make sure you have Module::Signature installed, then type: % cpansign -v It will check each file's integrity, as well as the signature's validity. If "==> Signature verified OK! <==" is not displayed, the distribution may already have been compromised, and you should not run its Makefile.PL or Build.PL. -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 SHA1 427e6e41b255d709de381b943da559e76480ef19 AUTHOR_PLEDGE SHA1 45bfb1662ceb2f539b7a84e8a83c63ac74e4b112 Build.PL SHA1 b7bce2ca389897293c272733fdddd18e620b7c7d Changes SHA1 a86ef10da1561a868fb7eec3aeb2931f69835fea CommitLog SHA1 b75af39c9fe42eaafb41179a5848d50323b92b6c INSTALL SHA1 e6514e4bc5abd3d1a8c7bd2a782c2f8737b413e7 LICENSE SHA1 751a1dbea35cb81ab2d14f6afa7c5e1013d85379 MANIFEST SHA1 69b8a0accb85effa4bd5f4ea93e4f2386d10ac8b MANIFEST.SKIP SHA1 18ccc7e7ef8eeeb5aae26e3fb6bac1dca6b80533 META.json SHA1 105d53c413f245dff657ba0f36bcbc442ae6b912 META.yml SHA1 f0cd277fa23c2796786f34caab90778c74adec80 Makefile.PL SHA1 02145222e7316163bab8ce9b886b1348f4f380fc README SHA1 d20aeaa271c3d6abe4a55112b6197a0d78b44257 cpanfile SHA1 41a5da1356107d097f6bbf72c62ee4da83e4119f dist.ini SHA1 9ca4ef12f3325b2fbcd3847a30066bd22fea1acb doap.xml SHA1 7f8e80e0f34831ee62d37236e72d14ff994517f6 examples/client.pl SHA1 e9802b791af652351422884f5899a07bb84ef2ec examples/server.pl SHA1 a7fd612bed4ef287fe7820ce86f56d6a4a8ea43b examples/serverclient.pl SHA1 2f80c76a50a07e5fffaff3c9ace7b9b60f8ac5fd lib/POE/Component/SSLify.pm SHA1 e2bd7e88034f6ec148855d0f65f6a82f88ba9c73 lib/POE/Component/SSLify/ClientHandle.pm SHA1 1c6f932e367fe9b910af853e85a79e850fb27eaa lib/POE/Component/SSLify/ServerHandle.pm SHA1 59afa28f138a14b956443f915d60a891d5b306b8 mylib/example.crt SHA1 f2ba02d28cfb207e0a86be7cb4f3c570f257bf93 mylib/example.key SHA1 36b0e0fc225ff13e639e9a11671ea67e3179fcd8 t/00-compile.t SHA1 8b29673d89e159edc8a2e01ec6927b6119837b08 t/00-report-prereqs.dd SHA1 0f795aaaadd9edd61eb9ad9933f443802b6f77c3 t/00-report-prereqs.t SHA1 1cf17c9c22e93bf1577f02450a568c61212f03f2 t/00-ssleay-info.t SHA1 17a2d0baef2231e391c26517ee3f919827b9fdfb t/99_mire_test.t SHA1 a42f89f63552797bf82457d864affdb5c74ff000 t/apocalypse.t SHA1 f0488f2a7600b6a56261387f1b2554a859f4bd8f t/connect_hook.t SHA1 b1018a80aec2289255d9620e740335c8cf6355af t/connect_hook_nodata.t SHA1 61c6dc760d6ba8f3c0672cd37c5326796592f340 t/connfail_client.t SHA1 a93284eec5af5e074cabc2499e2151e9f05b2d85 t/connfail_server.t SHA1 6c177f33cdf46a2b9b2e3e348c78566cea7b7fd6 t/renegotiate_client.t SHA1 4382dd4d3340057e840fdf2a2ab65c2d6d1a61b4 t/renegotiate_client_pings.t SHA1 0c29c30bee832d33b4af6b71e5caa812b9e8004c t/renegotiate_server.t SHA1 cdb3bcc592ea5775b06474c82bc3ff58c812c47d t/simple.t SHA1 c88eae9b29402c0f3cc59a4e9e6e9a192f114585 t/simple_large.t SHA1 5db5fb734853185c1b66d98aad41181e071803df t/simple_parallel.t SHA1 2ccf516fbfa01550546426b560bd9009ef947221 t/simple_parallel_large.t SHA1 23dca4da565c773cd934714add8781822771f6fb t/simple_parallel_superbig.t SHA1 45a15084faaa845989f038b8f2e6b4242b570b45 t/simple_superbig.t SHA1 a2983a2e0b87fc1c4d220f5bf52e7bede374f130 t/upgrade.t -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlRmY/EACgkQGfr7vsGKgxwVbwCg1jqDFkbib8f3MCrMsCVrqB1E fFcAoL/1YQl9RjHzzm9Jizzs2Sc5zgbd =KGeN -----END PGP SIGNATURE----- POE-Component-SSLify-1.012/AUTHOR_PLEDGE0000644000175000017500000000106612431461761015652 0ustar apocapoc # CPAN Covenant for POE-Component-SSLify I, Apocalypse , hereby give modules@perl.org permission to grant co-maintainership to POE-Component-SSLify, if all the following conditions are met: (1) I haven't released the module for a year or more (2) There are outstanding issues in the module's public bug tracker (3) Email to my CPAN email address hasn't been answered after a month (4) The requester wants to make worthwhile changes that will benefit CPAN In the event of my death, then the time-limits in (1) and (3) do not apply. POE-Component-SSLify-1.012/Makefile.PL0000644000175000017500000001016212431461761015654 0ustar apocapoc# # This file is part of POE-Component-SSLify # # This software is copyright (c) 2014 by Apocalypse. # # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # use strict; use warnings; # This Makefile.PL for POE-Component-SSLify was generated by # Dist::Zilla::Plugin::MakeMaker::Fallback 0.014 # and Dist::Zilla::Plugin::MakeMaker::Awesome 0.31. # Don't edit it but the dist.ini and plugins used to construct it. use strict; use warnings; BEGIN { my %configure_requires = ( 'ExtUtils::MakeMaker' => '0', 'Module::Build::Tiny' => '0.039', ); my @missing = grep { ! eval "require $_; $_->VERSION($configure_requires{$_}); 1" } keys %configure_requires; if (not @missing) { print "Congratulations, your toolchain understands 'configure_requires'!\n\n"; } else { $ENV{PERL_MM_FALLBACK_SILENCE_WARNING} or warn <<'EOW'; *** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING *** If you're seeing this warning, your toolchain is really, really old* and you'll almost certainly have problems installing CPAN modules from this century. But never fear, dear user, for we have the technology to fix this! If you're using CPAN.pm to install things, then you can upgrade it using: cpan CPAN If you're using CPANPLUS to install things, then you can upgrade it using: cpanp CPANPLUS If you're using cpanminus, you shouldn't be seeing this message in the first place, so please file an issue on github. If you're installing manually, please retrain your fingers to run Build.PL when present instead. This public service announcement was brought to you by the Perl Toolchain Gang, the irc.perl.org #toolchain IRC channel, and the number 42. ---- * Alternatively, you are doing something overly clever, in which case you should consider setting the 'prefer_installer' config option in CPAN.pm, or 'prefer_makefile' in CPANPLUS, to 'mb" and '0' respectively. You can also silence this warning for future installations by setting the PERL_MM_FALLBACK_SILENCE_WARNING environment variable. EOW sleep 10 if -t STDIN && (-t STDOUT || !(-f STDOUT || -c STDOUT)); } } use 5.006; use ExtUtils::MakeMaker; my %WriteMakefileArgs = ( "ABSTRACT" => "Makes using SSL in the world of POE easy!", "AUTHOR" => "Apocalypse ", "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => 0, "Module::Build::Tiny" => "0.039" }, "DISTNAME" => "POE-Component-SSLify", "EXE_FILES" => [], "LICENSE" => "perl", "MIN_PERL_VERSION" => "5.006", "NAME" => "POE::Component::SSLify", "PREREQ_PM" => { "Exporter" => 0, "IO::Handle" => "1.28", "Net::SSLeay" => "1.36", "POE" => "1.267", "Scalar::Util" => 0, "Symbol" => 0, "Task::Weaken" => "1.03", "parent" => 0, "strict" => 0, "warnings" => 0 }, "TEST_REQUIRES" => { "ExtUtils::MakeMaker" => 0, "File::Spec" => 0, "File::Temp" => 0, "IO::Handle" => "1.28", "IPC::Open3" => 0, "POE" => "1.267", "POE::Component::Client::TCP" => 0, "POE::Component::Server::TCP" => 0, "POE::Filter::Stream" => 0, "Socket" => 0, "Test::FailWarnings" => 0, "Test::More" => "1.001002" }, "VERSION" => "1.012", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "Exporter" => 0, "ExtUtils::MakeMaker" => 0, "File::Spec" => 0, "File::Temp" => 0, "IO::Handle" => "1.28", "IPC::Open3" => 0, "Module::Build::Tiny" => "0.039", "Net::SSLeay" => "1.36", "POE" => "1.267", "POE::Component::Client::TCP" => 0, "POE::Component::Server::TCP" => 0, "POE::Filter::Stream" => 0, "Scalar::Util" => 0, "Socket" => 0, "Symbol" => 0, "Task::Weaken" => "1.03", "Test::FailWarnings" => 0, "Test::More" => "1.001002", "parent" => 0, "strict" => 0, "warnings" => 0 ); unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { delete $WriteMakefileArgs{TEST_REQUIRES}; delete $WriteMakefileArgs{BUILD_REQUIRES}; $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); POE-Component-SSLify-1.012/Build.PL0000644000175000017500000000070512431461761015200 0ustar apocapoc# # This file is part of POE-Component-SSLify # # This software is copyright (c) 2014 by Apocalypse. # # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # use strict; use warnings; # This Build.PL for POE-Component-SSLify was generated by Dist::Zilla::Plugin::ModuleBuildTiny 0.008. use strict; use warnings; use 5.006; use Module::Build::Tiny 0.039; Build_PL(); POE-Component-SSLify-1.012/Changes0000644000175000017500000001575012431461761015205 0ustar apocapocRevision history for POE-Component-SSLify 1.012 2014-11-14T20:19:52Z UTC - Reduce memory usage and speedup writing large strings by avoiding substr magic [STATISTICS] - code churn: 2 files changed, 6 insertions(+), 3 deletions(-) 1.011 2014-11-14T03:06:48Z UTC - Tweak the testsuite thanks to CPANTesters! [STATISTICS] - code churn: 11 files changed, 37 insertions(+), 35 deletions(-) 1.010 2014-11-12T06:13:41Z UTC - add informational test that prints out ssleay version - clamp the writes to 16K internally to get around write errors reported by RT#95071 and RT#58243, thanks! [STATISTICS] - code churn: 7 files changed, 591 insertions(+), 5 deletions(-) 1.009 2014-11-12T00:41:25Z UTC - Updates to the auto-generated files - Tweaked the testsuite to use done_testing() for sanity, RT#66741 (thanks RCAPUTO!) - Use Test::FailWarnings in the testsuite in place of Test::NoWarnings (DAGOLDEN++) - Add t/simple_large.t to try and track down RT#58243 (thanks Johan!) - Added a boatload of tests to try and track down RT#95071 (thanks Joe!) [STATISTICS] - code churn: 27 files changed, 2160 insertions(+), 1503 deletions(-) 1.008 2011-05-04T21:55:27Z UTC - Bazerka@irc noticed that POE wasn't even listed as a runtime prereq, d0h! 1.007 2011-05-04T21:36:32Z UTC - Revert the ENGINE load logic added in 1.004 because it was causing coredumps on netbsd ( thanks BINGOS! ) - Add the constant LOAD_SSL_ENGINES sub if you need to load the ssl engines - Tweak the renegotiate tests to be more tolerant of failures, thanks RCAPUTO - RT#66741 1.006 2011-04-22T00:21:51Z UTC - Fix a heinous bug where openssl will randomly+reliably close a connection ( thanks MIRE ) - Tweak the hook tests so they test the case where no data is sent over the connection - Tweak the connfail tests so they work better 1.005 2011-03-10T07:55:30Z UTC - Fix the connfail tests due to an incorrect assumption regards socket close value, thanks CPANTesters! 1.004 2011-03-08T23:39:03Z UTC - We now load certificate files via CTX_use_certificate_chain_file(), thanks Zephaniah E. Loss-Cutler-Hull OpenSSL docs suggest it - http://www.openssl.org/docs/ssl/SSL_CTX_use_certificate.html#NOTES PLEASE yell at me if you need the old functionality - the docs suggest this is the "better" way to do it... - Add the ability to pass a subref to call on connection/negotiation success, thanks Zephaniah E. Loss-Cutler-Hull NOTE: This will not work if you do renegotiation or any other zany SSL stuff! - Add the SSLify_GetStatus function to get the status of the connection - After staring at the Net::SSLeay/OpenSSL docs for a while I realized we were missing support for sslv23 version, added! - After some investigation, we now load all default ENGINEs for OpenSSL on startup, as it might provide a performance boost 1.003 2011-02-28T15:52:24Z UTC - Add $IGNORE_SSL_ERRORS to ignore certain SSL errors, thanks MNUNBERG - RT#66130 - Remove prereq on vars.pm as it's obsolete 1.002 2011-02-20T04:23:48Z UTC - Add SSLify_GetSSL to get the Net::SSLeay object, thanks MNUNBERG! 1.001 2011-02-13T18:11:07Z UTC - Fixed the Net::SSLeay import code, thanks CPANTesters! 1.000 2011-02-13T00:06:14Z UTC - Converted to Dist::Zilla for the release process! - Add a test for in-situ sslification, thanks MNUNBERG! - Add prereq for IO::Handle 1.28 to get sane $socket->blocking( 0 ) behavior on MSWin32 - Remove crufty old code for nonblocking and use $socket->blocking() instead 0.20 0000-00-00T00:00:00Z UTC - Split up the simple.t test into 2 tests for clarity, and added more diag messages for renegotiate, thanks HMBRAND! 0.19 0000-00-00T00:00:00Z UTC - Fixed a warning generated by POE::Component::Client::TCP in t/simple.t, thanks HMBRAND! 0.18 0000-00-00T00:00:00Z UTC - Bumped POE dep to at least 1.267 for t/simple.t - thanks CPANTesters! - Minor typo fixes in POD/Build.PL 0.17 0000-00-00T00:00:00Z UTC - Fixed the t/simple.t test to PASS on FreeBSD because Net::SSLeay::renegotiate was buggy on it, thanks CPANTesters! - Added note about OpenSSL functions in the POD. 0.16 0000-00-00T00:00:00Z UTC - Updated the nonblocking code to be production-ready, thanks ASCENT! - Removed the NONBLOCKING() sub, this module is now always nonblocking. - Added more tests, thanks ASCENT! - Added "mylib/example.crt" and "mylib/example.key" for testing, thanks ASCENT! - Misc kwalitee and POD fixes. - Bumped Net::SSLeay prereq to 1.36 so we have the latest SSL stuff to ensure sanity :) 0.15 0000-00-00T00:00:00Z UTC - Added "examples/serverclient.pl" to track down same-process sslification problems, thanks LotR! - Applied patch from BinGOs to support passing custom $ctx for Server_SSLify, thanks! RT#43018 - Switched over to Test::Apocalypse for easy author tests - Added experimental NONBLOCKING code, thanks ASCENT for the motivation! 0.14 0000-00-00T00:00:00Z UTC - removed Test::* modules from dependency list, thanks BINGOS - RT #36725 - dos2unix fixes - thanks RT #36704 - added Build.PL 0.13 0000-00-00T00:00:00Z UTC - POD typo errors in SSLify_ContextCreate - thanks ASCENT! 0.12 0000-00-00T00:00:00Z UTC - Kwalitee-related fixes 0.11 0000-00-00T00:00:00Z UTC - allowed setting of client-side context ( $ctx ) object - thanks RT #34442 - squashed typo in pod - thanks ASCENT! - changed version check code to regexp for compatibility with SSLeay v1.33_01 - thanks Mark! - added SSLify_ContextCreate helper function - backported Net::SSLeay's removal of %Filenum_Objects hash 0.10 0000-00-00T00:00:00Z UTC - More tweaks of POD - finally close RT #31238 - Added SSL version support - thanks RT #31492 - Added SSL CTX option support as a side effect - Added client.pl example with ReadLine support 0.09 0000-00-00T00:00:00Z UTC - Minor tweak of POD to enable better distro building - thanks RT #31238 0.08 0000-00-00T00:00:00Z UTC - Added support for BINMODE - thanks RT #27117 0.07 0000-00-00T00:00:00Z UTC - Fixed undefined $info - thanks RT #22372 0.06 0000-00-00T00:00:00Z UTC - Kwalitee-related fixes 0.05 0000-00-00T00:00:00Z UTC - Finally use a Changes file - thanks RT #18981 - Documentation tweaks - Upgraded Net::SSLeay requirement to 1.30 to help Win32 problems 0.04 0000-00-00T00:00:00Z UTC - Added new functions to extract data from the SSL socket -> GetCipher and GetSocket - In the case somebody knows Net::SSLeay more than me, added GetCTX to return the server-side CTX object - Removed the dependency on Net::SSLeay::Handle 0.03 0000-00-00T00:00:00Z UTC - First stab at the server-side code, help me test it out! - Refactored SSLify() into client/server side, so update your program accordingly! 0.02 0000-00-00T00:00:00Z UTC - Made sure the IO::Handle way was used only on MSWin32 - SSLify::ServerHandle - Removed _CIPHER and moved it to the main SSLify.pm code - Oops, forgot to override _get_self and _get_ssl - Fixed a nasty leak issue 0.01 0000-00-00T00:00:00Z UTC - Initial release POE-Component-SSLify-1.012/META.yml0000644000175000017500000004315612431461761015164 0ustar apocapoc--- abstract: 'Makes using SSL in the world of POE easy!' author: - 'Apocalypse ' build_requires: ExtUtils::MakeMaker: '0' File::Spec: '0' File::Temp: '0' IO::Handle: '1.28' IPC::Open3: '0' POE: '1.267' POE::Component::Client::TCP: '0' POE::Component::Server::TCP: '0' POE::Filter::Stream: '0' Socket: '0' Test::FailWarnings: '0' Test::More: '1.001002' perl: '5.006' configure_requires: ExtUtils::MakeMaker: '0' Module::Build::Tiny: '0.039' perl: '5.006' dynamic_config: '0' generated_by: 'Dist::Zilla version 5.024, CPAN::Meta::Converter version 2.142690' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: POE-Component-SSLify no_index: directory: - t - examples - mylib provides: POE::Component::SSLify: file: lib/POE/Component/SSLify.pm version: '1.012' POE::Component::SSLify::ClientHandle: file: lib/POE/Component/SSLify/ClientHandle.pm version: '1.012' POE::Component::SSLify::ServerHandle: file: lib/POE/Component/SSLify/ServerHandle.pm version: '1.012' requires: Exporter: '0' IO::Handle: '1.28' Net::SSLeay: '1.36' POE: '1.267' Scalar::Util: '0' Symbol: '0' Task::Weaken: '1.03' parent: '0' perl: '5.006' strict: '0' warnings: '0' resources: bugtracker: http://rt.cpan.org/Public/Dist/Display.html?Name=POE-Component-SSLify homepage: https://github.com/apocalypse/perl-poe-sslify license: http://dev.perl.org/licenses/ repository: https://github.com/apocalypse/perl-poe-sslify.git version: '1.012' x_BuiltWith: modules: CPAN::Meta: '2.142690' Exporter: '5.70' ExtUtils::MakeMaker: '7.00' File::Spec: '3.47' File::Temp: '0.2304' IO::Handle: '1.34' IPC::Open3: '1.13' Module::Build::Tiny: '0.039' Net::SSLeay: '1.66' POE: '1.365' POE::Component::Client::TCP: '1.365' POE::Component::Server::TCP: '1.365' POE::Filter::Stream: '1.365' Scalar::Util: '1.41' Socket: '2.016' Symbol: '1.07' Task::Weaken: '1.04' Test::FailWarnings: '0.008' Test::More: '1.001009' parent: '0.228' strict: '1.07' warnings: '1.18' perl: original: v5.18.2 qv: 1 version: - 5 - 18 - 2 platform: linux uname: 'Linux 3.13.0-35-generic x86_64' x_Dist_Zilla: perl: version: '5.018002' plugins: - class: Dist::Zilla::Plugin::Git::NextVersion config: Dist::Zilla::Plugin::Git::NextVersion: first_version: '0.001' version_by_branch: '0' version_regexp: (?^:^release-(.+)$) Dist::Zilla::Role::Git::Repo: repo_root: . name: '@Apocalyptic/Git::NextVersion' version: '2.025' - class: Dist::Zilla::Plugin::Git::GatherDir config: Dist::Zilla::Plugin::GatherDir: exclude_filename: - README.pod exclude_match: [] follow_symlinks: '0' include_dotfiles: '1' prefix: '' prune_directory: [] root: . Dist::Zilla::Plugin::Git::GatherDir: include_untracked: '0' Dist::Zilla::Role::Git::Repo: repo_root: . name: '@Apocalyptic/Git::GatherDir' version: '2.025' - class: Dist::Zilla::Plugin::PruneCruft name: '@Apocalyptic/PruneCruft' version: '5.024' - class: Dist::Zilla::Plugin::AutoPrereqs name: '@Apocalyptic/AutoPrereqs' version: '5.024' - class: Dist::Zilla::Plugin::GenerateFile name: '@Apocalyptic/MANIFEST.SKIP' version: '5.024' - class: Dist::Zilla::Plugin::ManifestSkip name: '@Apocalyptic/ManifestSkip' version: '5.024' - class: Dist::Zilla::Plugin::Test::Compile config: Dist::Zilla::Plugin::Test::Compile: bail_out_on_fail: '0' fail_on_warning: author fake_home: '1' filename: t/00-compile.t module_finder: - ':InstallModules' needs_display: '0' phase: test script_finder: - ':ExecFiles' skips: [] name: '@Apocalyptic/Test::Compile' version: '2.051' - class: Dist::Zilla::Plugin::ApocalypseTests name: '@Apocalyptic/ApocalypseTests' version: '1.002' - class: Dist::Zilla::Plugin::Test::ReportPrereqs name: '@Apocalyptic/Test::ReportPrereqs' version: '0.019' - class: Dist::Zilla::Plugin::Prepender name: '@Apocalyptic/Prepender' version: '1.112280' - class: Dist::Zilla::Plugin::Authority name: '@Apocalyptic/Authority' version: '1.009' - class: Dist::Zilla::Plugin::Git::Describe name: '@Apocalyptic/Git::Describe' version: '0.003' - class: Dist::Zilla::Plugin::PkgVersion name: '@Apocalyptic/PkgVersion' version: '5.024' - class: Dist::Zilla::Plugin::PodWeaver config: Dist::Zilla::Plugin::PodWeaver: config_plugins: - '@Apocalyptic' finder: - ':InstallModules' - ':ExecFiles' plugins: - class: Pod::Weaver::Plugin::EnsurePod5 name: '@CorePrep/EnsurePod5' version: '4.006' - class: Pod::Weaver::Plugin::H1Nester name: '@CorePrep/H1Nester' version: '4.006' - class: Pod::Weaver::Plugin::SingleEncoding name: '@Apocalyptic/SingleEncoding' version: '4.006' - class: Pod::Weaver::Section::Region name: '@Apocalyptic/PodCoverage' version: '4.006' - class: Pod::Weaver::Plugin::StopWords name: '@Apocalyptic/StopWords' version: '1.009' - class: Pod::Weaver::Section::Name name: '@Apocalyptic/Name' version: '4.006' - class: Pod::Weaver::Section::Version name: '@Apocalyptic/Version' version: '4.006' - class: Pod::Weaver::Section::Generic name: '@Apocalyptic/Synopsis' version: '4.006' - class: Pod::Weaver::Section::Generic name: '@Apocalyptic/Description' version: '4.006' - class: Pod::Weaver::Section::Collect name: '@Apocalyptic/Attributes' version: '4.006' - class: Pod::Weaver::Section::Collect name: '@Apocalyptic/Methods' version: '4.006' - class: Pod::Weaver::Section::Collect name: '@Apocalyptic/Functions' version: '4.006' - class: Pod::Weaver::Section::Collect name: '@Apocalyptic/POEvents' version: '4.006' - class: Pod::Weaver::Section::Leftovers name: '@Apocalyptic/Leftovers' version: '4.006' - class: Pod::Weaver::Section::SeeAlso name: '@Apocalyptic/SeeAlso' version: '1.003' - class: Pod::Weaver::Section::Support name: '@Apocalyptic/Support' version: '1.006' - class: Pod::Weaver::Section::Authors name: '@Apocalyptic/Authors' version: '4.006' - class: Pod::Weaver::Section::Contributors name: '@Apocalyptic/Contributors' version: '0.008' - class: Pod::Weaver::Section::Generic name: '@Apocalyptic/ACK' version: '4.006' - class: Pod::Weaver::Section::Legal name: '@Apocalyptic/Legal' version: '4.006' - class: Pod::Weaver::Section::WarrantyDisclaimer::GPL3 name: '@Apocalyptic/Warranty' version: '0.121290' - class: Pod::Weaver::Plugin::Transformer name: '@Apocalyptic/ListTransformer' version: '4.006' - class: Pod::Weaver::Plugin::EnsureUniqueSections name: '@Apocalyptic/UniqueSections' version: '0.121550' name: '@Apocalyptic/PodWeaver' version: '4.006' - class: Dist::Zilla::Plugin::NextRelease name: '@Apocalyptic/NextRelease' version: '5.024' - class: Dist::Zilla::Plugin::ChangelogFromGit name: '@Apocalyptic/ChangelogFromGit' version: '0.016' - class: Dist::Zilla::Plugin::MinimumPerl name: '@Apocalyptic/MinimumPerl' version: '1.006' - class: Dist::Zilla::Plugin::Bugtracker name: '@Apocalyptic/Bugtracker' version: '1.111080' - class: Dist::Zilla::Plugin::MetaConfig name: '@Apocalyptic/MetaConfig' version: '5.024' - class: Dist::Zilla::Plugin::Git::Contributors config: Dist::Zilla::Plugin::Git::Contributors: include_authors: '0' include_releaser: '1' order_by: name paths: [] name: '@Apocalyptic/Git::Contributors' version: '0.008' - class: Dist::Zilla::Plugin::MetaData::BuiltWith config: Dist::Zilla::Plugin::MetaData::BuiltWith: _stash_key: x_BuiltWith show_config: '0' show_uname: '1' uname: uname_args: - -s - -r - -m uname_call: uname name: '@Apocalyptic/MetaData::BuiltWith' version: '1.003001' - class: Dist::Zilla::Plugin::GithubMeta name: '@Apocalyptic/GithubMeta' version: '0.46' - class: Dist::Zilla::Plugin::MetaResources name: '@Apocalyptic/MetaResources' version: '5.024' - class: Dist::Zilla::Plugin::Metadata name: '@Apocalyptic/Metadata' version: '3.03' - class: Dist::Zilla::Plugin::MetaNoIndex name: '@Apocalyptic/MetaNoIndex' version: '5.024' - class: Dist::Zilla::Plugin::MetaProvides::Package config: Dist::Zilla::Plugin::MetaProvides::Package: finder_objects: - class: Dist::Zilla::Plugin::FinderCode name: '@Apocalyptic/MetaProvides::Package/AUTOVIV/:InstallModulesPM' version: '5.024' Dist::Zilla::Role::MetaProvider::Provider: inherit_missing: '1' inherit_version: '1' meta_noindex: '1' name: '@Apocalyptic/MetaProvides::Package' version: '2.001002' - class: Dist::Zilla::Plugin::License name: '@Apocalyptic/License' version: '5.024' - class: Dist::Zilla::Plugin::ModuleBuildTiny config: Dist::Zilla::Role::TestRunner: default_jobs: '1' name: '@Apocalyptic/ModuleBuildTiny' version: '0.008' - class: Dist::Zilla::Plugin::MakeMaker::Fallback config: Dist::Zilla::Role::TestRunner: default_jobs: '1' name: '@Apocalyptic/MakeMaker::Fallback' version: '0.014' - class: Dist::Zilla::Plugin::MetaYAML name: '@Apocalyptic/MetaYAML' version: '5.024' - class: Dist::Zilla::Plugin::MetaJSON name: '@Apocalyptic/MetaJSON' version: '5.024' - class: Dist::Zilla::Plugin::InstallGuide name: '@Apocalyptic/InstallGuide' version: '1.200005' - class: Dist::Zilla::Plugin::DOAP name: '@Apocalyptic/DOAP' version: '0.003' - class: Dist::Zilla::Plugin::Covenant name: '@Apocalyptic/Covenant' version: 0.1.0 - class: Dist::Zilla::Plugin::CPANFile name: '@Apocalyptic/CPANFile' version: '5.024' - class: Dist::Zilla::Plugin::ReadmeAnyFromPod name: '@Apocalyptic/ReadmeAnyFromPod' version: '0.142470' - class: Dist::Zilla::Plugin::ReadmeAnyFromPod name: '@Apocalyptic/pod for github' version: '0.142470' - class: Dist::Zilla::Plugin::ChangeStats::Git name: '@Apocalyptic/ChangeStats::Git' version: 0.3.0 - class: Dist::Zilla::Plugin::Signature name: '@Apocalyptic/Signature' version: '1.100930' - class: Dist::Zilla::Plugin::Manifest name: '@Apocalyptic/Manifest' version: '5.024' - class: Dist::Zilla::Plugin::CheckChangesHasContent name: '@Apocalyptic/CheckChangesHasContent' version: '0.007' - class: Dist::Zilla::Plugin::Git::Check config: Dist::Zilla::Plugin::Git::Check: untracked_files: die Dist::Zilla::Role::Git::DirtyFiles: allow_dirty: - README.pod - Changes allow_dirty_match: [] changelog: Changes Dist::Zilla::Role::Git::Repo: repo_root: . name: '@Apocalyptic/Git::Check' version: '2.025' - class: Dist::Zilla::Plugin::Git::CheckFor::CorrectBranch config: Dist::Zilla::Role::Git::Repo: repo_root: . name: '@Apocalyptic/Git::CheckFor::CorrectBranch' version: '0.011' - class: Dist::Zilla::Plugin::Git::CheckFor::MergeConflicts config: Dist::Zilla::Role::Git::Repo: repo_root: . name: '@Apocalyptic/Git::CheckFor::MergeConflicts' version: '0.011' - class: Dist::Zilla::Plugin::Git::Remote::Check name: '@Apocalyptic/Git::Remote::Check' version: 0.1.2 - class: Dist::Zilla::Plugin::PromptIfStale config: Dist::Zilla::Plugin::PromptIfStale: check_all_plugins: '1' check_all_prereqs: '1' modules: [] phase: release skip: [] name: '@Apocalyptic/PromptIfStale' version: '0.029' - class: Dist::Zilla::Plugin::TestRelease name: '@Apocalyptic/TestRelease' version: '5.024' - class: Dist::Zilla::Plugin::CheckPrereqsIndexed name: '@Apocalyptic/CheckPrereqsIndexed' version: '0.012' - class: Dist::Zilla::Plugin::CheckSelfDependency config: Dist::Zilla::Plugin::CheckSelfDependency: finder: - ':InstallModules' name: '@Apocalyptic/CheckSelfDependency' version: '0.007' - class: Dist::Zilla::Plugin::CheckIssues name: '@Apocalyptic/CheckIssues' version: '0.004' - class: Dist::Zilla::Plugin::ConfirmRelease name: '@Apocalyptic/ConfirmRelease' version: '5.024' - class: Dist::Zilla::Plugin::UploadToCPAN name: '@Apocalyptic/UploadToCPAN' version: '5.024' - class: Dist::Zilla::Plugin::ArchiveRelease name: '@Apocalyptic/ArchiveRelease' version: '4.00' - class: Dist::Zilla::Plugin::Git::Commit config: Dist::Zilla::Plugin::Git::Commit: add_files_in: - releases commit_msg: 'New CPAN release of %N - v%v%n%n%c' time_zone: UTC Dist::Zilla::Role::Git::DirtyFiles: allow_dirty: - README.pod - Changes allow_dirty_match: [] changelog: Changes Dist::Zilla::Role::Git::Repo: repo_root: . name: '@Apocalyptic/Git::Commit' version: '2.025' - class: Dist::Zilla::Plugin::Git::Tag config: Dist::Zilla::Plugin::Git::Tag: branch: ~ signed: '0' tag: release-1.012 tag_format: release-%v tag_message: 'Tagged release-%v' time_zone: local Dist::Zilla::Role::Git::Repo: repo_root: . name: '@Apocalyptic/Git::Tag' version: '2.025' - class: Dist::Zilla::Plugin::Git::Push config: Dist::Zilla::Plugin::Git::Push: push_to: - origin - bitbucket remotes_must_exist: '1' Dist::Zilla::Role::Git::Repo: repo_root: . name: '@Apocalyptic/Git::Push' version: '2.025' - class: Dist::Zilla::Plugin::GitHub::Update name: '@Apocalyptic/GitHub::Update' version: '0.38' - class: Dist::Zilla::Plugin::Bitbucket::Update name: '@Apocalyptic/Bitbucket::Update' version: '0.001' - class: Dist::Zilla::Plugin::Clean name: '@Apocalyptic/Clean' version: '0.07' - class: Dist::Zilla::Plugin::SchwartzRatio name: '@Apocalyptic/SchwartzRatio' version: 0.2.0 - class: Dist::Zilla::Plugin::FinderCode name: ':InstallModules' version: '5.024' - class: Dist::Zilla::Plugin::FinderCode name: ':IncModules' version: '5.024' - class: Dist::Zilla::Plugin::FinderCode name: ':TestFiles' version: '5.024' - class: Dist::Zilla::Plugin::FinderCode name: ':ExecFiles' version: '5.024' - class: Dist::Zilla::Plugin::FinderCode name: ':ShareFiles' version: '5.024' - class: Dist::Zilla::Plugin::FinderCode name: ':MainModule' version: '5.024' - class: Dist::Zilla::Plugin::FinderCode name: ':AllFiles' version: '5.024' - class: Dist::Zilla::Plugin::FinderCode name: ':NoFiles' version: '5.024' - class: Dist::Zilla::Plugin::VerifyPhases name: '@Apocalyptic/VerifyPhases' version: '0.006' - class: Dist::Zilla::Plugin::FinderCode name: '@Apocalyptic/MetaProvides::Package/AUTOVIV/:InstallModulesPM' version: '5.024' zilla: class: Dist::Zilla::Dist::Builder config: is_trial: '0' version: '5.024' x_IRC: url: irc://irc.perl.org/#perl-help web: https://chat.mibbit.com/?channel=%23perl-help&server=irc.perl.org x_author_pledge: version: '1' x_authority: cpan:APOCAL POE-Component-SSLify-1.012/INSTALL0000644000175000017500000000177612431461761014746 0ustar apocapocThis is the Perl distribution POE-Component-SSLify. Installing POE-Component-SSLify is straightforward. ## Installation with cpanm If you have cpanm, you only need one line: % cpanm POE::Component::SSLify If you are installing into a system-wide directory, you may need to pass the "-S" flag to cpanm, which uses sudo to install the module: % cpanm -S POE::Component::SSLify ## Installing with the CPAN shell Alternatively, if your CPAN shell is set up, you should just be able to do: % cpan POE::Component::SSLify ## Manual installation As a last resort, you can manually install it. Download the tarball, untar it, then build it: % perl Build.PL % ./Build && ./Build test Then install it: % ./Build install If you are installing into a system-wide directory, you may need to run: % sudo ./Build install ## Documentation POE-Component-SSLify documentation is available as POD. You can run perldoc from a shell to read the documentation: % perldoc POE::Component::SSLify POE-Component-SSLify-1.012/lib/0000775000175000017500000000000012431461761014452 5ustar apocapocPOE-Component-SSLify-1.012/lib/POE/0000775000175000017500000000000012431461761015075 5ustar apocapocPOE-Component-SSLify-1.012/lib/POE/Component/0000775000175000017500000000000012431461761017037 5ustar apocapocPOE-Component-SSLify-1.012/lib/POE/Component/SSLify/0000775000175000017500000000000012431461761020210 5ustar apocapocPOE-Component-SSLify-1.012/lib/POE/Component/SSLify/ClientHandle.pm0000644000175000017500000000745412431461761023110 0ustar apocapoc# # This file is part of POE-Component-SSLify # # This software is copyright (c) 2014 by Apocalypse. # # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # use strict; use warnings; package POE::Component::SSLify::ClientHandle; $POE::Component::SSLify::ClientHandle::VERSION = '1.012'; our $AUTHORITY = 'cpan:APOCAL'; # ABSTRACT: Client-side handle for SSLify # Import the SSL death routines use Net::SSLeay 1.36 qw( die_now die_if_ssl_error ); # We inherit from ServerHandle use parent 'POE::Component::SSLify::ServerHandle'; # Override TIEHANDLE because we create a CTX sub TIEHANDLE { my ( $class, $socket, $version, $options, $ctx, $connref ) = @_; # create a context, if necessary if ( ! defined $ctx ) { $ctx = POE::Component::SSLify::_createSSLcontext( undef, undef, $version, $options ); } my $ssl = Net::SSLeay::new( $ctx ) or die_now( "Failed to create SSL $!" ); my $fileno = fileno( $socket ); Net::SSLeay::set_fd( $ssl, $fileno ); # Must use fileno # Socket is in non-blocking mode, so connect() will return immediately. # die_if_ssl_error won't die on non-blocking errors. We don't need to call connect() # again, because OpenSSL I/O functions (read, write, ...) can handle that entirely # by self (it's needed to connect() once to determine connection type). my $res = Net::SSLeay::connect( $ssl ) or die_if_ssl_error( 'ssl connect' ); my $self = bless { 'ssl' => $ssl, 'ctx' => $ctx, 'socket' => $socket, 'fileno' => $fileno, 'client' => 1, 'status' => $res, 'on_connect' => $connref, }, $class; return $self; } 1; __END__ =pod =encoding UTF-8 =for :stopwords Apocalypse =head1 NAME POE::Component::SSLify::ClientHandle - Client-side handle for SSLify =head1 VERSION This document describes v1.012 of POE::Component::SSLify::ClientHandle - released November 14, 2014 as part of POE-Component-SSLify. =head1 DESCRIPTION This is a subclass of ServerHandle to accomodate clients setting custom context objects. =head1 SEE ALSO Please see those modules/websites for more information related to this module. =over 4 =item * L =item * L =back =head1 AUTHOR Apocalypse =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2014 by Apocalypse. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. The full text of the license can be found in the F file included with this distribution. =head1 DISCLAIMER OF WARRANTY THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. =cut POE-Component-SSLify-1.012/lib/POE/Component/SSLify/ServerHandle.pm0000644000175000017500000002263012431461761023131 0ustar apocapoc# # This file is part of POE-Component-SSLify # # This software is copyright (c) 2014 by Apocalypse. # # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # use strict; use warnings; package POE::Component::SSLify::ServerHandle; $POE::Component::SSLify::ServerHandle::VERSION = '1.012'; our $AUTHORITY = 'cpan:APOCAL'; # ABSTRACT: Server-side handle for SSLify # Import the SSL death routines use Net::SSLeay 1.36 qw( die_now die_if_ssl_error ERROR_WANT_READ ERROR_WANT_WRITE ); # Ties the socket sub TIEHANDLE { my ( $class, $socket, $ctx, $connref ) = @_; my $ssl = Net::SSLeay::new( $ctx ) or die_now( "Failed to create SSL $!" ); my $fileno = fileno( $socket ); Net::SSLeay::set_fd( $ssl, $fileno ); # Socket is in non-blocking mode, so accept() will return immediately. # die_if_ssl_error won't die on non-blocking errors. We don't need to call accept() # again, because OpenSSL I/O functions (read, write, ...) can handle that entirely # by self (it's needed to accept() once to determine connection type). my $res = Net::SSLeay::accept( $ssl ) and die_if_ssl_error( 'ssl accept' ); my $self = bless { 'ssl' => $ssl, 'ctx' => $ctx, 'socket' => $socket, 'fileno' => $fileno, 'status' => $res, 'on_connect' => $connref, 'ssl_started' => 0, }, $class; return $self; } # TODO should we make a convenience function to convert retval to string equivalents for easier debugging? # From OpenSSL 1.0.0d #define SSL_ERROR_NONE 0 #define SSL_ERROR_SSL 1 #define SSL_ERROR_WANT_READ 2 #define SSL_ERROR_WANT_WRITE 3 #define SSL_ERROR_WANT_X509_LOOKUP 4 #define SSL_ERROR_SYSCALL 5 /* look at error stack/return value/errno */ #define SSL_ERROR_ZERO_RETURN 6 #define SSL_ERROR_WANT_CONNECT 7 #define SSL_ERROR_WANT_ACCEPT 8 sub _check_status { my $self = shift; # Okay, is negotiation done? # http://www.openssl.org/docs/ssl/SSL_connect.html#RETURN_VALUES if ( exists $self->{'client'} ) { $self->{'status'} = Net::SSLeay::connect( $self->{'ssl'} ); } else { $self->{'status'} = Net::SSLeay::accept( $self->{'ssl'} ); } if ( $self->{'status'} <= 0 ) { # http://www.openssl.org/docs/ssl/SSL_get_error.html my $errval = Net::SSLeay::get_error( $self->{'ssl'}, $self->{'status'} ); # Handle the case of ERROR_WANT_READ and ERROR_WANT_WRITE # TODO should we skip ERROR_WANT_ACCEPT and ERROR_WANT_CONNECT ? # also, ERROR_WANT_ACCEPT isn't exported by Net::SSLeay, huh? if ( $errval == ERROR_WANT_READ or $errval == ERROR_WANT_WRITE ) { # continue reading/writing from the socket until we connect or not... return 1; } else { # call the hook function for error connect if ( defined $self->{'on_connect'} ) { $self->{'on_connect'}->( $self->{'orig_socket'}, 0, $errval ); } # don't try to read/write from the socket anymore! return 0; } } elsif ( $self->{'status'} == 1 ) { # SSL handshake is done! $self->{'ssl_started'} = 1; # call the hook function for successful connect if ( defined $self->{'on_connect'} ) { $self->{'on_connect'}->( $self->{'orig_socket'}, 1 ); } # we can now read/write from the socket! return 1; } } # Read something from the socket sub READ { # Get ourself! my $self = shift; # Get the pointers to buffer, length, and the offset my( $buf, $len, $offset ) = \( @_ ); # Check the status of the SSL handshake if ( ! $self->{'ssl_started'} ) { return if $self->_check_status == 0; } # If we have no offset, replace the buffer with some input if ( ! defined $$offset ) { $$buf = Net::SSLeay::read( $self->{'ssl'}, $$len ); # Are we done? if ( defined $$buf ) { # TODO do we need the same "flush is success" logic in WRITE? return length( $$buf ); } else { # Nah, clear the buffer too... $$buf = ""; return; } } # Now, actually read the data defined( my $read = Net::SSLeay::read( $self->{'ssl'}, $$len ) ) or return; # TODO do we need the same "flush is success" logic in WRITE? # Figure out the buffer and offset my $buf_len = length( $$buf ); # If our offset is bigger, pad the buffer if ( $$offset > $buf_len ) { $$buf .= chr( 0 ) x ( $$offset - $buf_len ); } # Insert what we just read into the buffer substr( $$buf, $$offset, 1, $read ); # All done! return length( $read ); } # Write some stuff to the socket sub WRITE { # Get ourself + buffer + length + offset to write my( $self, $len, $offset ) = ( $_[0], $_[2], $_[3] ); my $buf = \$_[1]; # don't copy! # Check the status of the SSL handshake if ( ! $self->{'ssl_started'} ) { # The normal syswrite() POE uses expects 0 here. return 0 if $self->_check_status == 0; } # If we have nothing to offset, then start from the beginning if ( ! defined $offset ) { $offset = 0; } # Thanks to RT#95071 and RT#58243 we need to clamp the length to the TLS 16K limit # seems like the same thing happened to https://www.mail-archive.com/openssl-users@openssl.org/msg28151.html $len = 16_384 if $len > 16_384; # don't trigger substr's magic as it is SLOOOOOOOOW! # see http://www.perlmonks.org/?node_id=732873 my $wrote_len = Net::SSLeay::write( $self->{'ssl'}, scalar substr( $$buf, $offset, $len ) ); # Did we get an error or number of bytes written? # Net::SSLeay::write() returns the number of bytes written, or 0 on unsuccessful # operation (probably connection closed), or -1 on error. if ( $wrote_len < 0 ) { # The normal syswrite() POE uses expects 0 here. return 0; } else { # We flushed some data, which means we finished the handshake! # This is IMPORTANT, as MIRE found out! # Otherwise openssl will zonk out and give us SSL_ERROR_SSL and things randomly break :( # this is because we tried to connect() or accept() and the handshake was done... or something like that hah if ( ! $self->{'ssl_started'} ) { $self->{'ssl_started'} = 1; $self->{'status'} = 1; # call the hook function for successful connect if ( defined $self->{'on_connect'} ) { $self->{'on_connect'}->( $self->{'orig_socket'}, 1 ); } } # All done! return $wrote_len; } } # Sets binmode on the socket # Thanks to RT #27117 sub BINMODE { my $self = shift; if (@_) { my $mode = shift; binmode $self->{'socket'}, $mode; } else { binmode $self->{'socket'}; } return; } # Closes the socket sub CLOSE { my $self = shift; if ( defined $self->{'socket'} ) { Net::SSLeay::free( $self->{'ssl'} ); # TODO we ignore any close errors because there's no way to sanely propagate it up the stack... close( $self->{'socket'} ); ## no critic ( InputOutput::RequireCheckedClose ) undef $self->{'socket'}; # do we need to do CTX_free? if ( exists $self->{'client'} ) { Net::SSLeay::CTX_free( $self->{'ctx'} ); } } return 1; } # Add DESTROY handler sub DESTROY { my $self = shift; # Did we already CLOSE? if ( defined $self->{'socket'} ) { # Guess not... $self->CLOSE(); } return; } sub FILENO { my $self = shift; return $self->{'fileno'}; } # Not implemented TIE's sub READLINE { die 'Not Implemented'; } sub PRINT { die 'Not Implemented'; } 1; __END__ =pod =encoding UTF-8 =for :stopwords Apocalypse =head1 NAME POE::Component::SSLify::ServerHandle - Server-side handle for SSLify =head1 VERSION This document describes v1.012 of POE::Component::SSLify::ServerHandle - released November 14, 2014 as part of POE-Component-SSLify. =head1 DESCRIPTION This is a subclass of Net::SSLeay::Handle because their read() and sysread() does not cooperate well with POE. They block until length bytes are read from the socket, and that is BAD in the world of POE... This subclass behaves exactly the same, except that it doesn't block :) =head2 DIFFERENCES This subclass doesn't know what to do with PRINT/READLINE, as they usually are not used in POE::Wheel operations... =head1 SEE ALSO Please see those modules/websites for more information related to this module. =over 4 =item * L =back =head1 AUTHOR Apocalypse =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2014 by Apocalypse. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. The full text of the license can be found in the F file included with this distribution. =head1 DISCLAIMER OF WARRANTY THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. =cut POE-Component-SSLify-1.012/lib/POE/Component/SSLify.pm0000644000175000017500000010470312431461761020551 0ustar apocapoc# # This file is part of POE-Component-SSLify # # This software is copyright (c) 2014 by Apocalypse. # # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # use strict; use warnings; package POE::Component::SSLify; # git description: release-1.011-1-g57b6383 $POE::Component::SSLify::VERSION = '1.012'; our $AUTHORITY = 'cpan:APOCAL'; # ABSTRACT: Makes using SSL in the world of POE easy! BEGIN { # should fix netbsd smoke failures, thanks BinGOs! # Apocal: okay cores with a 0.9.7d I've built myself from source. Doesn't if I comment out engine lines. # BinGOs did an awesome job building various versions of openssl to try and track down the problem, it seems like # newer versions of openssl worked fine on netbsd, but I don't want to do crazy stuff like probing openssl versions # as it's fragile - best to let the user figure it out :) # # see http://www.cpantesters.org/cpan/report/1a660280-6eb1-11e0-a462-e9956c33433b # http://www.cpantesters.org/cpan/report/49a9f2aa-6df2-11e0-a462-e9956c33433b # http://www.cpantesters.org/cpan/report/78d9a234-6df5-11e0-a462-e9956c33433b # and many other reports :( # #(gdb) bt ##0 0xbd9d3e7e in engine_table_select () from /usr/lib/libcrypto.so.2 ##1 0xbd9b3bed in ENGINE_get_default_RSA () from /usr/lib/libcrypto.so.2 ##2 0xbd9b1f6d in RSA_new_method () from /usr/lib/libcrypto.so.2 ##3 0xbd9b1cf6 in RSA_new () from /usr/lib/libcrypto.so.2 ##4 0xbd9cf8a1 in RSAPrivateKey_asn1_meth () from /usr/lib/libcrypto.so.2 ##5 0xbd9da64b in ASN1_item_ex_new () from /usr/lib/libcrypto.so.2 ##6 0xbd9da567 in ASN1_item_ex_new () from /usr/lib/libcrypto.so.2 ##7 0xbd9d88cc in ASN1_item_ex_d2i () from /usr/lib/libcrypto.so.2 ##8 0xbd9d8437 in ASN1_item_d2i () from /usr/lib/libcrypto.so.2 ##9 0xbd9cf8d5 in d2i_RSAPrivateKey () from /usr/lib/libcrypto.so.2 ##10 0xbd9ad546 in d2i_PrivateKey () from /usr/lib/libcrypto.so.2 ##11 0xbd995e63 in PEM_read_bio_PrivateKey () from /usr/lib/libcrypto.so.2 ##12 0xbd980430 in PEM_read_bio_RSAPrivateKey () from /usr/lib/libcrypto.so.2 ##13 0xbda2e9dc in SSL_CTX_use_RSAPrivateKey_file () from /usr/lib/libssl.so.3 ##14 0xbda5aabe in XS_Net__SSLeay_CTX_use_RSAPrivateKey_file (cv=0x8682c80) # at SSLeay.c:1716 ##15 0x08115401 in Perl_pp_entersub () at pp_hot.c:2885 ##16 0x080e0ab7 in Perl_runops_debug () at dump.c:2049 ##17 0x08078624 in S_run_body (oldscope=1) at perl.c:2308 ##18 0x08077ef2 in perl_run (my_perl=0x823f030) at perl.c:2233 ##19 0x0805e321 in main (argc=3, argv=0xbfbfe6a0, env=0xbfbfe6b0) # at perlmain.c:117 ##20 0x0805e0c6 in ___start () #(gdb) if ( ! defined &LOAD_SSL_ENGINES ) { *LOAD_SSL_ENGINES = sub () { 0 } } } # We need Net::SSLeay or all's a failure! BEGIN { # We need >= 1.36 because it contains a lot of important fixes eval "use Net::SSLeay 1.36 qw( die_now die_if_ssl_error FILETYPE_PEM )"; # Check for errors... if ( $@ ) { # Oh boy! die $@; } else { # Finally, load our subclasses :) # ClientHandle isa ServerHandle so it will get loaded automatically require POE::Component::SSLify::ClientHandle; # Initialize Net::SSLeay # Taken from http://search.cpan.org/~flora/Net-SSLeay-1.36/lib/Net/SSLeay.pm#Low_level_API Net::SSLeay::load_error_strings(); Net::SSLeay::SSLeay_add_ssl_algorithms(); if ( LOAD_SSL_ENGINES ) { Net::SSLeay::ENGINE_load_builtin_engines(); Net::SSLeay::ENGINE_register_all_complete(); } Net::SSLeay::randomize(); } } # Do the exporting magic... use parent 'Exporter'; our @EXPORT_OK = qw( Client_SSLify Server_SSLify SSLify_Options SSLify_GetCTX SSLify_GetCipher SSLify_GetSocket SSLify_GetSSL SSLify_ContextCreate SSLify_GetStatus ); # Bring in some socket-related stuff use Symbol qw( gensym ); # we need IO 1.24 for it's win32 fixes but it includes IO::Handle 1.27_02 which is dev... # unfortunately we have to jump to IO 1.25 which includes IO::Handle 1.28... argh! use IO::Handle 1.28; # Use Scalar::Util's weaken() for the connref stuff use Scalar::Util qw( weaken ); use Task::Weaken 1.03; # to make sure it actually works! # load POE ( just to fool dzil AutoPrereqs :) require POE; # The server-side CTX stuff my $ctx; # global so users of this module can override it locally our $IGNORE_SSL_ERRORS = 0; #pod =func Client_SSLify #pod #pod This function sslifies a client-side socket. You can pass several options to it: #pod #pod my $socket = shift; #pod $socket = Client_SSLify( $socket, $version, $options, $ctx, $callback ); #pod $socket is the non-ssl socket you got from somewhere ( required ) #pod $version is the SSL version you want to use #pod $options is the SSL options you want to use #pod $ctx is the custom SSL context you want to use #pod $callback is the callback hook on success/failure of sslification #pod #pod # This is an example of the callback and you should pass it as Client_SSLify( $socket, ... , \&callback ); #pod sub callback { #pod my( $socket, $status, $errval ) = @_; #pod # $socket is the original sslified socket in case you need to play with it #pod # $status is either 1 or 0; with 1 signifying success and 0 failure #pod # $errval will be defined if $status == 0; it's the numeric SSL error code #pod # check http://www.openssl.org/docs/ssl/SSL_get_error.html for the possible error values ( and import them from Net::SSLeay! ) #pod #pod # The return value from the callback is discarded #pod } #pod #pod If $ctx is defined, SSLify will ignore $version and $options. Otherwise, it will be created from the $version and #pod $options parameters. If all of them are undefined, it will follow the defaults in L. #pod #pod BEWARE: If you passed in a CTX, SSLify will do Net::SSLeay::CTX_free( $ctx ) when the #pod socket is destroyed. This means you cannot reuse contexts! #pod #pod NOTE: The way to have a client socket with proper certificates set up is: #pod #pod my $socket = shift; # get the socket from somewhere #pod my $ctx = SSLify_ContextCreate( 'server.key', 'server.crt' ); #pod $socket = Client_SSLify( $socket, undef, undef, $ctx ); #pod #pod NOTE: You can pass the callback anywhere in the arguments, we'll figure it out for you! If you want to call a POE event, please look #pod into the postback/callback stuff in L. #pod #pod # we got this from POE::Wheel::SocketFactory #pod sub event_SuccessEvent { #pod my $socket = $_[ARG0]; #pod $socket = Client_SSLify( $socket, $_[SESSION]->callback( 'sslify_result' ) ); #pod $_[HEAP]->{client} = POE::Wheel::ReadWrite->new( #pod Handle => $socket, #pod ... #pod ); #pod return; #pod } #pod #pod # the callback event #pod sub event_sslify_result { #pod my ($creation_args, $called_args) = @_[ARG0, ARG1]; #pod my( $socket, $status, $errval ) = @$called_args; #pod #pod if ( $status ) { #pod print "Yay, SSLification worked!"; #pod } else { #pod print "Aw, SSLification failed with error $errval"; #pod } #pod } #pod =cut sub Client_SSLify { # Get the socket + version + options + ctx + callback my( $socket, $version, $options, $custom_ctx, $callback ) = @_; # Validation... if ( ! defined $socket ) { die "Did not get a defined socket"; } # Mangle the callback stuff if ( defined $version and ref $version and ref( $version ) eq 'CODE' ) { $callback = $version; $version = $options = $custom_ctx = undef; } elsif ( defined $options and ref $options and ref( $options ) eq 'CODE' ) { $callback = $options; $options = $custom_ctx = undef; } elsif ( defined $custom_ctx and ref $custom_ctx and ref( $custom_ctx ) eq 'CODE' ) { $callback = $custom_ctx; $custom_ctx = undef; } # From IO::Handle POD # If an error occurs blocking will return undef and $! will be set. if ( ! defined $socket->blocking( 0 ) ) { die "Unable to set nonblocking mode on socket: $!"; } # Now, we create the new socket and bind it to our subclass of Net::SSLeay::Handle my $newsock = gensym(); tie( *$newsock, 'POE::Component::SSLify::ClientHandle', $socket, $version, $options, $custom_ctx, $callback ) or die "Unable to tie to our subclass: $!"; # argh, store the newsock in the tied class to use for callback if ( defined $callback ) { tied( *$newsock )->{'orig_socket'} = $newsock; weaken( tied( *$newsock )->{'orig_socket'} ); } # All done! return $newsock; } #pod =func Server_SSLify #pod #pod This function sslifies a server-side socket. You can pass several options to it: #pod #pod my $socket = shift; #pod $socket = Server_SSLify( $socket, $ctx, $callback ); #pod $socket is the non-ssl socket you got from somewhere ( required ) #pod $ctx is the custom SSL context you want to use; overrides the global ctx set in SSLify_Options #pod $callback is the callback hook on success/failure of sslification #pod #pod BEWARE: L must be called first if you aren't passing a $ctx. If you want to set some options per-connection, do this: #pod #pod my $socket = shift; # get the socket from somewhere #pod my $ctx = SSLify_ContextCreate(); #pod # set various options on $ctx as desired #pod $socket = Server_SSLify( $socket, $ctx ); #pod #pod NOTE: You can use L to modify the global, and avoid doing this on every connection if the #pod options are the same... #pod #pod Please look at L for more details on the callback hook. #pod =cut sub Server_SSLify { # Get the socket! my( $socket, $custom_ctx, $callback ) = @_; # Validation... if ( ! defined $socket ) { die "Did not get a defined socket"; } # If we don't have a ctx ready, we can't do anything... if ( ! defined $ctx and ! defined $custom_ctx ) { die 'Please do SSLify_Options() first ( or pass in a $ctx object )'; } # mangle custom_ctx depending on callback if ( defined $custom_ctx and ref $custom_ctx and ref( $custom_ctx ) eq 'CODE' ) { $callback = $custom_ctx; $custom_ctx = undef; } # From IO::Handle POD # If an error occurs blocking will return undef and $! will be set. if ( ! defined $socket->blocking( 0 ) ) { die "Unable to set nonblocking mode on socket: $!"; } # Now, we create the new socket and bind it to our subclass of Net::SSLeay::Handle my $newsock = gensym(); tie( *$newsock, 'POE::Component::SSLify::ServerHandle', $socket, ( $custom_ctx || $ctx ), $callback ) or die "Unable to tie to our subclass: $!"; # argh, store the newsock in the tied class to use for connref if ( defined $callback ) { tied( *$newsock )->{'orig_socket'} = $newsock; weaken( tied( *$newsock )->{'orig_socket'} ); } # All done! return $newsock; } #pod =func SSLify_ContextCreate #pod #pod Accepts some options, and returns a brand-new Net::SSLeay context object ( $ctx ) #pod #pod my $ctx = SSLify_ContextCreate( $key, $cert, $version, $options ); #pod $key is the certificate key file #pod $cert is the certificate file #pod $version is the SSL version to use #pod $options is the SSL options to use #pod #pod You can then call various Net::SSLeay methods on the context #pod #pod my $mode = Net::SSLeay::CTX_get_mode( $ctx ); #pod #pod By default we don't use the SSL key + certificate files #pod #pod By default we use the version: default. Known versions of the SSL connection - look at #pod L for more info. #pod #pod * sslv2 #pod * sslv3 #pod * tlsv1 #pod * sslv23 #pod * default ( sslv23 ) #pod #pod By default we don't set any options - look at L for more info. #pod =cut sub SSLify_ContextCreate { # Get the key + cert + version + options my( $key, $cert, $version, $options ) = @_; return _createSSLcontext( $key, $cert, $version, $options ); } #pod =func SSLify_Options #pod #pod Call this function to initialize the global server-side context object. This will be the default context whenever you call #pod L without passing a custom context to it. #pod #pod SSLify_Options( $key, $cert, $version, $options ); #pod $key is the certificate key file ( required ) #pod $cert is the certificate file ( required ) #pod $version is the SSL version to use #pod $options is the SSL options to use #pod #pod By default we use the version: default #pod #pod By default we use the options: Net::SSLeay::OP_ALL #pod #pod Please look at L for more info on the available versions/options. #pod =cut sub SSLify_Options { # Get the key + cert + version + options my( $key, $cert, $version, $options ) = @_; # sanity if ( ! defined $key or ! defined $cert ) { die 'no key/cert specified'; } # Set the default if ( ! defined $options ) { $options = Net::SSLeay::OP_ALL(); } # set the context, possibly overwriting the previous one if ( defined $ctx ) { Net::SSLeay::CTX_free( $ctx ); undef $ctx; } $ctx = _createSSLcontext( $key, $cert, $version, $options ); # all done! return 1; } sub _createSSLcontext { my( $key, $cert, $version, $options ) = @_; my $context; if ( defined $version and ! ref $version ) { if ( $version eq 'sslv2' ) { $context = Net::SSLeay::CTX_v2_new(); } elsif ( $version eq 'sslv3' ) { $context = Net::SSLeay::CTX_v3_new(); } elsif ( $version eq 'tlsv1' ) { $context = Net::SSLeay::CTX_tlsv1_new(); } elsif ( $version eq 'sslv23' ) { $context = Net::SSLeay::CTX_v23_new(); } elsif ( $version eq 'default' ) { $context = Net::SSLeay::CTX_new(); } else { die "unknown SSL version: $version"; } } else { $context = Net::SSLeay::CTX_new(); } if ( ! defined $context ) { die_now( "Failed to create SSL_CTX $!" ); return; } # do we need to set options? if ( defined $options ) { Net::SSLeay::CTX_set_options( $context, $options ); die_if_ssl_error( 'ssl ctx set options' ) if ! $IGNORE_SSL_ERRORS; } # do we need to set key/etc? if ( defined $key ) { # Following will ask password unless private key is not encrypted Net::SSLeay::CTX_use_RSAPrivateKey_file( $context, $key, FILETYPE_PEM ); die_if_ssl_error( 'private key' ) if ! $IGNORE_SSL_ERRORS; } # Set the cert file if ( defined $cert ) { Net::SSLeay::CTX_use_certificate_chain_file( $context, $cert ); die_if_ssl_error( 'certificate' ) if ! $IGNORE_SSL_ERRORS; } # All done! return $context; } #pod =func SSLify_GetCTX #pod #pod Returns the actual Net::SSLeay context object in case you wanted to play with it :) #pod #pod If passed in a socket, it will return that socket's $ctx instead of the global. #pod #pod my $ctx = SSLify_GetCTX(); # get the one set via SSLify_Options #pod my $ctx = SSLify_GetCTX( $sslified_sock ); # get the one in the object #pod =cut sub SSLify_GetCTX { my $sock = shift; if ( ! defined $sock ) { return $ctx; } else { return tied( *$sock )->{'ctx'}; } } #pod =func SSLify_GetCipher #pod #pod Returns the cipher used by the SSLified socket #pod #pod print "SSL Cipher is: " . SSLify_GetCipher( $sslified_sock ) . "\n"; #pod #pod NOTE: Doing this immediately after Client_SSLify or Server_SSLify will result in "(NONE)" because the SSL handshake #pod is not done yet. The socket is nonblocking, so you will have to wait a little bit for it to get ready. #pod #pod apoc@blackhole:~/mygit/perl-poe-sslify/examples$ perl serverclient.pl #pod got connection from: 127.0.0.1 - commencing Server_SSLify() #pod SSLified: 127.0.0.1 cipher type: ((NONE)) #pod Connected to server, commencing Client_SSLify() #pod SSLified the connection to the server #pod Connected to SSL server #pod Input: hola #pod got input from: 127.0.0.1 cipher type: (AES256-SHA) input: 'hola' #pod Got Reply: hola #pod Input: ^C #pod stopped at serverclient.pl line 126. #pod =cut sub SSLify_GetCipher { my $sock = shift; return Net::SSLeay::get_cipher( tied( *$sock )->{'ssl'} ); } #pod =func SSLify_GetSocket #pod #pod Returns the actual socket used by the SSLified socket, useful for stuff like getpeername()/getsockname() #pod #pod print "Remote IP is: " . inet_ntoa( ( unpack_sockaddr_in( getpeername( SSLify_GetSocket( $sslified_sock ) ) ) )[1] ) . "\n"; #pod =cut sub SSLify_GetSocket { my $sock = shift; return tied( *$sock )->{'socket'}; } #pod =func SSLify_GetSSL #pod #pod Returns the actual Net::SSLeay object so you can call methods on it #pod #pod print Net::SSLeay::dump_peer_certificate( SSLify_GetSSL( $sslified_sock ) ); #pod =cut sub SSLify_GetSSL { my $sock = shift; return tied( *$sock )->{'ssl'}; } #pod =func SSLify_GetStatus #pod #pod Returns the status of the SSL negotiation/handshake/connection. See L #pod for more info. #pod #pod my $status = SSLify_GetStatus( $socket ); #pod -1 = still in negotiation stage ( or error ) #pod 0 = internal SSL error, connection will be dead #pod 1 = negotiation successful #pod =cut sub SSLify_GetStatus { my $sock = shift; return tied( *$sock )->{'status'}; } 1; __END__ =pod =encoding UTF-8 =for :stopwords Apocalypse cpan testmatrix url annocpan anno bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan =head1 NAME POE::Component::SSLify - Makes using SSL in the world of POE easy! =head1 VERSION This document describes v1.012 of POE::Component::SSLify - released November 14, 2014 as part of POE-Component-SSLify. =head1 SYNOPSIS # look at the DESCRIPTION for client and server example code =head1 DESCRIPTION This component is a method to simplify the SSLification of a socket before it is passed to a L wheel in your application. =head2 Client usage # Import the module use POE::Component::SSLify qw( Client_SSLify ); # Create a normal SocketFactory wheel and connect to a SSL-enabled server my $factory = POE::Wheel::SocketFactory->new; # Time passes, SocketFactory gives you a socket when it connects in SuccessEvent # Convert the socket into a SSL socket POE can communicate with my $socket = shift; eval { $socket = Client_SSLify( $socket ) }; if ( $@ ) { # Unable to SSLify it... } # Now, hand it off to ReadWrite my $rw = POE::Wheel::ReadWrite->new( Handle => $socket, # other options as usual ); =head2 Server usage # !!! Make sure you have a public key + certificate # excellent howto: http://www.akadia.com/services/ssh_test_certificate.html # Import the module use POE::Component::SSLify qw( Server_SSLify SSLify_Options ); # Set the key + certificate file eval { SSLify_Options( 'server.key', 'server.crt' ) }; if ( $@ ) { # Unable to load key or certificate file... } # Create a normal SocketFactory wheel to listen for connections my $factory = POE::Wheel::SocketFactory->new; # Time passes, SocketFactory gives you a socket when it gets a connection in SuccessEvent # Convert the socket into a SSL socket POE can communicate with my $socket = shift; eval { $socket = Server_SSLify( $socket ) }; if ( $@ ) { # Unable to SSLify it... } # Now, hand it off to ReadWrite my $rw = POE::Wheel::ReadWrite->new( Handle => $socket, # other options as usual ); =head1 FUNCTIONS =head2 Client_SSLify This function sslifies a client-side socket. You can pass several options to it: my $socket = shift; $socket = Client_SSLify( $socket, $version, $options, $ctx, $callback ); $socket is the non-ssl socket you got from somewhere ( required ) $version is the SSL version you want to use $options is the SSL options you want to use $ctx is the custom SSL context you want to use $callback is the callback hook on success/failure of sslification # This is an example of the callback and you should pass it as Client_SSLify( $socket, ... , \&callback ); sub callback { my( $socket, $status, $errval ) = @_; # $socket is the original sslified socket in case you need to play with it # $status is either 1 or 0; with 1 signifying success and 0 failure # $errval will be defined if $status == 0; it's the numeric SSL error code # check http://www.openssl.org/docs/ssl/SSL_get_error.html for the possible error values ( and import them from Net::SSLeay! ) # The return value from the callback is discarded } If $ctx is defined, SSLify will ignore $version and $options. Otherwise, it will be created from the $version and $options parameters. If all of them are undefined, it will follow the defaults in L. BEWARE: If you passed in a CTX, SSLify will do Net::SSLeay::CTX_free( $ctx ) when the socket is destroyed. This means you cannot reuse contexts! NOTE: The way to have a client socket with proper certificates set up is: my $socket = shift; # get the socket from somewhere my $ctx = SSLify_ContextCreate( 'server.key', 'server.crt' ); $socket = Client_SSLify( $socket, undef, undef, $ctx ); NOTE: You can pass the callback anywhere in the arguments, we'll figure it out for you! If you want to call a POE event, please look into the postback/callback stuff in L. # we got this from POE::Wheel::SocketFactory sub event_SuccessEvent { my $socket = $_[ARG0]; $socket = Client_SSLify( $socket, $_[SESSION]->callback( 'sslify_result' ) ); $_[HEAP]->{client} = POE::Wheel::ReadWrite->new( Handle => $socket, ... ); return; } # the callback event sub event_sslify_result { my ($creation_args, $called_args) = @_[ARG0, ARG1]; my( $socket, $status, $errval ) = @$called_args; if ( $status ) { print "Yay, SSLification worked!"; } else { print "Aw, SSLification failed with error $errval"; } } =head2 Server_SSLify This function sslifies a server-side socket. You can pass several options to it: my $socket = shift; $socket = Server_SSLify( $socket, $ctx, $callback ); $socket is the non-ssl socket you got from somewhere ( required ) $ctx is the custom SSL context you want to use; overrides the global ctx set in SSLify_Options $callback is the callback hook on success/failure of sslification BEWARE: L must be called first if you aren't passing a $ctx. If you want to set some options per-connection, do this: my $socket = shift; # get the socket from somewhere my $ctx = SSLify_ContextCreate(); # set various options on $ctx as desired $socket = Server_SSLify( $socket, $ctx ); NOTE: You can use L to modify the global, and avoid doing this on every connection if the options are the same... Please look at L for more details on the callback hook. =head2 SSLify_ContextCreate Accepts some options, and returns a brand-new Net::SSLeay context object ( $ctx ) my $ctx = SSLify_ContextCreate( $key, $cert, $version, $options ); $key is the certificate key file $cert is the certificate file $version is the SSL version to use $options is the SSL options to use You can then call various Net::SSLeay methods on the context my $mode = Net::SSLeay::CTX_get_mode( $ctx ); By default we don't use the SSL key + certificate files By default we use the version: default. Known versions of the SSL connection - look at L for more info. * sslv2 * sslv3 * tlsv1 * sslv23 * default ( sslv23 ) By default we don't set any options - look at L for more info. =head2 SSLify_Options Call this function to initialize the global server-side context object. This will be the default context whenever you call L without passing a custom context to it. SSLify_Options( $key, $cert, $version, $options ); $key is the certificate key file ( required ) $cert is the certificate file ( required ) $version is the SSL version to use $options is the SSL options to use By default we use the version: default By default we use the options: Net::SSLeay::OP_ALL Please look at L for more info on the available versions/options. =head2 SSLify_GetCTX Returns the actual Net::SSLeay context object in case you wanted to play with it :) If passed in a socket, it will return that socket's $ctx instead of the global. my $ctx = SSLify_GetCTX(); # get the one set via SSLify_Options my $ctx = SSLify_GetCTX( $sslified_sock ); # get the one in the object =head2 SSLify_GetCipher Returns the cipher used by the SSLified socket print "SSL Cipher is: " . SSLify_GetCipher( $sslified_sock ) . "\n"; NOTE: Doing this immediately after Client_SSLify or Server_SSLify will result in "(NONE)" because the SSL handshake is not done yet. The socket is nonblocking, so you will have to wait a little bit for it to get ready. apoc@blackhole:~/mygit/perl-poe-sslify/examples$ perl serverclient.pl got connection from: 127.0.0.1 - commencing Server_SSLify() SSLified: 127.0.0.1 cipher type: ((NONE)) Connected to server, commencing Client_SSLify() SSLified the connection to the server Connected to SSL server Input: hola got input from: 127.0.0.1 cipher type: (AES256-SHA) input: 'hola' Got Reply: hola Input: ^C stopped at serverclient.pl line 126. =head2 SSLify_GetSocket Returns the actual socket used by the SSLified socket, useful for stuff like getpeername()/getsockname() print "Remote IP is: " . inet_ntoa( ( unpack_sockaddr_in( getpeername( SSLify_GetSocket( $sslified_sock ) ) ) )[1] ) . "\n"; =head2 SSLify_GetSSL Returns the actual Net::SSLeay object so you can call methods on it print Net::SSLeay::dump_peer_certificate( SSLify_GetSSL( $sslified_sock ) ); =head2 SSLify_GetStatus Returns the status of the SSL negotiation/handshake/connection. See L for more info. my $status = SSLify_GetStatus( $socket ); -1 = still in negotiation stage ( or error ) 0 = internal SSL error, connection will be dead 1 = negotiation successful =head1 NOTES =head2 Socket methods doesn't work The new socket this module gives you actually is tied socket magic, so you cannot do stuff like getpeername() or getsockname(). The only way to do it is to use L and then operate on the socket it returns. =head2 Dying everywhere... This module will die() if Net::SSLeay could not be loaded or it is not the version we want. So, it is recommended that you check for errors and not use SSL, like so: eval { use POE::Component::SSLify }; if ( $@ ) { $sslavailable = 0; } else { $sslavailable = 1; } # Make socket SSL! if ( $sslavailable ) { eval { $socket = POE::Component::SSLify::Client_SSLify( $socket ) }; if ( $@ ) { # Unable to SSLify the socket... } } =head3 $IGNORE_SSL_ERRORS As of SSLify v1.003 you can override this variable to temporarily ignore some SSL errors. This is useful if you are doing crazy things with the underlying Net::SSLeay stuff and don't want to die. However, it won't ignore all errors as some is still considered fatal. Here's an example: { local $POE::Component::SSLify::IGNORE_SSL_ERRORS=1; my $ctx = SSLify_CreateContext(...); #Some more stuff } =head2 OpenSSL functions Theoretically you can do anything that Net::SSLeay exports from the OpenSSL libs on the socket. However, I have not tested every possible function against SSLify, so use them carefully! =head3 Net::SSLeay::renegotiate This function has been tested ( it's in C ) but it doesn't work on FreeBSD! I tracked it down to this security advisory: L which explains it in detail. The test will skip this function if it detects that you're on a broken system. However, if you have the updated OpenSSL library that fixes this you can use it. NOTE: Calling this means the callback function you passed in L or L will not fire! If you need this please let me know and we can come up with a way to make it work. =head2 Upgrading a non-ssl socket to SSL You can have a normal plaintext socket, and convert it to SSL anytime. Just keep in mind that the client and the server must agree to sslify at the same time, or they will be waiting on each other forever! See C for an example of how this works. =head2 Downgrading a SSL socket to non-ssl As of now this is unsupported. If you need this feature please let us know and we'll work on it together! =head2 MSWin32 is not supported This module doesn't work on MSWin32 platforms at all ( XP, Vista, 7, etc ) because of some weird underlying fd issues. Since I'm not a windows developer, I'm unable to fix this. However, it seems like Cygwin on MSWin32 works just fine! Please help me fix this if you can, thanks! =head2 LOAD_SSL_ENGINES OpenSSL supports loading ENGINEs to accelerate the crypto algorithms. SSLify v1.004 automatically loaded the engines, but there was some problems on certain platforms that caused coredumps. A big shout-out to BinGOs and CPANTesters for catching this! It's now disabled in v1.007 and you would need to explicitly enable it. sub POE::Component::SSLify::LOAD_SSL_ENGINES () { 1 } use POE::Component::SSLify qw( Client::SSLify ); =head1 EXPORT Stuffs all of the functions in @EXPORT_OK so you have to request them directly. =head1 SEE ALSO Please see those modules/websites for more information related to this module. =over 4 =item * L =item * L =back =head1 SUPPORT =head2 Perldoc You can find documentation for this module with the perldoc command. perldoc POE::Component::SSLify =head2 Websites The following websites have more information about this module, and may be of help to you. As always, in addition to those websites please use your favorite search engine to discover more resources. =over 4 =item * MetaCPAN A modern, open-source CPAN search engine, useful to view POD in HTML format. L =item * Search CPAN The default CPAN search engine, useful to view POD in HTML format. L =item * RT: CPAN's Bug Tracker The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN. L =item * AnnoCPAN The AnnoCPAN is a website that allows community annotations of Perl module documentation. L =item * CPAN Ratings The CPAN Ratings is a website that allows community ratings and reviews of Perl modules. L =item * CPAN Forum The CPAN Forum is a web forum for discussing Perl modules. L =item * CPANTS The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution. L =item * CPAN Testers The CPAN Testers is a network of smokers who run automated tests on uploaded CPAN distributions. L =item * CPAN Testers Matrix The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms. L =item * CPAN Testers Dependencies The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution. L =back =head2 Email You can email the author of this module at C asking for help with any problems you have. =head2 Internet Relay Chat You can get live help by using IRC ( Internet Relay Chat ). If you don't know what IRC is, please read this excellent guide: L. Please be courteous and patient when talking to us, as we might be busy or sleeping! You can join those networks/channels and get help: =over 4 =item * irc.perl.org You can connect to the server at 'irc.perl.org' and join this channel: #perl-help then talk to this person for help: Apocalypse. =item * irc.freenode.net You can connect to the server at 'irc.freenode.net' and join this channel: #perl then talk to this person for help: Apocal. =item * irc.efnet.org You can connect to the server at 'irc.efnet.org' and join this channel: #perl then talk to this person for help: Ap0cal. =back =head2 Bugs / Feature Requests Please report any bugs or feature requests by email to C, or through the web interface at L. You will be automatically notified of any progress on the request by the system. =head2 Source Code The code is open to the world, and available for you to hack on. Please feel free to browse it and play with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull from your repository :) L git clone https://github.com/apocalypse/perl-poe-sslify.git =head1 AUTHOR Apocalypse =head1 ACKNOWLEDGEMENTS Original code is entirely Rocco Caputo ( Creator of POE ) -> I simply packaged up the code into something everyone could use and accepted the burden of maintaining it :) From the PoCo::Client::HTTP code =] # This code should probably become a POE::Kernel method, # seeing as it's rather baroque and potentially useful in a number # of places. ASCENT also helped a lot with the nonblocking mode, without his hard work this module would still be stuck in the stone age :) A lot of people helped add various features/functions - please look at the changelog for more detail. =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2014 by Apocalypse. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. The full text of the license can be found in the F file included with this distribution. =head1 DISCLAIMER OF WARRANTY THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. =cut POE-Component-SSLify-1.012/CommitLog0000644000175000017500000001270612431461761015525 0ustar apocapoc================================================== Changes from 2013-11-14 00:00:00 +0000 to present. ================================================== ------------------------------------------ version 1.012 at 2014-11-14 20:19:55 +0000 ------------------------------------------ Change: 57b6383e061d573e12fe9cc90950cdbc37dcd25f Author: Apocalypse Date : 2014-11-14 12:18:49 +0000 remove magic from substr and reduce copying of strings ------------------------------------------ version 1.011 at 2014-11-14 03:08:48 +0000 ------------------------------------------ Change: 65afe245446e0e64a7a7eb87154f9d039fc39272 Author: Apocalypse Date : 2014-11-13 19:08:48 +0000 New CPAN release of POE-Component-SSLify - v1.011 - Tweak the testsuite thanks to CPANTesters! [STATISTICS] - code churn: 11 files changed, 37 insertions(+), 35 deletions(-) Change: 6795ac7e0577df360e1cd094113235d12eaae9d9 Author: Apocalypse Date : 2014-11-13 19:06:41 +0000 remove TODO from superbig tests Change: 82379d6f23f8bbb76a03ed26fd4bdbc2af288fd2 Author: Apocalypse Date : 2014-11-13 19:01:25 +0000 dont test blocking mode on MSWin32, thanks CPANTesters and DSOLIMANO Change: 48c4ba77fed8089a608ecaf9ec8b7789a3e73c27 Author: Apocalypse Date : 2014-11-13 18:47:32 +0000 switch to POE::Filter::Block to reduce issues from Filter::Line Change: 9a89ec61f97b246088fb02508d1479295706bd22 Author: Apocalypse Date : 2014-11-13 16:30:19 +0000 add pogomips concept from POE =] ------------------------------------------ version 1.010 at 2014-11-12 06:19:01 +0000 ------------------------------------------ Change: dc234fe2f82b3982d475ee45fdc3534d1bfc178d Author: Apocalypse Date : 2014-11-11 22:19:01 +0000 New CPAN release of POE-Component-SSLify - v1.010 - add informational test that prints out ssleay version - clamp the writes to 16K internally to get around write errors reported by RT#95071 and RT#58243, thanks! [STATISTICS] - code churn: 7 files changed, 591 insertions(+), 5 deletions(-) Change: f8043053bd401402979e7161d2fcc31f8184cb3b Author: Apocalypse Date : 2014-11-11 22:13:38 +0000 satisfy perlcritic... Change: c0ce9919c362c501fbe2487b718e68e5a7e1f038 Author: Apocalypse Date : 2014-11-11 21:50:17 +0000 add website link about same write issue Change: 3d8fa3c965241a7bc6b9b229d56863823dab02f5 Author: Apocalypse Date : 2014-11-11 21:46:21 +0000 tweak changes header Change: 26ef9be50cd5069bfe938fc41da7630ef0d5a739 Author: Apocalypse Date : 2014-11-11 21:41:59 +0000 clamp the writes Change: cae051e4f8c5c6368b9112a4fdc94f75b20ccf0d Author: Apocalypse Date : 2014-11-11 21:41:07 +0000 activate superbig tests for automated Change: 68ffe2c85d5f250b02b14e16da8fc973dfb259aa Author: Apocalypse Date : 2014-11-11 21:30:21 +0000 add ssleay info test Change: 200d56da2705d8bb5dedc384a8f7694aba331053 Author: Apocalypse Date : 2014-11-11 16:52:04 +0000 fix damn tabs ------------------------------------------ version 1.009 at 2014-11-12 00:45:19 +0000 ------------------------------------------ Change: 89e7cf553d93fe61a3c2eb9240f027b87d80954d Author: Apocalypse Date : 2014-11-11 16:45:19 +0000 New CPAN release of POE-Component-SSLify - v1.009 - Updates to the auto-generated files - Tweaked the testsuite to use done_testing() for sanity, RT#66741 (thanks RCAPUTO!) - Use Test::FailWarnings in the testsuite in place of Test::NoWarnings (DAGOLDEN++) - Add t/simple_large.t to try and track down RT#58243 (thanks Johan!) - Added a boatload of tests to try and track down RT#95071 (thanks Joe!) [STATISTICS] - code churn: 27 files changed, 2160 insertions(+), 1503 deletions(-) Change: b717e75279e2b28ebd4b0d8ab0ce48cd7540998f Author: Apocalypse Date : 2014-11-11 16:41:22 +0000 dont test superbig tests! Change: e1aed14b94e9d1852b08208895262726d629fe3c Author: Apocalypse Date : 2014-11-11 15:51:56 +0000 tweak tests and add more large size tests Change: 0d1324143216eb9cd1cf07ba0c2ac814a268cf6f Author: Apocalypse Date : 2014-11-11 14:29:58 +0000 fix changes Change: 7621d86c76c95fb7495717a4d4e0b912cfe51b97 Author: Apocalypse Date : 2014-11-11 14:27:39 +0000 add test to try and track down RT#58243 Change: 3db8619e947a14554c1a04ec8a8c5c0cac19acb5 Author: Apocalypse Date : 2014-11-11 14:10:54 +0000 rename tests for clarity Change: ffbe1df7efa2ab2fd03230a44bdd14f0300bad5e Author: Apocalypse Date : 2014-11-11 14:08:06 +0000 use Test::FailWarnings and migrate to done_testing Change: f6a84928364e3a57e71733620bcbe8544a8ee6f2 Author: Apocalypse Date : 2014-11-11 14:00:30 +0000 tweaks to POD and stuff to pass tests Change: cd37d35eacaae2505f7d657b15d6e5820bf4f3fe Author: Apocalypse Date : 2014-11-09 01:19:19 +0000 mailmap ================================================ Plus 9 releases after 2013-11-14 00:00:00 +0000. ================================================ POE-Component-SSLify-1.012/t/0000775000175000017500000000000012431461761014147 5ustar apocapocPOE-Component-SSLify-1.012/t/00-report-prereqs.dd0000644000175000017500000000415712431461761017674 0ustar apocapocdo { my $x = { 'configure' => { 'requires' => { 'ExtUtils::MakeMaker' => '0', 'Module::Build::Tiny' => '0.039', 'perl' => '5.006' } }, 'runtime' => { 'requires' => { 'Exporter' => '0', 'IO::Handle' => '1.28', 'Net::SSLeay' => '1.36', 'POE' => '1.267', 'Scalar::Util' => '0', 'Symbol' => '0', 'Task::Weaken' => '1.03', 'parent' => '0', 'perl' => '5.006', 'strict' => '0', 'warnings' => '0' } }, 'test' => { 'recommends' => { 'CPAN::Meta' => '2.120900' }, 'requires' => { 'ExtUtils::MakeMaker' => '0', 'File::Spec' => '0', 'File::Temp' => '0', 'IO::Handle' => '1.28', 'IPC::Open3' => '0', 'POE' => '1.267', 'POE::Component::Client::TCP' => '0', 'POE::Component::Server::TCP' => '0', 'POE::Filter::Stream' => '0', 'Socket' => '0', 'Test::FailWarnings' => '0', 'Test::More' => '1.001002', 'perl' => '5.006' } } }; $x; }POE-Component-SSLify-1.012/t/connect_hook_nodata.t0000644000175000017500000001011512431461761020327 0ustar apocapoc#!/usr/bin/perl # # This file is part of POE-Component-SSLify # # This software is copyright (c) 2014 by Apocalypse. # # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # use strict; use warnings; use strict; use warnings; # This tests the connection OK hook on both server/client use Test::FailWarnings; use Test::More 1.001002; # new enough for sanity in done_testing() use POE 1.267; use POE::Component::Client::TCP; use POE::Component::Server::TCP; use POE::Component::SSLify qw/Client_SSLify Server_SSLify SSLify_Options SSLify_GetCipher SSLify_GetSocket SSLify_GetStatus/; # TODO rewrite this to use Test::POE::Server::TCP and stuff :) my $port; POE::Component::Server::TCP->new ( Alias => 'myserver', Address => '127.0.0.1', Port => 0, Started => sub { use Socket qw/sockaddr_in/; $port = (sockaddr_in($_[HEAP]->{listener}->getsockname))[0]; }, ClientConnected => sub { ok(1, 'SERVER: accepted'); }, ClientDisconnected => sub { ok(1, 'SERVER: client disconnected'); $_[KERNEL]->post( 'myserver' => 'shutdown'); }, ClientPreConnect => sub { eval { SSLify_Options('mylib/example.key', 'mylib/example.crt') }; eval { SSLify_Options('../mylib/example.key', '../mylib/example.crt') } if ($@); ok(!$@, "SERVER: SSLify_Options $@"); my $socket = eval { Server_SSLify( $_[ARG0], sub { my( $socket, $status, $errval ) = @_; pass( "SERVER: Got callback hook" ); is( $status, 1, "SERVER: Status received from callback is OK" ); ## At this point, connection MUST be encrypted. my $cipher = SSLify_GetCipher($socket); ok($cipher ne '(NONE)', "SERVER: SSLify_GetCipher: $cipher"); ok( SSLify_GetStatus($socket) == 1, "SERVER: SSLify_GetStatus is done" ); } ) }; ok(!$@, "SERVER: Server_SSLify $@"); ok( SSLify_GetStatus($socket) == -1, "SERVER: SSLify_GetStatus is pending" ); return ($socket); }, ClientInput => sub { my ($kernel, $heap, $line) = @_[KERNEL, HEAP, ARG0]; die "Should have never got any input from the client!"; }, ClientError => sub { # Thanks to H. Merijn Brand for spotting this FAIL in 5.12.0! # The default PoCo::Server::TCP handler will throw a warning, which causes Test::NoWarnings to FAIL :( my ($syscall, $errno, $error) = @_[ ARG0..ARG2 ]; # TODO are there other "errors" that is harmless? $error = "Normal disconnection" unless $error; my $msg = "Got SERVER $syscall error $errno: $error"; unless ( $syscall eq 'read' and $errno == 0 ) { fail( $msg ); } else { diag( $msg ) if $ENV{TEST_VERBOSE}; } }, ); POE::Component::Client::TCP->new ( Alias => 'myclient', RemoteAddress => '127.0.0.1', RemotePort => $port, Connected => sub { ok(1, 'CLIENT: connected'); }, PreConnect => sub { my $socket = eval { Client_SSLify($_[ARG0], sub { my( $socket, $status, $errval ) = @_; pass( "CLIENT: Got callback hook" ); is( $status, 1, "CLIENT: Status received from callback is OK" ); ## At this point, connection MUST be encrypted. my $cipher = SSLify_GetCipher($socket); ok($cipher ne '(NONE)', "CLIENT: SSLify_GetCipher: $cipher"); ok( SSLify_GetStatus($socket) == 1, "CLIENT: SSLify_GetStatus is done" ); $poe_kernel->post( 'myclient' => 'shutdown' ); }) }; ok(!$@, "CLIENT: Client_SSLify $@"); ok( SSLify_GetStatus($socket) == -1, "CLIENT: SSLify_GetStatus is pending" ); return ($socket); }, ServerInput => sub { my ($kernel, $heap, $line) = @_[KERNEL, HEAP, ARG0]; die "Should have never got any input from the server!"; }, ServerError => sub { # Thanks to H. Merijn Brand for spotting this FAIL in 5.12.0! # The default PoCo::Client::TCP handler will throw a warning, which causes Test::NoWarnings to FAIL :( my ($syscall, $errno, $error) = @_[ ARG0..ARG2 ]; # TODO are there other "errors" that is harmless? $error = "Normal disconnection" unless $error; my $msg = "Got CLIENT $syscall error $errno: $error"; unless ( $syscall eq 'read' and $errno == 0 ) { fail( $msg ); } else { diag( $msg ) if $ENV{TEST_VERBOSE}; } }, ); $poe_kernel->run(); done_testing; POE-Component-SSLify-1.012/t/00-report-prereqs.t0000644000175000017500000001273212431461761017546 0ustar apocapoc#!perl # # This file is part of POE-Component-SSLify # # This software is copyright (c) 2014 by Apocalypse. # # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # use strict; use warnings; use strict; use warnings; # This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs 0.019 use Test::More tests => 1; use ExtUtils::MakeMaker; use File::Spec; # from $version::LAX my $lax_version_re = qr/(?: undef | (?: (?:[0-9]+) (?: \. | (?:\.[0-9]+) (?:_[0-9]+)? )? | (?:\.[0-9]+) (?:_[0-9]+)? ) | (?: v (?:[0-9]+) (?: (?:\.[0-9]+)+ (?:_[0-9]+)? )? | (?:[0-9]+)? (?:\.[0-9]+){2,} (?:_[0-9]+)? ) )/x; # hide optional CPAN::Meta modules from prereq scanner # and check if they are available my $cpan_meta = "CPAN::Meta"; my $cpan_meta_pre = "CPAN::Meta::Prereqs"; my $HAS_CPAN_META = eval "require $cpan_meta; $cpan_meta->VERSION('2.120900')" && eval "require $cpan_meta_pre"; ## no critic # Verify requirements? my $DO_VERIFY_PREREQS = 1; sub _max { my $max = shift; $max = ( $_ > $max ) ? $_ : $max for @_; return $max; } sub _merge_prereqs { my ($collector, $prereqs) = @_; # CPAN::Meta::Prereqs object if (ref $collector eq $cpan_meta_pre) { return $collector->with_merged_prereqs( CPAN::Meta::Prereqs->new( $prereqs ) ); } # Raw hashrefs for my $phase ( keys %$prereqs ) { for my $type ( keys %{ $prereqs->{$phase} } ) { for my $module ( keys %{ $prereqs->{$phase}{$type} } ) { $collector->{$phase}{$type}{$module} = $prereqs->{$phase}{$type}{$module}; } } } return $collector; } my @include = qw( ); my @exclude = qw( ); # Add static prereqs to the included modules list my $static_prereqs = do 't/00-report-prereqs.dd'; # Merge all prereqs (either with ::Prereqs or a hashref) my $full_prereqs = _merge_prereqs( ( $HAS_CPAN_META ? $cpan_meta_pre->new : {} ), $static_prereqs ); # Add dynamic prereqs to the included modules list (if we can) my ($source) = grep { -f } 'MYMETA.json', 'MYMETA.yml'; if ( $source && $HAS_CPAN_META ) { if ( my $meta = eval { CPAN::Meta->load_file($source) } ) { $full_prereqs = _merge_prereqs($full_prereqs, $meta->prereqs); } } else { $source = 'static metadata'; } my @full_reports; my @dep_errors; my $req_hash = $HAS_CPAN_META ? $full_prereqs->as_string_hash : $full_prereqs; # Add static includes into a fake section for my $mod (@include) { $req_hash->{other}{modules}{$mod} = 0; } for my $phase ( qw(configure build test runtime develop other) ) { next unless $req_hash->{$phase}; next if ($phase eq 'develop' and not $ENV{AUTHOR_TESTING}); for my $type ( qw(requires recommends suggests conflicts modules) ) { next unless $req_hash->{$phase}{$type}; my $title = ucfirst($phase).' '.ucfirst($type); my @reports = [qw/Module Want Have/]; for my $mod ( sort keys %{ $req_hash->{$phase}{$type} } ) { next if $mod eq 'perl'; next if grep { $_ eq $mod } @exclude; my $file = $mod; $file =~ s{::}{/}g; $file .= ".pm"; my ($prefix) = grep { -e File::Spec->catfile($_, $file) } @INC; my $want = $req_hash->{$phase}{$type}{$mod}; $want = "undef" unless defined $want; $want = "any" if !$want && $want == 0; my $req_string = $want eq 'any' ? 'any version required' : "version '$want' required"; if ($prefix) { my $have = MM->parse_version( File::Spec->catfile($prefix, $file) ); $have = "undef" unless defined $have; push @reports, [$mod, $want, $have]; if ( $DO_VERIFY_PREREQS && $HAS_CPAN_META && $type eq 'requires' ) { if ( $have !~ /\A$lax_version_re\z/ ) { push @dep_errors, "$mod version '$have' cannot be parsed ($req_string)"; } elsif ( ! $full_prereqs->requirements_for( $phase, $type )->accepts_module( $mod => $have ) ) { push @dep_errors, "$mod version '$have' is not in required range '$want'"; } } } else { push @reports, [$mod, $want, "missing"]; if ( $DO_VERIFY_PREREQS && $type eq 'requires' ) { push @dep_errors, "$mod is not installed ($req_string)"; } } } if ( @reports ) { push @full_reports, "=== $title ===\n\n"; my $ml = _max( map { length $_->[0] } @reports ); my $wl = _max( map { length $_->[1] } @reports ); my $hl = _max( map { length $_->[2] } @reports ); splice @reports, 1, 0, ["-" x $ml, "-" x $wl, "-" x $hl]; push @full_reports, map { sprintf(" %*s %*s %*s\n", -$ml, $_->[0], $wl, $_->[1], $hl, $_->[2]) } @reports; push @full_reports, "\n"; } } } if ( @full_reports ) { diag "\nVersions for all modules listed in $source (including optional ones):\n\n", @full_reports; } if ( @dep_errors ) { diag join("\n", "\n*** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING ***\n", "The following REQUIRED prerequisites were not satisfied:\n", @dep_errors, "\n" ); } pass; # vim: ts=4 sts=4 sw=4 et: POE-Component-SSLify-1.012/t/simple.t0000644000175000017500000001066412431461761015632 0ustar apocapoc#!/usr/bin/perl # # This file is part of POE-Component-SSLify # # This software is copyright (c) 2014 by Apocalypse. # # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # use strict; use warnings; use strict; use warnings; # Thanks to ASCENT for this test! # This tests the basic functionality of sslify on client/server side use Test::FailWarnings; use Test::More 1.001002; # new enough for sanity in done_testing() use POE 1.267; use POE::Component::Client::TCP; use POE::Component::Server::TCP; use POE::Component::SSLify qw/Client_SSLify Server_SSLify SSLify_Options SSLify_GetCipher SSLify_ContextCreate SSLify_GetSocket SSLify_GetSSL/; # TODO rewrite this to use Test::POE::Server::TCP and stuff :) my $port; POE::Component::Server::TCP->new ( Alias => 'myserver', Address => '127.0.0.1', Port => 0, Started => sub { use Socket qw/sockaddr_in/; $port = (sockaddr_in($_[HEAP]->{listener}->getsockname))[0]; }, ClientConnected => sub { ok(1, 'SERVER: accepted'); }, ClientDisconnected => sub { ok(1, 'SERVER: client disconnected'); $_[KERNEL]->post(myserver => 'shutdown'); }, ClientPreConnect => sub { eval { SSLify_Options('mylib/example.key', 'mylib/example.crt', 'sslv3') }; eval { SSLify_Options('../mylib/example.key', '../mylib/example.crt', 'sslv3') } if ($@); ok(!$@, "SERVER: SSLify_Options $@"); my $socket = eval { Server_SSLify($_[ARG0]) }; ok(!$@, "SERVER: Server_SSLify $@"); ok(1, 'SERVER: SSLify_GetCipher: '. SSLify_GetCipher($socket)); # We pray that IO::Handle is sane... ok( SSLify_GetSocket( $socket )->blocking == 0, 'SERVER: SSLified socket is non-blocking?') if $^O ne 'MSWin32'; return ($socket); }, ClientInput => sub { my ($kernel, $heap, $line) = @_[KERNEL, HEAP, ARG0]; if ( $line eq 'ping' ) { ok(1, "SERVER: recv: $line"); ## At this point, connection MUST be encrypted. my $cipher = SSLify_GetCipher($heap->{client}->get_output_handle); ok($cipher ne '(NONE)', "SERVER: SSLify_GetCipher: $cipher"); $heap->{client}->put("pong"); } else { die "Unknown line from CLIENT: $line"; } }, ClientError => sub { # Thanks to H. Merijn Brand for spotting this FAIL in 5.12.0! # The default PoCo::Server::TCP handler will throw a warning, which causes Test::NoWarnings to FAIL :( my ($syscall, $errno, $error) = @_[ ARG0..ARG2 ]; # TODO are there other "errors" that is harmless? $error = "Normal disconnection" unless $error; my $msg = "Got SERVER $syscall error $errno: $error"; unless ( $syscall eq 'read' and $errno == 0 ) { fail( $msg ); } else { diag( $msg ) if $ENV{TEST_VERBOSE}; } }, ); POE::Component::Client::TCP->new ( Alias => 'myclient', RemoteAddress => '127.0.0.1', RemotePort => $port, Connected => sub { ok(1, 'CLIENT: connected'); $_[HEAP]->{server}->put("ping"); }, PreConnect => sub { my $ctx = eval { SSLify_ContextCreate(undef, undef, 'sslv3') }; ok(!$@, "CLIENT: SSLify_ContextCreate $@"); my $socket = eval { Client_SSLify($_[ARG0], undef, undef, $ctx) }; ok(!$@, "CLIENT: Client_SSLify $@"); ok(1, 'CLIENT: SSLify_GetCipher: '. SSLify_GetCipher($socket)); # We pray that IO::Handle is sane... ok( SSLify_GetSocket( $socket )->blocking == 0, 'CLIENT: SSLified socket is non-blocking?') if $^O ne 'MSWin32'; return ($socket); }, ServerInput => sub { my ($kernel, $heap, $line) = @_[KERNEL, HEAP, ARG0]; if ($line eq 'pong') { ok(1, "CLIENT: recv: $line"); ## At this point, connection MUST be encrypted. my $cipher = SSLify_GetCipher($heap->{server}->get_output_handle); ok($cipher ne '(NONE)', "CLIENT: SSLify_GetCipher: $cipher"); diag( Net::SSLeay::dump_peer_certificate( SSLify_GetSSL( $heap->{server}->get_output_handle ) ) ) if $ENV{TEST_VERBOSE}; $kernel->yield('shutdown'); } else { die "Unknown line from SERVER: $line"; } }, ServerError => sub { # Thanks to H. Merijn Brand for spotting this FAIL in 5.12.0! # The default PoCo::Client::TCP handler will throw a warning, which causes Test::NoWarnings to FAIL :( my ($syscall, $errno, $error) = @_[ ARG0..ARG2 ]; # TODO are there other "errors" that is harmless? $error = "Normal disconnection" unless $error; my $msg = "Got CLIENT $syscall error $errno: $error"; unless ( $syscall eq 'read' and $errno == 0 ) { fail( $msg ); } else { diag( $msg ) if $ENV{TEST_VERBOSE}; } }, ); $poe_kernel->run(); done_testing; POE-Component-SSLify-1.012/t/apocalypse.t0000644000175000017500000000075112431461761016475 0ustar apocapoc#!perl # # This file is part of POE-Component-SSLify # # This software is copyright (c) 2014 by Apocalypse. # # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # use strict; use warnings; use strict; use warnings; use Test::More; eval "use Test::Apocalypse 1.000"; if ( $@ ) { plan skip_all => 'Test::Apocalypse required for validating the distribution'; } else { is_apocalypse_here( { } ); } POE-Component-SSLify-1.012/t/upgrade.t0000644000175000017500000001307212431461761015764 0ustar apocapoc#!/usr/bin/perl # # This file is part of POE-Component-SSLify # # This software is copyright (c) 2014 by Apocalypse. # # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # use strict; use warnings; use strict; use warnings; # This tests in-situ sslification ( upgrade a non-ssl socket to ssl ) use Test::FailWarnings; use Test::More 1.001002; # new enough for sanity in done_testing() use POE 1.267; use POE::Component::Client::TCP; use POE::Component::Server::TCP; use POE::Component::SSLify qw/Client_SSLify Server_SSLify SSLify_Options SSLify_GetCipher SSLify_ContextCreate SSLify_GetSocket/; # TODO rewrite this to use Test::POE::Server::TCP and stuff :) my $port; POE::Component::Server::TCP->new ( Alias => 'myserver', Address => '127.0.0.1', Port => 0, Started => sub { use Socket qw/sockaddr_in/; $port = (sockaddr_in($_[HEAP]->{listener}->getsockname))[0]; }, ClientConnected => sub { ok(1, 'SERVER: accepted'); }, ClientDisconnected => sub { ok(1, 'SERVER: client disconnected'); $_[KERNEL]->post(myserver => 'shutdown'); }, ClientInput => sub { my ($kernel, $heap, $line) = @_[KERNEL, HEAP, ARG0]; if ( $line eq 'plaintext_ping' ) { ok(1, "SERVER: recv: $line"); $heap->{client}->put('plaintext_pong'); $heap->{client}->flush; # make sure we sent the pong # sslify it in-situ! eval { SSLify_Options('mylib/example.key', 'mylib/example.crt', 'sslv3') }; eval { SSLify_Options('../mylib/example.key', '../mylib/example.crt', 'sslv3') } if ($@); ok(!$@, "SERVER: SSLify_Options $@"); my $socket = eval { Server_SSLify($heap->{client}->get_output_handle) }; ok(!$@, "SERVER: Server_SSLify $@"); ok(1, 'SERVER: SSLify_GetCipher: '. SSLify_GetCipher($socket)); # We pray that IO::Handle is sane... ok( SSLify_GetSocket( $socket )->blocking == 0, 'SERVER: SSLified socket is non-blocking?') if $^O ne 'MSWin32'; # TODO evil code here, ha! # Should I ask rcaputo to add a $rw->replace_handle($socket) method? # if you don't do the undef and just replace it - you'll get a bad file descriptor error from POE! # select error: Bad file descriptor (hits=-1) undef $heap->{client}; $heap->{client} = POE::Wheel::ReadWrite->new( Handle => $socket, InputEvent => 'tcp_server_got_input', ErrorEvent => 'tcp_server_got_error', FlushedEvent => 'tcp_server_got_flush', ); } elsif ( $line eq 'ssl_ping' ) { ok(1, "SERVER: recv: $line"); ## At this point, connection MUST be encrypted. my $cipher = SSLify_GetCipher($heap->{client}->get_output_handle); ok($cipher ne '(NONE)', "SERVER: SSLify_GetCipher: $cipher"); $heap->{client}->put('ssl_pong'); } else { die "Unknown line from CLIENT: $line"; } }, ClientError => sub { # Thanks to H. Merijn Brand for spotting this FAIL in 5.12.0! # The default PoCo::Server::TCP handler will throw a warning, which causes Test::NoWarnings to FAIL :( my ($syscall, $errno, $error) = @_[ ARG0..ARG2 ]; # TODO are there other "errors" that is harmless? $error = "Normal disconnection" unless $error; my $msg = "Got SERVER $syscall error $errno: $error"; unless ( $syscall eq 'read' and $errno == 0 ) { fail( $msg ); } else { diag( $msg ) if $ENV{TEST_VERBOSE}; } }, ); POE::Component::Client::TCP->new ( Alias => 'myclient', RemoteAddress => '127.0.0.1', RemotePort => $port, Connected => sub { ok(1, 'CLIENT: connected'); $_[HEAP]->{server}->put("plaintext_ping"); }, ServerInput => sub { my ($kernel, $heap, $line) = @_[KERNEL, HEAP, ARG0]; if ( $line eq 'plaintext_pong' ) { ok(1, "CLIENT: recv: $line"); # sslify it in-situ! my $ctx = eval { SSLify_ContextCreate(undef, undef, 'sslv3') }; ok(!$@, "CLIENT: SSLify_ContextCreate $@"); my $socket = eval { Client_SSLify($heap->{server}->get_output_handle, undef, undef, $ctx) }; ok(!$@, "CLIENT: Client_SSLify $@"); ok(1, 'CLIENT: SSLify_GetCipher: '. SSLify_GetCipher($socket)); # We pray that IO::Handle is sane... ok( SSLify_GetSocket( $socket )->blocking == 0, 'CLIENT: SSLified socket is non-blocking?') if $^O ne 'MSWin32'; # TODO evil code here, ha! # Should I ask rcaputo to add a $rw->replace_handle($socket) method? # if you don't do the undef and just replace it - you'll get a bad file descriptor error from POE! # select error: Bad file descriptor (hits=-1) undef $heap->{server}; $heap->{server} = POE::Wheel::ReadWrite->new( Handle => $socket, InputEvent => 'got_server_input', ErrorEvent => 'got_server_error', FlushedEvent => 'got_server_flush', ); # Send the ssl ping! $heap->{server}->put('ssl_ping'); } elsif ( $line eq 'ssl_pong' ) { ok(1, "CLIENT: recv: $line"); ## At this point, connection MUST be encrypted. my $cipher = SSLify_GetCipher($heap->{server}->get_output_handle); ok($cipher ne '(NONE)', "CLIENT: SSLify_GetCipher: $cipher"); $kernel->yield('shutdown'); } else { die "Unknown line from SERVER: $line"; } }, ServerError => sub { # Thanks to H. Merijn Brand for spotting this FAIL in 5.12.0! # The default PoCo::Client::TCP handler will throw a warning, which causes Test::NoWarnings to FAIL :( my ($syscall, $errno, $error) = @_[ ARG0..ARG2 ]; # TODO are there other "errors" that is harmless? $error = "Normal disconnection" unless $error; my $msg = "Got CLIENT $syscall error $errno: $error"; unless ( $syscall eq 'read' and $errno == 0 ) { fail( $msg ); } else { diag( $msg ) if $ENV{TEST_VERBOSE}; } }, ); $poe_kernel->run(); done_testing; POE-Component-SSLify-1.012/t/simple_parallel_superbig.t0000644000175000017500000001266412431461761021410 0ustar apocapoc#!/usr/bin/perl # # This file is part of POE-Component-SSLify # # This software is copyright (c) 2014 by Apocalypse. # # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # use strict; use warnings; use strict; use warnings; # This is an extension of the simple_parallel_large.t test for even LARGER message sizes! # and thus is marked as TODO and a watchdog timer of 2m is set in case we lock up - see RT#95071 use Test::FailWarnings; use Test::More 1.001002; # new enough for sanity in done_testing() BEGIN { eval 'use IO::Prompt::Tiny qw/prompt/; my $ans = prompt("This is a long test, do you want to run it? (y/n)", ($ENV{"AUTOMATED_TESTING"} ? "y" : "n")); die "NO" if $ans ne "y";'; if ( $@ ) { plan skip_all => "AUTHOR TEST: $@"; } } use POE 1.267; use POE::Component::Client::TCP; use POE::Component::Server::TCP; use POE::Component::SSLify qw/Client_SSLify Server_SSLify SSLify_Options SSLify_GetCipher SSLify_ContextCreate SSLify_GetSocket SSLify_GetSSL/; # TODO rewrite this to use Test::POE::Server::TCP and stuff :) my $port; my $replies = 0; # TODO interestingly, x3 goes over some sort of buffer size and this explodes! my $bigpacket = join( '-', ('a' .. 'z') x 10000, ('A' .. 'Z') x 10000 ) x 10; POE::Component::Server::TCP->new ( Alias => 'myserver', Address => '127.0.0.1', Port => 0, ClientFilter => ['POE::Filter::Block', 'BlockSize' => length $bigpacket], Started => sub { use Socket qw/sockaddr_in/; $port = (sockaddr_in($_[HEAP]->{listener}->getsockname))[0]; }, ClientConnected => sub { ok(1, 'SERVER: accepted'); }, ClientDisconnected => sub { ok(1, 'SERVER: client disconnected'); $_[KERNEL]->post(myserver => 'shutdown') if $replies == 10; }, ClientPreConnect => sub { eval { SSLify_Options('mylib/example.key', 'mylib/example.crt', 'sslv3') }; eval { SSLify_Options('../mylib/example.key', '../mylib/example.crt', 'sslv3') } if ($@); ok(!$@, "SERVER: SSLify_Options $@"); my $socket = eval { Server_SSLify($_[ARG0]) }; ok(!$@, "SERVER: Server_SSLify $@"); ok(1, 'SERVER: SSLify_GetCipher: '. SSLify_GetCipher($socket)); # We pray that IO::Handle is sane... ok( SSLify_GetSocket( $socket )->blocking == 0, 'SERVER: SSLified socket is non-blocking?') if $^O ne 'MSWin32'; return ($socket); }, ClientInput => sub { my ($kernel, $heap, $line) = @_[KERNEL, HEAP, ARG0]; if ( $line eq $bigpacket ) { ## At this point, connection MUST be encrypted. my $cipher = SSLify_GetCipher($heap->{client}->get_output_handle); ok($cipher ne '(NONE)', "SERVER: SSLify_GetCipher: $cipher"); $heap->{client}->put($bigpacket); } else { die "Unknown line from CLIENT: $line"; } }, ClientError => sub { # Thanks to H. Merijn Brand for spotting this FAIL in 5.12.0! # The default PoCo::Server::TCP handler will throw a warning, which causes Test::NoWarnings to FAIL :( my ($syscall, $errno, $error) = @_[ ARG0..ARG2 ]; # TODO are there other "errors" that is harmless? $error = "Normal disconnection" unless $error; my $msg = "Got SERVER $syscall error $errno: $error"; unless ( $syscall eq 'read' and $errno == 0 ) { fail( $msg ); } else { diag( $msg ) if $ENV{TEST_VERBOSE}; } }, ); POE::Component::Client::TCP->new ( Alias => 'myclient', RemoteAddress => '127.0.0.1', RemotePort => $port, Filter => ['POE::Filter::Block', 'BlockSize' => length $bigpacket], Connected => sub { ok(1, 'CLIENT: connected'); $_[HEAP]->{server}->put($bigpacket); }, PreConnect => sub { my $ctx = eval { SSLify_ContextCreate(undef, undef, 'sslv3') }; ok(!$@, "CLIENT: SSLify_ContextCreate $@"); my $socket = eval { Client_SSLify($_[ARG0], undef, undef, $ctx) }; ok(!$@, "CLIENT: Client_SSLify $@"); ok(1, 'CLIENT: SSLify_GetCipher: '. SSLify_GetCipher($socket)); # We pray that IO::Handle is sane... ok( SSLify_GetSocket( $socket )->blocking == 0, 'CLIENT: SSLified socket is non-blocking?') if $^O ne 'MSWin32'; return ($socket); }, ServerInput => sub { my ($kernel, $heap, $line) = @_[KERNEL, HEAP, ARG0]; if ($line eq $bigpacket) { ## At this point, connection MUST be encrypted. my $cipher = SSLify_GetCipher($heap->{server}->get_output_handle); ok($cipher ne '(NONE)', "CLIENT: SSLify_GetCipher: $cipher"); diag( Net::SSLeay::dump_peer_certificate( SSLify_GetSSL( $heap->{server}->get_output_handle ) ) ) if $ENV{TEST_VERBOSE}; $replies++; $kernel->yield('shutdown'); } else { die "Unknown line from SERVER: $line"; } }, ServerError => sub { # Thanks to H. Merijn Brand for spotting this FAIL in 5.12.0! # The default PoCo::Client::TCP handler will throw a warning, which causes Test::NoWarnings to FAIL :( my ($syscall, $errno, $error) = @_[ ARG0..ARG2 ]; # TODO are there other "errors" that is harmless? $error = "Normal disconnection" unless $error; my $msg = "Got CLIENT $syscall error $errno: $error"; unless ( $syscall eq 'read' and $errno == 0 ) { fail( $msg ); } else { diag( $msg ) if $ENV{TEST_VERBOSE}; } }, ) for 1 .. 10; # the watchdog session POE::Session->create( inline_states => { _start => sub { $_[KERNEL]->delay( 'dog' => 300 ); $_[KERNEL]->yield( 'check' ); }, dog => sub { fail "WATCHDOG TRIGGERED"; done_testing; exit; }, check => sub { $_[KERNEL]->delay( 'check' => 1 ); $_[KERNEL]->alarm_remove_all if $replies == 10; }, }, ); $poe_kernel->run(); is( $replies, 10, "Make sure we got 10 replies back!" ); done_testing; POE-Component-SSLify-1.012/t/renegotiate_client_pings.t0000644000175000017500000001450612431461761021404 0ustar apocapoc#!/usr/bin/perl # # This file is part of POE-Component-SSLify # # This software is copyright (c) 2014 by Apocalypse. # # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # use strict; use warnings; use strict; use warnings; # Thanks to ASCENT for this test! # This test adds renegotiation to the connection from client-side # Since this is not supported on all platforms, it's marked TODO and adds custom logic # to make sure it doesn't FAIL if it's not supported. use Test::FailWarnings; use Test::More 1.001002; # new enough for sanity in done_testing() use POE 1.267; use POE::Component::Client::TCP; use POE::Component::Server::TCP; use POE::Component::SSLify qw/Client_SSLify Server_SSLify SSLify_Options SSLify_GetCipher SSLify_ContextCreate SSLify_GetSocket SSLify_GetSSL/; use Net::SSLeay qw/ERROR_WANT_READ ERROR_WANT_WRITE/; # TODO rewrite this to use Test::POE::Server::TCP and stuff :) my $port; my $server_ping2; my $client_ping2; POE::Component::Server::TCP->new ( Alias => 'myserver', Address => '127.0.0.1', Port => 0, Started => sub { use Socket qw/sockaddr_in/; $port = (sockaddr_in($_[HEAP]->{listener}->getsockname))[0]; }, ClientConnected => sub { ok(1, 'SERVER: accepted'); }, ClientDisconnected => sub { ok(1, 'SERVER: client disconnected'); $_[KERNEL]->post(myserver => 'shutdown'); }, ClientPreConnect => sub { eval { SSLify_Options('mylib/example.key', 'mylib/example.crt', 'sslv3') }; eval { SSLify_Options('../mylib/example.key', '../mylib/example.crt', 'sslv3') } if ($@); ok(!$@, "SERVER: SSLify_Options $@"); my $socket = eval { Server_SSLify($_[ARG0]) }; ok(!$@, "SERVER: Server_SSLify $@"); ok(1, 'SERVER: SSLify_GetCipher: '. SSLify_GetCipher($socket)); # We pray that IO::Handle is sane... ok( SSLify_GetSocket( $socket )->blocking == 0, 'SERVER: SSLified socket is non-blocking?') if $^O ne 'MSWin32'; return ($socket); }, ClientInput => sub { my ($kernel, $heap, $request) = @_[KERNEL, HEAP, ARG0]; ## At this point, connection MUST be encrypted. my $cipher = SSLify_GetCipher($heap->{client}->get_output_handle); ok($cipher ne '(NONE)', "SERVER: SSLify_GetCipher: $cipher"); if ($request eq 'ping') { ok(1, "SERVER: recv: $request"); $heap->{client}->put("pong"); } elsif ($request eq 'ping2') { ok(1, "SERVER: recv: $request"); $server_ping2++; $heap->{client}->put("pong2"); } }, ClientError => sub { # Thanks to H. Merijn Brand for spotting this FAIL in 5.12.0! # The default PoCo::Server::TCP handler will throw a warning, which causes Test::NoWarnings to FAIL :( my ($syscall, $errno, $error) = @_[ ARG0..ARG2 ]; # TODO are there other "errors" that is harmless? $error = "Normal disconnection" unless $error; my $msg = "Got SERVER $syscall error $errno: $error"; unless ( $syscall eq 'read' and $errno == 0 ) { fail( $msg ); } else { diag( $msg ) if $ENV{TEST_VERBOSE}; } }, ); POE::Component::Client::TCP->new ( Alias => 'myclient', RemoteAddress => '127.0.0.1', RemotePort => $port, Connected => sub { ok(1, 'CLIENT: connected'); $_[HEAP]->{server}->put("ping"); }, PreConnect => sub { my $ctx = eval { SSLify_ContextCreate(undef, undef, 'sslv3') }; ok(!$@, "CLIENT: SSLify_ContextCreate $@"); my $socket = eval { Client_SSLify($_[ARG0], undef, undef, $ctx) }; ok(!$@, "CLIENT: Client_SSLify $@"); ok(1, 'CLIENT: SSLify_GetCipher: '. SSLify_GetCipher($socket)); # We pray that IO::Handle is sane... ok( SSLify_GetSocket( $socket )->blocking == 0, 'CLIENT: SSLified socket is non-blocking?') if $^O ne 'MSWin32'; return ($socket); }, ServerInput => sub { my ($kernel, $heap, $line) = @_[KERNEL, HEAP, ARG0]; ## At this point, connection MUST be encrypted. my $cipher = SSLify_GetCipher($heap->{server}->get_output_handle); ok($cipher ne '(NONE)', "CLIENT: SSLify_GetCipher: $cipher"); if ($line eq 'pong') { ok(1, "CLIENT: recv: $line"); # Skip 2 Net::SSLeay::renegotiate() tests on FreeBSD because of # http://security.freebsd.org/advisories/FreeBSD-SA-09:15.ssl.asc TODO: { local $TODO = "Net::SSLeay::renegotiate() does not work on all platforms"; ## Force SSL renegotiation my $ssl = SSLify_GetSSL( $heap->{server}->get_output_handle ); my $reneg_num = Net::SSLeay::num_renegotiations($ssl); ok(1 == Net::SSLeay::renegotiate($ssl), 'CLIENT: SSL renegotiation'); my $handshake = Net::SSLeay::do_handshake($ssl); my $err = Net::SSLeay::get_error($ssl, $handshake); ## 1 == Successful handshake, ERROR_WANT_(READ|WRITE) == non-blocking. ok($handshake == 1 || $err == ERROR_WANT_READ || $err == ERROR_WANT_WRITE, 'CLIENT: SSL handshake'); ok($reneg_num < Net::SSLeay::num_renegotiations($ssl), 'CLIENT: Increased number of negotiations'); } $heap->{server}->put('ping2'); } elsif ($line eq 'pong2') { ok(1, "CLIENT: recv: $line"); $client_ping2++; $kernel->yield('shutdown'); } }, ServerError => sub { # Thanks to H. Merijn Brand for spotting this FAIL in 5.12.0! # The default PoCo::Client::TCP handler will throw a warning, which causes Test::NoWarnings to FAIL :( my ($syscall, $errno, $error) = @_[ ARG0..ARG2 ]; # TODO are there other "errors" that is harmless? $error = "Normal disconnection" unless $error; my $msg = "Got CLIENT $syscall error $errno: $error"; unless ( $syscall eq 'read' and $errno == 0 ) { fail( $msg ); } else { diag( $msg ) if $ENV{TEST_VERBOSE}; } }, ); $poe_kernel->run(); # Add extra pass() to make the test harness happy if renegotiate did not work if ( ! $server_ping2 ) { local $TODO = "Net::SSLeay::renegotiate() does not work on all platforms"; fail( "SERVER: Failed SSL renegotiation" ); } if ( ! $client_ping2 ) { local $TODO = "Net::SSLeay::renegotiate() does not work on all platforms"; fail( "CLIENT: Failed SSL renegotiation" ); } if ( ! $server_ping2 or ! $client_ping2 ) { diag( "WARNING: Your platform/SSL library does not support renegotiation of the SSL socket." ); diag( "This test harness detected that trying to renegotiate resulted in a disconnected socket." ); diag( "POE::Component::SSLify will work on your system, but please do not attempt a SSL renegotiate." ); diag( "Please talk with the author to figure out if this issue can be worked around, thank you!" ); } done_testing; POE-Component-SSLify-1.012/t/99_mire_test.t0000644000175000017500000001615612431461761016657 0ustar apocapoc#!/usr/bin/perl # # This file is part of POE-Component-SSLify # # This software is copyright (c) 2014 by Apocalypse. # # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # use strict; use warnings; # Test contributed by mire@irc which used this to hit the WRITE_WANTS_READ case # mire created package Ub because he couldn't reproduce it with poco-cl-http :( # tweaked slightly to turn it into a real testcase ( not done yet ) BEGIN { # sub POE::Kernel::ASSERT_DEFAULT () { 1 } # sub POE::Kernel::TRACE_STATISTICS () { 0 } # makes POE hang, it's been removed in git but not in 1.299 heh # sub POE::Kernel::TRACE_DEFAULT () { 1 } # sub POE::Kernel::CATCH_EXCEPTIONS () { 0 } # make sure we die right away so it's easier to debug } use Test::More; BEGIN { plan skip_all => "AUTHOR TEST"; } use strict; use warnings; use POE; use Test::FailWarnings; our $DEBUG=0; package Ub; use strict; use warnings; use POE qw( Component::Client::TCP Filter::Stream ); use POE::Component::SSLify qw( Client_SSLify ); # non-core deps BEGIN { eval "use POE::Filter::HTTPChunk; use HTTP::Parser; use HTTP::Response;"; if ( $@ ) { use Test::More; plan skip_all => "Unable to load deps: $@"; } } sub new { my $this = shift; my %p = @_; my $class = ref($this) || $this; my $self = {}; bless $self, $class; $self->{'_p'} = \%p; return $self; } sub spawn { my $self = shift; my $session_id = POE::Session->create( inline_states => { _child => sub {}, _start => sub { my ($kernel, $heap) = @_[KERNEL, HEAP]; ($heap->{'self'}) = @_[ARG0..$#_]; print 'INFO: ' . __PACKAGE__ . "_start\n" if $main::DEBUG; $kernel->alias_set( 'ub' ); #$_[KERNEL]->refcount_increment($_[SESSION]->ID, 'ub'); }, _stop => sub { my ($kernel, $heap) = @_[KERNEL, HEAP]; print 'INFO: ' . __PACKAGE__ . "_stop\n" if $main::DEBUG; $heap = {}; }, on_shutdown => sub { print 'INFO: ' . __PACKAGE__ . "on_shutdown\n" if $main::DEBUG; }, _shutdown => sub { print 'INFO: ' . __PACKAGE__ . "_shutdown\n" if $main::DEBUG; }, r => sub { my ($kernel, $heap, $ev_res, $cont_ref, $host, $port, $do_ssl) = @_[KERNEL, HEAP, ARG0..$#_]; my $s_res = $_[SENDER]->ID; # TODO pravi alarm za ubijanje konekcije my $tcp_sid = POE::Component::Client::TCP->new( #SessionParams => [ options => { debug => 1, trace => 1 } ], # SessionParams => [ options => { debug => 1 } ], Args => [$s_res, $ev_res, $cont_ref, $do_ssl], Filter => "POE::Filter::Stream", RemoteAddress => $host, RemotePort => $port, ConnectTimeout => 30, Started => sub { my ($kernel, $heap) = @_[KERNEL, HEAP]; print "INFO: Started\n" if $main::DEBUG; (@$heap{qw|s_res ev_res cont_ref do_ssl|}) = @_[ARG0..$#_]; }, PreConnect => sub { my ($kernel, $heap) = @_[KERNEL, HEAP]; print "INFO: PreConnect\n" if $main::DEBUG; $heap->{'parser'} = HTTP::Parser->new(response => 1); return $_[ARG0] unless $heap->{'do_ssl'}; # Convert the socket into an SSL socket. my $socket = eval { Client_SSLify($_[ARG0]) }; # Disconnect if SSL failed. if ($@) { warn $@ if $main::DEBUG; return; } # Return the SSL-ified socket. return $socket; }, ConnectError => sub { my ($kernel, $heap) = @_[KERNEL, HEAP]; #print Dumper $heap; exit; my ($operation, $error_number, $error_string) = @_[ARG0..ARG2]; print "ERROR: ConnectError $operation error $error_number occurred: $error_string\n" if $main::DEBUG; my $dc = ''; $kernel->post($heap->{'s_res'}, $heap->{'ev_res'}, {'error' => 1, 'error_type' => 'connect_error', 'content' => \$dc}); $_[KERNEL]->yield('shutdown'); }, ServerError => sub { my ($kernel, $heap) = @_[KERNEL, HEAP]; my ($operation, $error_number, $error_string) = @_[ARG0..ARG2]; print "not informing master session, ERROR: ServerError $operation error $error_number occurred: $error_string\n" if $main::DEBUG; $kernel->yield('shutdown'); }, Connected => sub { my ($kernel, $heap) = @_[KERNEL, HEAP]; print "INFO: Connected\n" if $main::DEBUG; $heap->{server}->put(${$heap->{'cont_ref'}}); # start timeout thing # za pravu shutdown funkciju $heap->{'al_cest_id'} = $_[KERNEL]->alarm_set( shutdown => time + 60 ); }, ServerInput => sub { my ($kernel, $heap) = @_[KERNEL, HEAP]; print "INFO: ServerInput\n" if $main::DEBUG; my $input = $_[ARG0]; #print 'from server: ' . Dumper $input; eval { $heap->{'parser'}->add($input); }; # TODO error response $kernel->yield('shutdown') if $@; }, ServerFlushed => sub { print "INFO: ServerFlushed\n" if $main::DEBUG; }, Disconnected => sub { my ($kernel, $heap) = @_[KERNEL, HEAP]; print "INFO: disconnected ;)\n" if $main::DEBUG; my $dc = ''; $dc = $heap->{'parser'}->object->decoded_content if $heap->{'parser'}->object; $kernel->post($heap->{'s_res'}, $heap->{'ev_res'}, {'error' => 0, 'error_type' => '', 'content' => \$dc}); $_[KERNEL]->alarm_remove(delete $heap->{'al_cest_id'}) if (exists $heap->{'al_cest_id'} and $heap->{'al_cest_id'}); $_[KERNEL]->yield('shutdown'); }, ); print "tcp_sid: $tcp_sid\n" if $main::DEBUG; }, }, 'args' => [$self], )->ID; return $session_id; } 1; package main; my $ub = Ub->new()->spawn(); my $session_id_test = POE::Session->create( inline_states => { _start => sub { my ($kernel, $heap) = @_[KERNEL, HEAP]; ($heap->{'self'}) = @_[ARG0..$#_]; print 'INFO: ' . __PACKAGE__ . "_start\n" if $main::DEBUG; $kernel->yield('test'); }, _stop => sub { my ($kernel, $heap) = @_[KERNEL, HEAP]; print 'INFO: ' . __PACKAGE__ . "_stop\n" if $main::DEBUG; $heap = {}; }, on_shutdown => sub { print 'INFO: ' . __PACKAGE__ . "on_shutdown\n" if $main::DEBUG; }, _shutdown => sub { print 'INFO: ' . __PACKAGE__ . "_shutdown\n" if $main::DEBUG; }, test => sub { my ($kernel, $heap) = @_[KERNEL, HEAP]; my ($cont, $host, $port, $do_ssl); $kernel->refcount_increment($_[SESSION]->ID, 'test'); if (1) { $host = '0ne.us'; $port = 443; $do_ssl = 1; $cont = <<'EOF'; GET /get.php HTTP/1.1 Host: osadmin.com User-Agent: proba 123 Connection: close EOF } $kernel->post('ub', 'r', 'test_res', \$cont, $host, $port, $do_ssl); }, test_res => sub { my ($kernel, $heap, $dat) = @_[KERNEL, HEAP, ARG0..$#_]; $kernel->refcount_decrement($_[SESSION]->ID, 'test'); my $cont = ${$dat->{'content'}}; chomp $cont; warn $cont; die "HIT BUG" if length $cont == 0; $kernel->yield('test'); return; }, },)->ID; POE::Kernel->run(); done_testing; POE-Component-SSLify-1.012/t/connfail_client.t0000644000175000017500000000565612431461761017475 0ustar apocapoc#!/usr/bin/perl # # This file is part of POE-Component-SSLify # # This software is copyright (c) 2014 by Apocalypse. # # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # use strict; use warnings; use strict; use warnings; # this tests the connection fail hook on the client-side use Test::FailWarnings; use Test::More 1.001002; # new enough for sanity in done_testing() use POE 1.267; use POE::Component::Client::TCP; use POE::Component::Server::TCP; use POE::Component::SSLify qw/Client_SSLify SSLify_GetSocket SSLify_GetStatus/; # TODO rewrite this to use Test::POE::Server::TCP and stuff :) my $port; POE::Component::Server::TCP->new ( Alias => 'myserver', Address => '127.0.0.1', Port => 0, Started => sub { use Socket qw/sockaddr_in/; $port = (sockaddr_in($_[HEAP]->{listener}->getsockname))[0]; }, ClientConnected => sub { ok(1, 'SERVER: accepted'); # purposefully send garbage so we screw up the ssl connect on the client-side $_[HEAP]->{client}->put( 'garbage in, garbage out' ); }, ClientDisconnected => sub { ok(1, 'SERVER: client disconnected'); $_[KERNEL]->post( 'myserver' => 'shutdown'); }, ClientInput => sub { my ($kernel, $heap, $line) = @_[KERNEL, HEAP, ARG0]; # purposefully send garbage so we screw up the ssl connect on the client-side $heap->{client}->put( 'garbage in, garbage out' ); }, ClientError => sub { # Thanks to H. Merijn Brand for spotting this FAIL in 5.12.0! # The default PoCo::Server::TCP handler will throw a warning, which causes Test::NoWarnings to FAIL :( my ($syscall, $errno, $error) = @_[ ARG0..ARG2 ]; $error = "Normal disconnection" unless $error; diag( "Got SERVER $syscall error $errno: $error" ) if $ENV{TEST_VERBOSE}; }, ); POE::Component::Client::TCP->new ( Alias => 'myclient', RemoteAddress => '127.0.0.1', RemotePort => $port, Connected => sub { ok(1, 'CLIENT: connected'); }, PreConnect => sub { my $socket = eval { Client_SSLify($_[ARG0], sub { my( $socket, $status, $errval ) = @_; pass( "CLIENT: Got callback hook" ); is( $status, 0, "CLIENT: Status received from callback is ERR - $errval" ); $poe_kernel->post( 'myclient' => 'shutdown' ); }) }; ok(!$@, "CLIENT: Client_SSLify $@"); is( SSLify_GetStatus( $socket ), -1, "CLIENT: SSLify_GetStatus is pending" ); return ($socket); }, ServerInput => sub { my ($kernel, $heap, $line) = @_[KERNEL, HEAP, ARG0]; die "Should have never got any input from the server!"; }, ServerError => sub { # Thanks to H. Merijn Brand for spotting this FAIL in 5.12.0! # The default PoCo::Client::TCP handler will throw a warning, which causes Test::NoWarnings to FAIL :( my ($syscall, $errno, $error) = @_[ ARG0..ARG2 ]; $error = "Normal disconnection" unless $error; diag( "Got CLIENT $syscall error $errno: $error" ) if $ENV{TEST_VERBOSE}; }, ); $poe_kernel->run(); done_testing; POE-Component-SSLify-1.012/t/simple_parallel_large.t0000644000175000017500000001130112431461761020645 0ustar apocapoc#!/usr/bin/perl # # This file is part of POE-Component-SSLify # # This software is copyright (c) 2014 by Apocalypse. # # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # use strict; use warnings; use strict; use warnings; # This is an extension of the simple_parallel.t test to test for large responses use Test::FailWarnings; use Test::More 1.001002; # new enough for sanity in done_testing() use POE 1.267; use POE::Component::Client::TCP; use POE::Component::Server::TCP; use POE::Component::SSLify qw/Client_SSLify Server_SSLify SSLify_Options SSLify_GetCipher SSLify_ContextCreate SSLify_GetSocket SSLify_GetSSL/; # TODO rewrite this to use Test::POE::Server::TCP and stuff :) my $port; my $replies = 0; my $bigpacket = join( '-', ('a' .. 'z') x 10000, ('A' .. 'Z') x 10000 ) x 2; POE::Component::Server::TCP->new ( Alias => 'myserver', Address => '127.0.0.1', Port => 0, ClientFilter => ['POE::Filter::Block', 'BlockSize' => length $bigpacket], Started => sub { use Socket qw/sockaddr_in/; $port = (sockaddr_in($_[HEAP]->{listener}->getsockname))[0]; }, ClientConnected => sub { ok(1, 'SERVER: accepted'); }, ClientDisconnected => sub { ok(1, 'SERVER: client disconnected'); $_[KERNEL]->post(myserver => 'shutdown') if $replies == 10; }, ClientPreConnect => sub { eval { SSLify_Options('mylib/example.key', 'mylib/example.crt', 'sslv3') }; eval { SSLify_Options('../mylib/example.key', '../mylib/example.crt', 'sslv3') } if ($@); ok(!$@, "SERVER: SSLify_Options $@"); my $socket = eval { Server_SSLify($_[ARG0]) }; ok(!$@, "SERVER: Server_SSLify $@"); ok(1, 'SERVER: SSLify_GetCipher: '. SSLify_GetCipher($socket)); # We pray that IO::Handle is sane... ok( SSLify_GetSocket( $socket )->blocking == 0, 'SERVER: SSLified socket is non-blocking?') if $^O ne 'MSWin32'; return ($socket); }, ClientInput => sub { my ($kernel, $heap, $line) = @_[KERNEL, HEAP, ARG0]; if ( $line eq $bigpacket ) { ## At this point, connection MUST be encrypted. my $cipher = SSLify_GetCipher($heap->{client}->get_output_handle); ok($cipher ne '(NONE)', "SERVER: SSLify_GetCipher: $cipher"); $heap->{client}->put($bigpacket); } else { die "Unknown line from CLIENT: $line"; } }, ClientError => sub { # Thanks to H. Merijn Brand for spotting this FAIL in 5.12.0! # The default PoCo::Server::TCP handler will throw a warning, which causes Test::NoWarnings to FAIL :( my ($syscall, $errno, $error) = @_[ ARG0..ARG2 ]; # TODO are there other "errors" that is harmless? $error = "Normal disconnection" unless $error; my $msg = "Got SERVER $syscall error $errno: $error"; unless ( $syscall eq 'read' and $errno == 0 ) { fail( $msg ); } else { diag( $msg ) if $ENV{TEST_VERBOSE}; } }, ); POE::Component::Client::TCP->new ( Alias => 'myclient', RemoteAddress => '127.0.0.1', RemotePort => $port, Filter => ['POE::Filter::Block', 'BlockSize' => length $bigpacket], Connected => sub { ok(1, 'CLIENT: connected'); $_[HEAP]->{server}->put($bigpacket); }, PreConnect => sub { my $ctx = eval { SSLify_ContextCreate(undef, undef, 'sslv3') }; ok(!$@, "CLIENT: SSLify_ContextCreate $@"); my $socket = eval { Client_SSLify($_[ARG0], undef, undef, $ctx) }; ok(!$@, "CLIENT: Client_SSLify $@"); ok(1, 'CLIENT: SSLify_GetCipher: '. SSLify_GetCipher($socket)); # We pray that IO::Handle is sane... ok( SSLify_GetSocket( $socket )->blocking == 0, 'CLIENT: SSLified socket is non-blocking?') if $^O ne 'MSWin32'; return ($socket); }, ServerInput => sub { my ($kernel, $heap, $line) = @_[KERNEL, HEAP, ARG0]; if ($line eq $bigpacket) { ## At this point, connection MUST be encrypted. my $cipher = SSLify_GetCipher($heap->{server}->get_output_handle); ok($cipher ne '(NONE)', "CLIENT: SSLify_GetCipher: $cipher"); diag( Net::SSLeay::dump_peer_certificate( SSLify_GetSSL( $heap->{server}->get_output_handle ) ) ) if $ENV{TEST_VERBOSE}; $replies++; $kernel->yield('shutdown'); } else { die "Unknown line from SERVER: $line"; } }, ServerError => sub { # Thanks to H. Merijn Brand for spotting this FAIL in 5.12.0! # The default PoCo::Client::TCP handler will throw a warning, which causes Test::NoWarnings to FAIL :( my ($syscall, $errno, $error) = @_[ ARG0..ARG2 ]; # TODO are there other "errors" that is harmless? $error = "Normal disconnection" unless $error; my $msg = "Got CLIENT $syscall error $errno: $error"; unless ( $syscall eq 'read' and $errno == 0 ) { fail( $msg ); } else { diag( $msg ) if $ENV{TEST_VERBOSE}; } }, ) for 1 .. 10; $poe_kernel->run(); is( $replies, 10, "Make sure we got 10 replies back!" ); done_testing; POE-Component-SSLify-1.012/t/connfail_server.t0000644000175000017500000000612612431461761017516 0ustar apocapoc#!/usr/bin/perl # # This file is part of POE-Component-SSLify # # This software is copyright (c) 2014 by Apocalypse. # # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # use strict; use warnings; use strict; use warnings; # this tests the connection fail hook on the server-side use Test::FailWarnings; use Test::More 1.001002; # new enough for sanity in done_testing() use POE 1.267; use POE::Component::Client::TCP; use POE::Component::Server::TCP; use POE::Component::SSLify qw/Server_SSLify SSLify_Options SSLify_GetSocket SSLify_GetStatus/; # TODO rewrite this to use Test::POE::Server::TCP and stuff :) my $port; POE::Component::Server::TCP->new ( Alias => 'myserver', Address => '127.0.0.1', Port => 0, Started => sub { use Socket qw/sockaddr_in/; $port = (sockaddr_in($_[HEAP]->{listener}->getsockname))[0]; }, ClientConnected => sub { ok(1, 'SERVER: accepted'); }, ClientPreConnect => sub { eval { SSLify_Options('mylib/example.key', 'mylib/example.crt') }; eval { SSLify_Options('../mylib/example.key', '../mylib/example.crt') } if ($@); ok(!$@, "SERVER: SSLify_Options $@"); my $socket = eval { Server_SSLify( $_[ARG0], sub { my( $socket, $status, $errval ) = @_; pass( "SERVER: Got callback hook" ); is( $status, 0, "SERVER: Status received from callback is ERR - $errval" ); $poe_kernel->post( 'myserver' => 'shutdown'); } ) }; ok(!$@, "SERVER: Server_SSLify $@"); is( SSLify_GetStatus( $socket ), -1, "SERVER: SSLify_GetStatus is pending" ); return ($socket); }, ClientDisconnected => sub { ok(1, 'SERVER: client disconnected'); }, ClientInput => sub { my ($kernel, $heap, $line) = @_[KERNEL, HEAP, ARG0]; die "Should have never got any input from the client!"; }, ClientError => sub { # Thanks to H. Merijn Brand for spotting this FAIL in 5.12.0! # The default PoCo::Server::TCP handler will throw a warning, which causes Test::NoWarnings to FAIL :( my ($syscall, $errno, $error) = @_[ ARG0..ARG2 ]; $error = "Normal disconnection" unless $error; diag( "Got SERVER $syscall error $errno: $error" ) if $ENV{TEST_VERBOSE}; }, ); POE::Component::Client::TCP->new ( Alias => 'myclient', RemoteAddress => '127.0.0.1', RemotePort => $port, Connected => sub { ok(1, 'CLIENT: connected'); # purposefully send garbage so we screw up the ssl connect on the client-side $_[HEAP]->{server}->put( 'garbage in, garbage out' ); }, ServerInput => sub { my ($kernel, $heap, $line) = @_[KERNEL, HEAP, ARG0]; # purposefully send garbage so we screw up the ssl connect on the client-side $heap->{server}->put( 'garbage in, garbage out' ); }, ServerError => sub { # Thanks to H. Merijn Brand for spotting this FAIL in 5.12.0! # The default PoCo::Client::TCP handler will throw a warning, which causes Test::NoWarnings to FAIL :( my ($syscall, $errno, $error) = @_[ ARG0..ARG2 ]; $error = "Normal disconnection" unless $error; diag( "Got CLIENT $syscall error $errno: $error" ) if $ENV{TEST_VERBOSE}; }, ); $poe_kernel->run(); done_testing; POE-Component-SSLify-1.012/t/simple_large.t0000644000175000017500000001135012431461761016775 0ustar apocapoc#!/usr/bin/perl # # This file is part of POE-Component-SSLify # # This software is copyright (c) 2014 by Apocalypse. # # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # use strict; use warnings; use strict; use warnings; # This is an extension of the simple.t test to test for large responses use Test::FailWarnings; use Test::More 1.001002; # new enough for sanity in done_testing() use POE 1.267; use POE::Component::Client::TCP; use POE::Component::Server::TCP; use POE::Component::SSLify qw/Client_SSLify Server_SSLify SSLify_Options SSLify_GetCipher SSLify_ContextCreate SSLify_GetSocket SSLify_GetSSL/; # TODO rewrite this to use Test::POE::Server::TCP and stuff :) my $port; # length $bigpacket = 2079998 ( just need to go over 42643B as reported in RT#58243 but... =) my $bigpacket = join( '-', ('a' .. 'z') x 10000, ('A' .. 'Z') x 10000 ) x 2; POE::Component::Server::TCP->new ( Alias => 'myserver', Address => '127.0.0.1', Port => 0, ClientFilter => ['POE::Filter::Block', 'BlockSize' => length $bigpacket], Started => sub { use Socket qw/sockaddr_in/; $port = (sockaddr_in($_[HEAP]->{listener}->getsockname))[0]; }, ClientConnected => sub { ok(1, 'SERVER: accepted'); }, ClientDisconnected => sub { ok(1, 'SERVER: client disconnected'); $_[KERNEL]->post(myserver => 'shutdown'); }, ClientPreConnect => sub { eval { SSLify_Options('mylib/example.key', 'mylib/example.crt', 'sslv3') }; eval { SSLify_Options('../mylib/example.key', '../mylib/example.crt', 'sslv3') } if ($@); ok(!$@, "SERVER: SSLify_Options $@"); my $socket = eval { Server_SSLify($_[ARG0]) }; ok(!$@, "SERVER: Server_SSLify $@"); ok(1, 'SERVER: SSLify_GetCipher: '. SSLify_GetCipher($socket)); # We pray that IO::Handle is sane... ok( SSLify_GetSocket( $socket )->blocking == 0, 'SERVER: SSLified socket is non-blocking?') if $^O ne 'MSWin32'; return ($socket); }, ClientInput => sub { my ($kernel, $heap, $line) = @_[KERNEL, HEAP, ARG0]; if ( $line eq $bigpacket ) { ok(1, "SERVER: recv BIGPACKET"); ## At this point, connection MUST be encrypted. my $cipher = SSLify_GetCipher($heap->{client}->get_output_handle); ok($cipher ne '(NONE)', "SERVER: SSLify_GetCipher: $cipher"); $heap->{client}->put($bigpacket); } else { die "Unknown line from CLIENT: $line"; } }, ClientError => sub { # Thanks to H. Merijn Brand for spotting this FAIL in 5.12.0! # The default PoCo::Server::TCP handler will throw a warning, which causes Test::NoWarnings to FAIL :( my ($syscall, $errno, $error) = @_[ ARG0..ARG2 ]; # TODO are there other "errors" that is harmless? $error = "Normal disconnection" unless $error; my $msg = "Got SERVER $syscall error $errno: $error"; unless ( $syscall eq 'read' and $errno == 0 ) { fail( $msg ); } else { diag( $msg ) if $ENV{TEST_VERBOSE}; } }, ); POE::Component::Client::TCP->new ( Alias => 'myclient', RemoteAddress => '127.0.0.1', RemotePort => $port, Filter => ['POE::Filter::Block', 'BlockSize' => length $bigpacket], Connected => sub { ok(1, 'CLIENT: connected'); $_[HEAP]->{server}->put($bigpacket); }, PreConnect => sub { my $ctx = eval { SSLify_ContextCreate(undef, undef, 'sslv3') }; ok(!$@, "CLIENT: SSLify_ContextCreate $@"); my $socket = eval { Client_SSLify($_[ARG0], undef, undef, $ctx) }; ok(!$@, "CLIENT: Client_SSLify $@"); ok(1, 'CLIENT: SSLify_GetCipher: '. SSLify_GetCipher($socket)); # We pray that IO::Handle is sane... ok( SSLify_GetSocket( $socket )->blocking == 0, 'CLIENT: SSLified socket is non-blocking?') if $^O ne 'MSWin32'; return ($socket); }, ServerInput => sub { my ($kernel, $heap, $line) = @_[KERNEL, HEAP, ARG0]; if ($line eq $bigpacket) { ok(1, "CLIENT: recv BIGPACKET"); ## At this point, connection MUST be encrypted. my $cipher = SSLify_GetCipher($heap->{server}->get_output_handle); ok($cipher ne '(NONE)', "CLIENT: SSLify_GetCipher: $cipher"); diag( Net::SSLeay::dump_peer_certificate( SSLify_GetSSL( $heap->{server}->get_output_handle ) ) ) if $ENV{TEST_VERBOSE}; $kernel->yield('shutdown'); } else { die "Unknown line from SERVER: $line"; } }, ServerError => sub { # Thanks to H. Merijn Brand for spotting this FAIL in 5.12.0! # The default PoCo::Client::TCP handler will throw a warning, which causes Test::NoWarnings to FAIL :( my ($syscall, $errno, $error) = @_[ ARG0..ARG2 ]; # TODO are there other "errors" that is harmless? $error = "Normal disconnection" unless $error; my $msg = "Got CLIENT $syscall error $errno: $error"; unless ( $syscall eq 'read' and $errno == 0 ) { fail( $msg ); } else { diag( $msg ) if $ENV{TEST_VERBOSE}; } }, ); $poe_kernel->run(); done_testing; POE-Component-SSLify-1.012/t/renegotiate_client.t0000644000175000017500000001175112431461761020203 0ustar apocapoc#!/usr/bin/perl # # This file is part of POE-Component-SSLify # # This software is copyright (c) 2014 by Apocalypse. # # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # use strict; use warnings; use strict; use warnings; # Thanks to ASCENT for this test! # This test adds renegotiation to the connection from client-side use Test::FailWarnings; use Test::More 1.001002; # new enough for sanity in done_testing() use POE 1.267; use POE::Component::Client::TCP; use POE::Component::Server::TCP; use POE::Component::SSLify qw/Client_SSLify Server_SSLify SSLify_Options SSLify_GetCipher SSLify_ContextCreate SSLify_GetSocket SSLify_GetSSL/; use Net::SSLeay qw/ERROR_WANT_READ ERROR_WANT_WRITE/; # TODO rewrite this to use Test::POE::Server::TCP and stuff :) my $port; my $server_ping2; my $client_ping2; POE::Component::Server::TCP->new ( Alias => 'myserver', Address => '127.0.0.1', Port => 0, Started => sub { use Socket qw/sockaddr_in/; $port = (sockaddr_in($_[HEAP]->{listener}->getsockname))[0]; }, ClientConnected => sub { ok(1, 'SERVER: accepted'); }, ClientDisconnected => sub { ok(1, 'SERVER: client disconnected'); $_[KERNEL]->post(myserver => 'shutdown'); }, ClientPreConnect => sub { eval { SSLify_Options('mylib/example.key', 'mylib/example.crt', 'sslv3') }; eval { SSLify_Options('../mylib/example.key', '../mylib/example.crt', 'sslv3') } if ($@); ok(!$@, "SERVER: SSLify_Options $@"); my $socket = eval { Server_SSLify($_[ARG0]) }; ok(!$@, "SERVER: Server_SSLify $@"); ok(1, 'SERVER: SSLify_GetCipher: '. SSLify_GetCipher($socket)); # We pray that IO::Handle is sane... ok( SSLify_GetSocket( $socket )->blocking == 0, 'SERVER: SSLified socket is non-blocking?') if $^O ne 'MSWin32'; return ($socket); }, ClientInput => sub { my ($kernel, $heap, $line) = @_[KERNEL, HEAP, ARG0]; if ($line eq 'ping') { ok(1, "SERVER: recv: $line"); ## At this point, connection MUST be encrypted. my $cipher = SSLify_GetCipher($heap->{client}->get_output_handle); ok($cipher ne '(NONE)', "SERVER: SSLify_GetCipher: $cipher"); $heap->{client}->put("pong"); } elsif ($line eq 'ping2') { $server_ping2++; $heap->{client}->put("pong2"); } else { die "Unknown line from CLIENT: $line"; } }, ClientError => sub { # Thanks to H. Merijn Brand for spotting this FAIL in 5.12.0! # The default PoCo::Server::TCP handler will throw a warning, which causes Test::NoWarnings to FAIL :( my ($syscall, $errno, $error) = @_[ ARG0..ARG2 ]; # TODO are there other "errors" that is harmless? $error = "Normal disconnection" unless $error; my $msg = "Got SERVER $syscall error $errno: $error"; unless ( $syscall eq 'read' and $errno == 0 ) { # fail( $msg ); } else { diag( $msg ) if $ENV{TEST_VERBOSE}; } }, ); POE::Component::Client::TCP->new ( Alias => 'myclient', RemoteAddress => '127.0.0.1', RemotePort => $port, Connected => sub { ok(1, 'CLIENT: connected'); $_[HEAP]->{server}->put("ping"); }, PreConnect => sub { my $ctx = eval { SSLify_ContextCreate(undef, undef, 'sslv3') }; ok(!$@, "CLIENT: SSLify_ContextCreate $@"); my $socket = eval { Client_SSLify($_[ARG0], undef, undef, $ctx) }; ok(!$@, "CLIENT: Client_SSLify $@"); ok(1, 'CLIENT: SSLify_GetCipher: '. SSLify_GetCipher($socket)); # We pray that IO::Handle is sane... ok( SSLify_GetSocket( $socket )->blocking == 0, 'CLIENT: SSLified socket is non-blocking?') if $^O ne 'MSWin32'; return ($socket); }, ServerInput => sub { my ($kernel, $heap, $line) = @_[KERNEL, HEAP, ARG0]; if ($line eq 'pong') { ok(1, "CLIENT: recv: $line"); ## At this point, connection MUST be encrypted. my $cipher = SSLify_GetCipher($heap->{server}->get_output_handle); ok($cipher ne '(NONE)', "CLIENT: SSLify_GetCipher: $cipher"); # do the actual renegotiate Net::SSLeay::renegotiate( SSLify_GetSSL( $heap->{server}->get_output_handle ) ); $heap->{server}->put('ping2'); } elsif ($line eq 'pong2') { $client_ping2++; $kernel->yield('shutdown'); } else { die "Unknown line from SERVER: $line"; } }, ServerError => sub { # Thanks to H. Merijn Brand for spotting this FAIL in 5.12.0! # The default PoCo::Client::TCP handler will throw a warning, which causes Test::NoWarnings to FAIL :( my ($syscall, $errno, $error) = @_[ ARG0..ARG2 ]; $error = "Normal disconnection" unless $error; my $msg = "Got CLIENT $syscall error $errno: $error"; diag( $msg ) if $ENV{TEST_VERBOSE}; }, ); $poe_kernel->run(); if ( ! $server_ping2 or ! $client_ping2 ) { diag( "WARNING: Your platform/SSL library does not support renegotiation of the SSL socket." ); diag( "This test harness detected that trying to renegotiate resulted in a disconnected socket." ); diag( "POE::Component::SSLify will work on your system, but please do not attempt a SSL renegotiate." ); diag( "Please talk with the author to figure out if this issue can be worked around, thank you!" ); } done_testing; POE-Component-SSLify-1.012/t/renegotiate_server.t0000644000175000017500000001163512431461761020234 0ustar apocapoc#!/usr/bin/perl # # This file is part of POE-Component-SSLify # # This software is copyright (c) 2014 by Apocalypse. # # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # use strict; use warnings; use strict; use warnings; # Thanks to ASCENT for this test! # This test adds renegotiation to the connection from server-side use Test::FailWarnings; use Test::More 1.001002; # new enough for sanity in done_testing() use POE 1.267; use POE::Component::Client::TCP; use POE::Component::Server::TCP; use POE::Component::SSLify qw/Client_SSLify Server_SSLify SSLify_Options SSLify_GetCipher SSLify_ContextCreate SSLify_GetSocket SSLify_GetSSL/; # TODO rewrite this to use Test::POE::Server::TCP and stuff :) my $port; my $server_ping2; my $client_ping2; POE::Component::Server::TCP->new ( Alias => 'myserver', Address => '127.0.0.1', Port => 0, Started => sub { use Socket qw/sockaddr_in/; $port = (sockaddr_in($_[HEAP]->{listener}->getsockname))[0]; }, ClientConnected => sub { ok(1, 'SERVER: accepted'); $_[HEAP]->{client}->put("ping"); }, ClientDisconnected => sub { ok(1, 'SERVER: client disconnected'); $_[KERNEL]->post(myserver => 'shutdown'); }, ClientPreConnect => sub { eval { SSLify_Options('mylib/example.key', 'mylib/example.crt', 'sslv3') }; eval { SSLify_Options('../mylib/example.key', '../mylib/example.crt', 'sslv3') } if ($@); ok(!$@, "SERVER: SSLify_Options $@"); my $socket = eval { Server_SSLify($_[ARG0]) }; ok(!$@, "SERVER: Server_SSLify $@"); ok(1, 'SERVER: SSLify_GetCipher: '. SSLify_GetCipher($socket)); # We pray that IO::Handle is sane... ok( SSLify_GetSocket( $socket )->blocking == 0, 'SERVER: SSLified socket is non-blocking?') if $^O ne 'MSWin32'; return ($socket); }, ClientInput => sub { my ($kernel, $heap, $line) = @_[KERNEL, HEAP, ARG0]; if ($line eq 'pong') { ok(1, "SERVER: recv: $line"); ## At this point, connection MUST be encrypted. my $cipher = SSLify_GetCipher($heap->{client}->get_output_handle); ok($cipher ne '(NONE)', "SERVER: SSLify_GetCipher: $cipher"); Net::SSLeay::renegotiate( SSLify_GetSSL( $heap->{client}->get_output_handle ) ); $heap->{client}->put("ping2"); } elsif ($line eq 'pong2') { $server_ping2++; $kernel->yield( 'shutdown' ); } else { die "Unknown line from CLIENT: $line"; } }, ClientError => sub { # Thanks to H. Merijn Brand for spotting this FAIL in 5.12.0! # The default PoCo::Server::TCP handler will throw a warning, which causes Test::NoWarnings to FAIL :( my ($syscall, $errno, $error) = @_[ ARG0..ARG2 ]; # TODO are there other "errors" that is harmless? $error = "Normal disconnection" unless $error; my $msg = "Got SERVER $syscall error $errno: $error"; unless ( $syscall eq 'read' and $errno == 0 ) { # fail( $msg ); } else { diag( $msg ) if $ENV{TEST_VERBOSE}; } }, ); POE::Component::Client::TCP->new ( Alias => 'myclient', RemoteAddress => '127.0.0.1', RemotePort => $port, Connected => sub { ok(1, 'CLIENT: connected'); }, PreConnect => sub { my $ctx = eval { SSLify_ContextCreate(undef, undef, 'sslv3') }; ok(!$@, "CLIENT: SSLify_ContextCreate $@"); my $socket = eval { Client_SSLify($_[ARG0], undef, undef, $ctx) }; ok(!$@, "CLIENT: Client_SSLify $@"); ok(1, 'CLIENT: SSLify_GetCipher: '. SSLify_GetCipher($socket)); # We pray that IO::Handle is sane... ok( SSLify_GetSocket( $socket )->blocking == 0, 'CLIENT: SSLified socket is non-blocking?') if $^O ne 'MSWin32'; return ($socket); }, ServerInput => sub { my ($kernel, $heap, $line) = @_[KERNEL, HEAP, ARG0]; if ($line eq 'ping') { ok(1, "CLIENT: recv: $line"); ## At this point, connection MUST be encrypted. my $cipher = SSLify_GetCipher($heap->{server}->get_output_handle); ok($cipher ne '(NONE)', "CLIENT: SSLify_GetCipher: $cipher"); $_[HEAP]->{server}->put("pong"); } elsif ( $line eq 'ping2' ) { $client_ping2++; $_[HEAP]->{server}->put("pong2"); } else { die "Unknown line from SERVER: $line"; } }, ServerError => sub { # Thanks to H. Merijn Brand for spotting this FAIL in 5.12.0! # The default PoCo::Client::TCP handler will throw a warning, which causes Test::NoWarnings to FAIL :( my ($syscall, $errno, $error) = @_[ ARG0..ARG2 ]; $error = "Normal disconnection" unless $error; my $msg = "Got CLIENT $syscall error $errno: $error"; diag( $msg ) if $ENV{TEST_VERBOSE}; }, ); $poe_kernel->run(); if ( ! $server_ping2 or ! $client_ping2 ) { diag( "WARNING: Your platform/SSL library does not support renegotiation of the SSL socket." ); diag( "This test harness detected that trying to renegotiate resulted in a disconnected socket." ); diag( "POE::Component::SSLify will work on your system, but please do not attempt a SSL renegotiate." ); diag( "Please talk with the author to figure out if this issue can be worked around, thank you!" ); } done_testing; POE-Component-SSLify-1.012/t/00-compile.t0000644000175000017500000000237512431461761016206 0ustar apocapocuse 5.006; use strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::Compile 2.051 use Test::More; plan tests => 3 + ($ENV{AUTHOR_TESTING} ? 1 : 0); my @module_files = ( 'POE/Component/SSLify.pm', 'POE/Component/SSLify/ClientHandle.pm', 'POE/Component/SSLify/ServerHandle.pm' ); # fake home for cpan-testers use File::Temp; local $ENV{HOME} = File::Temp::tempdir( CLEANUP => 1 ); my $inc_switch = -d 'blib' ? '-Mblib' : '-Ilib'; use File::Spec; use IPC::Open3; use IO::Handle; open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!"; my @warnings; for my $lib (@module_files) { # see L my $stderr = IO::Handle->new; my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, '-e', "require q[$lib]"); binmode $stderr, ':crlf' if $^O eq 'MSWin32'; my @_warnings = <$stderr>; waitpid($pid, 0); is($?, 0, "$lib loaded ok"); if (@_warnings) { warn @_warnings; push @warnings, @_warnings; } } is(scalar(@warnings), 0, 'no warnings found') or diag 'got warnings: ', ( Test::More->can('explain') ? Test::More::explain(\@warnings) : join("\n", '', @warnings) ) if $ENV{AUTHOR_TESTING}; POE-Component-SSLify-1.012/t/connect_hook.t0000644000175000017500000001037512431461761017011 0ustar apocapoc#!/usr/bin/perl # # This file is part of POE-Component-SSLify # # This software is copyright (c) 2014 by Apocalypse. # # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # use strict; use warnings; use strict; use warnings; # This tests the connection OK hook on both server/client use Test::FailWarnings; use Test::More 1.001002; # new enough for sanity in done_testing() use POE 1.267; use POE::Component::Client::TCP; use POE::Component::Server::TCP; use POE::Component::SSLify qw/Client_SSLify Server_SSLify SSLify_Options SSLify_GetCipher SSLify_GetSocket SSLify_GetStatus/; # TODO rewrite this to use Test::POE::Server::TCP and stuff :) my $port; POE::Component::Server::TCP->new ( Alias => 'myserver', Address => '127.0.0.1', Port => 0, Started => sub { use Socket qw/sockaddr_in/; $port = (sockaddr_in($_[HEAP]->{listener}->getsockname))[0]; }, ClientConnected => sub { ok(1, 'SERVER: accepted'); }, ClientDisconnected => sub { ok(1, 'SERVER: client disconnected'); $_[KERNEL]->post( 'myserver' => 'shutdown'); }, ClientPreConnect => sub { eval { SSLify_Options('mylib/example.key', 'mylib/example.crt') }; eval { SSLify_Options('../mylib/example.key', '../mylib/example.crt') } if ($@); ok(!$@, "SERVER: SSLify_Options $@"); my $socket = eval { Server_SSLify( $_[ARG0], sub { my( $socket, $status, $errval ) = @_; pass( "SERVER: Got callback hook" ); is( $status, 1, "SERVER: Status received from callback is OK" ); ## At this point, connection MUST be encrypted. my $cipher = SSLify_GetCipher($socket); ok($cipher ne '(NONE)', "SERVER: SSLify_GetCipher: $cipher"); ok( SSLify_GetStatus($socket) == 1, "SERVER: SSLify_GetStatus is done" ); } ) }; ok(!$@, "SERVER: Server_SSLify $@"); ok( SSLify_GetStatus($socket) == -1, "SERVER: SSLify_GetStatus is pending" ); return ($socket); }, ClientInput => sub { my ($kernel, $heap, $line) = @_[KERNEL, HEAP, ARG0]; if ( $line ne 'ping' ) { die "Unknown line from CLIENT: $line"; } else { ok(1, "SERVER: recv: $line"); $_[HEAP]->{client}->put("pong"); } }, ClientError => sub { # Thanks to H. Merijn Brand for spotting this FAIL in 5.12.0! # The default PoCo::Server::TCP handler will throw a warning, which causes Test::NoWarnings to FAIL :( my ($syscall, $errno, $error) = @_[ ARG0..ARG2 ]; # TODO are there other "errors" that is harmless? $error = "Normal disconnection" unless $error; my $msg = "Got SERVER $syscall error $errno: $error"; unless ( $syscall eq 'read' and $errno == 0 ) { fail( $msg ); } else { diag( $msg ) if $ENV{TEST_VERBOSE}; } }, ); POE::Component::Client::TCP->new ( Alias => 'myclient', RemoteAddress => '127.0.0.1', RemotePort => $port, Connected => sub { ok(1, 'CLIENT: connected'); $_[HEAP]->{server}->put("ping"); }, PreConnect => sub { my $socket = eval { Client_SSLify($_[ARG0], sub { my( $socket, $status, $errval ) = @_; pass( "CLIENT: Got callback hook status" ); is( $status, 1, "CLIENT: Status received from callback is OK" ); ## At this point, connection MUST be encrypted. my $cipher = SSLify_GetCipher($socket); ok($cipher ne '(NONE)', "CLIENT: SSLify_GetCipher: $cipher"); ok( SSLify_GetStatus($socket) == 1, "CLIENT: SSLify_GetStatus is done" ); }) }; ok(!$@, "CLIENT: Client_SSLify $@"); ok( SSLify_GetStatus($socket) == -1, "CLIENT: SSLify_GetStatus is pending" ); return ($socket); }, ServerInput => sub { my ($kernel, $heap, $line) = @_[KERNEL, HEAP, ARG0]; if ( $line ne 'pong' ) { die "Unknown line from CLIENT: $line"; } else { ok(1, "CLIENT: recv: $line"); $kernel->yield('shutdown'); } }, ServerError => sub { # Thanks to H. Merijn Brand for spotting this FAIL in 5.12.0! # The default PoCo::Client::TCP handler will throw a warning, which causes Test::NoWarnings to FAIL :( my ($syscall, $errno, $error) = @_[ ARG0..ARG2 ]; # TODO are there other "errors" that is harmless? $error = "Normal disconnection" unless $error; my $msg = "Got CLIENT $syscall error $errno: $error"; unless ( $syscall eq 'read' and $errno == 0 ) { fail( $msg ); } else { diag( $msg ) if $ENV{TEST_VERBOSE}; } }, ); $poe_kernel->run(); done_testing; POE-Component-SSLify-1.012/t/simple_parallel.t0000644000175000017500000001101012431461761017470 0ustar apocapoc#!/usr/bin/perl # # This file is part of POE-Component-SSLify # # This software is copyright (c) 2014 by Apocalypse. # # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # use strict; use warnings; use strict; use warnings; # This is an extension of the simple.t to test requests in parallel use Test::FailWarnings; use Test::More 1.001002; # new enough for sanity in done_testing() use POE 1.267; use POE::Component::Client::TCP; use POE::Component::Server::TCP; use POE::Component::SSLify qw/Client_SSLify Server_SSLify SSLify_Options SSLify_GetCipher SSLify_ContextCreate SSLify_GetSocket SSLify_GetSSL/; # TODO rewrite this to use Test::POE::Server::TCP and stuff :) my $port; my $replies = 0; POE::Component::Server::TCP->new ( Alias => 'myserver', Address => '127.0.0.1', Port => 0, Started => sub { use Socket qw/sockaddr_in/; $port = (sockaddr_in($_[HEAP]->{listener}->getsockname))[0]; }, ClientConnected => sub { ok(1, 'SERVER: accepted'); }, ClientDisconnected => sub { ok(1, 'SERVER: client disconnected'); $_[KERNEL]->post(myserver => 'shutdown') if $replies == 10; }, ClientPreConnect => sub { eval { SSLify_Options('mylib/example.key', 'mylib/example.crt', 'sslv3') }; eval { SSLify_Options('../mylib/example.key', '../mylib/example.crt', 'sslv3') } if ($@); ok(!$@, "SERVER: SSLify_Options $@"); my $socket = eval { Server_SSLify($_[ARG0]) }; ok(!$@, "SERVER: Server_SSLify $@"); ok(1, 'SERVER: SSLify_GetCipher: '. SSLify_GetCipher($socket)); # We pray that IO::Handle is sane... ok( SSLify_GetSocket( $socket )->blocking == 0, 'SERVER: SSLified socket is non-blocking?') if $^O ne 'MSWin32'; return ($socket); }, ClientInput => sub { my ($kernel, $heap, $line) = @_[KERNEL, HEAP, ARG0]; if ( $line eq 'ping' ) { ok(1, "SERVER: recv: $line"); ## At this point, connection MUST be encrypted. my $cipher = SSLify_GetCipher($heap->{client}->get_output_handle); ok($cipher ne '(NONE)', "SERVER: SSLify_GetCipher: $cipher"); $heap->{client}->put('pong'); } else { die "Unknown line from CLIENT: $line"; } }, ClientError => sub { # Thanks to H. Merijn Brand for spotting this FAIL in 5.12.0! # The default PoCo::Server::TCP handler will throw a warning, which causes Test::NoWarnings to FAIL :( my ($syscall, $errno, $error) = @_[ ARG0..ARG2 ]; # TODO are there other "errors" that is harmless? $error = "Normal disconnection" unless $error; my $msg = "Got SERVER $syscall error $errno: $error"; unless ( $syscall eq 'read' and $errno == 0 ) { fail( $msg ); } else { diag( $msg ) if $ENV{TEST_VERBOSE}; } }, ); POE::Component::Client::TCP->new ( Alias => 'myclient', RemoteAddress => '127.0.0.1', RemotePort => $port, Connected => sub { ok(1, 'CLIENT: connected'); $_[HEAP]->{server}->put('ping'); }, PreConnect => sub { my $ctx = eval { SSLify_ContextCreate(undef, undef, 'sslv3') }; ok(!$@, "CLIENT: SSLify_ContextCreate $@"); my $socket = eval { Client_SSLify($_[ARG0], undef, undef, $ctx) }; ok(!$@, "CLIENT: Client_SSLify $@"); ok(1, 'CLIENT: SSLify_GetCipher: '. SSLify_GetCipher($socket)); # We pray that IO::Handle is sane... ok( SSLify_GetSocket( $socket )->blocking == 0, 'CLIENT: SSLified socket is non-blocking?') if $^O ne 'MSWin32'; return ($socket); }, ServerInput => sub { my ($kernel, $heap, $line) = @_[KERNEL, HEAP, ARG0]; if ($line eq 'pong') { ok(1, "CLIENT: recv: $line"); ## At this point, connection MUST be encrypted. my $cipher = SSLify_GetCipher($heap->{server}->get_output_handle); ok($cipher ne '(NONE)', "CLIENT: SSLify_GetCipher: $cipher"); diag( Net::SSLeay::dump_peer_certificate( SSLify_GetSSL( $heap->{server}->get_output_handle ) ) ) if $ENV{TEST_VERBOSE}; $replies++; $kernel->yield('shutdown'); } else { die "Unknown line from SERVER: $line"; } }, ServerError => sub { # Thanks to H. Merijn Brand for spotting this FAIL in 5.12.0! # The default PoCo::Client::TCP handler will throw a warning, which causes Test::NoWarnings to FAIL :( my ($syscall, $errno, $error) = @_[ ARG0..ARG2 ]; # TODO are there other "errors" that is harmless? $error = "Normal disconnection" unless $error; my $msg = "Got CLIENT $syscall error $errno: $error"; unless ( $syscall eq 'read' and $errno == 0 ) { fail( $msg ); } else { diag( $msg ) if $ENV{TEST_VERBOSE}; } }, ) for 1 .. 10; $poe_kernel->run(); is( $replies, 10, "Make sure we got 10 replies back!" ); done_testing; POE-Component-SSLify-1.012/t/00-ssleay-info.t0000644000175000017500000000171712431461761017006 0ustar apocapoc#!/usr/bin/perl # # This file is part of POE-Component-SSLify # # This software is copyright (c) 2014 by Apocalypse. # # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # use strict; use warnings; use strict; use warnings; # displays some basic info use Test::FailWarnings; use Test::More 1.001002; # new enough for sanity in done_testing() use POE::Component::SSLify; # only available > 1.42 eval { diag( "\nNet::SSLeay::ver_number is 0x" . sprintf( "%x", Net::SSLeay::SSLeay() ) ); diag( "\t" . Net::SSLeay::SSLeay_version( 0 ) ); diag( "\t" . Net::SSLeay::SSLeay_version( 2 ) ); diag( "\t" . Net::SSLeay::SSLeay_version( 3 ) ); diag( "\t" . Net::SSLeay::SSLeay_version( 4 ) ); }; # Idea taken from POE t/00_info.t :) my $done = 0; my $x = 0; $SIG{ALRM} = sub { diag "\tpogomips: $x"; $done = 1; }; alarm(1); ++$x until $done; ok(1, "fake test for info"); done_testing; POE-Component-SSLify-1.012/t/simple_superbig.t0000644000175000017500000001262612431461761017532 0ustar apocapoc#!/usr/bin/perl # # This file is part of POE-Component-SSLify # # This software is copyright (c) 2014 by Apocalypse. # # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # use strict; use warnings; use strict; use warnings; # This is an extension of the simple_large.t test for even LARGER message sizes! # and thus is marked as TODO and a watchdog timer is set in case we lock up - see RT#95071 use Test::FailWarnings; use Test::More 1.001002; # new enough for sanity in done_testing() BEGIN { eval 'use IO::Prompt::Tiny qw/prompt/; my $ans = prompt("This is a long test, do you want to run it? (y/n)", ($ENV{"AUTOMATED_TESTING"} ? "y" : "n")); die "NO" if $ans ne "y";'; if ( $@ ) { plan skip_all => "AUTHOR TEST: $@"; } } use POE 1.267; use POE::Component::Client::TCP; use POE::Component::Server::TCP; use POE::Component::SSLify qw/Client_SSLify Server_SSLify SSLify_Options SSLify_GetCipher SSLify_ContextCreate SSLify_GetSocket SSLify_GetSSL/; # TODO rewrite this to use Test::POE::Server::TCP and stuff :) my $port; # TODO interestingly, x3 goes over some sort of buffer size and this explodes! my $bigpacket = join( '-', ('a' .. 'z') x 10000, ('A' .. 'Z') x 10000 ) x 10; POE::Component::Server::TCP->new ( Alias => 'myserver', Address => '127.0.0.1', Port => 0, ClientFilter => ['POE::Filter::Block', 'BlockSize' => length $bigpacket], Started => sub { use Socket qw/sockaddr_in/; $port = (sockaddr_in($_[HEAP]->{listener}->getsockname))[0]; }, ClientConnected => sub { ok(1, 'SERVER: accepted'); }, ClientDisconnected => sub { ok(1, 'SERVER: client disconnected'); $_[KERNEL]->post(myserver => 'shutdown'); }, ClientPreConnect => sub { eval { SSLify_Options('mylib/example.key', 'mylib/example.crt', 'sslv3') }; eval { SSLify_Options('../mylib/example.key', '../mylib/example.crt', 'sslv3') } if ($@); ok(!$@, "SERVER: SSLify_Options $@"); my $socket = eval { Server_SSLify($_[ARG0]) }; ok(!$@, "SERVER: Server_SSLify $@"); ok(1, 'SERVER: SSLify_GetCipher: '. SSLify_GetCipher($socket)); # We pray that IO::Handle is sane... ok( SSLify_GetSocket( $socket )->blocking == 0, 'SERVER: SSLified socket is non-blocking?') if $^O ne 'MSWin32'; return ($socket); }, ClientInput => sub { my ($kernel, $heap, $line) = @_[KERNEL, HEAP, ARG0]; if ( $line eq $bigpacket ) { ok(1, "SERVER: recv BIGPACKET"); ## At this point, connection MUST be encrypted. my $cipher = SSLify_GetCipher($heap->{client}->get_output_handle); ok($cipher ne '(NONE)', "SERVER: SSLify_GetCipher: $cipher"); $heap->{client}->put($bigpacket); } else { die "Unknown line from CLIENT: $line"; } }, ClientError => sub { # Thanks to H. Merijn Brand for spotting this FAIL in 5.12.0! # The default PoCo::Server::TCP handler will throw a warning, which causes Test::NoWarnings to FAIL :( my ($syscall, $errno, $error) = @_[ ARG0..ARG2 ]; # TODO are there other "errors" that is harmless? $error = "Normal disconnection" unless $error; my $msg = "Got SERVER $syscall error $errno: $error"; unless ( $syscall eq 'read' and $errno == 0 ) { fail( $msg ); } else { diag( $msg ) if $ENV{TEST_VERBOSE}; } }, ); my $replies = 0; POE::Component::Client::TCP->new ( Alias => 'myclient', RemoteAddress => '127.0.0.1', RemotePort => $port, Filter => ['POE::Filter::Block', 'BlockSize' => length $bigpacket], Connected => sub { ok(1, 'CLIENT: connected'); $_[HEAP]->{server}->put($bigpacket); }, PreConnect => sub { my $ctx = eval { SSLify_ContextCreate(undef, undef, 'sslv3') }; ok(!$@, "CLIENT: SSLify_ContextCreate $@"); my $socket = eval { Client_SSLify($_[ARG0], undef, undef, $ctx) }; ok(!$@, "CLIENT: Client_SSLify $@"); ok(1, 'CLIENT: SSLify_GetCipher: '. SSLify_GetCipher($socket)); # We pray that IO::Handle is sane... ok( SSLify_GetSocket( $socket )->blocking == 0, 'CLIENT: SSLified socket is non-blocking?') if $^O ne 'MSWin32'; return ($socket); }, ServerInput => sub { my ($kernel, $heap, $line) = @_[KERNEL, HEAP, ARG0]; if ($line eq $bigpacket) { ok(1, "CLIENT: recv BIGPACKET"); ## At this point, connection MUST be encrypted. my $cipher = SSLify_GetCipher($heap->{server}->get_output_handle); ok($cipher ne '(NONE)', "CLIENT: SSLify_GetCipher: $cipher"); diag( Net::SSLeay::dump_peer_certificate( SSLify_GetSSL( $heap->{server}->get_output_handle ) ) ) if $ENV{TEST_VERBOSE}; $replies++; $kernel->yield('shutdown'); } else { die "Unknown line from SERVER: $line"; } }, ServerError => sub { # Thanks to H. Merijn Brand for spotting this FAIL in 5.12.0! # The default PoCo::Client::TCP handler will throw a warning, which causes Test::NoWarnings to FAIL :( my ($syscall, $errno, $error) = @_[ ARG0..ARG2 ]; # TODO are there other "errors" that is harmless? $error = "Normal disconnection" unless $error; my $msg = "Got CLIENT $syscall error $errno: $error"; unless ( $syscall eq 'read' and $errno == 0 ) { fail( $msg ); } else { diag( $msg ) if $ENV{TEST_VERBOSE}; } }, ); # the watchdog session POE::Session->create( inline_states => { _start => sub { $_[KERNEL]->delay( 'dog' => 300 ); $_[KERNEL]->yield( 'check' ); }, dog => sub { fail "WATCHDOG TRIGGERED"; done_testing; exit; }, check => sub { $_[KERNEL]->delay( 'check' => 1 ); $_[KERNEL]->alarm_remove_all if $replies == 1 }, }, ); $poe_kernel->run(); done_testing; POE-Component-SSLify-1.012/MANIFEST.SKIP0000644000175000017500000000115612431461761015603 0ustar apocapoc# Added by Dist::Zilla::PluginBundle::Apocalyptic v0.006 # skip Eclipse IDE stuff \.includepath$ \.project$ \.settings/ # Avoid version control files. \bRCS\b \bCVS\b ,v$ \B\.svn\b \B\.git\b ^\.gitignore$ # Ignore Dist::Zilla's build dir ^\.build/ # Avoid configuration metadata file ^MYMETA\. # Avoid Makemaker generated and utility files. ^Makefile$ ^blib/ ^MakeMaker-\d \bpm_to_blib$ ^blibdirs$ # Avoid Module::Build generated and utility files. \bBuild$ \bBuild.bat$ \b_build \bBuild.COM$ \bBUILD.COM$ \bbuild.com$ # Avoid temp and backup files. ~$ \.old$ \#$ ^\.# \.bak$ # our tarballs \.tar\.gz$ ^releases/ POE-Component-SSLify-1.012/examples/0000775000175000017500000000000012431461761015522 5ustar apocapocPOE-Component-SSLify-1.012/examples/server.pl0000755000175000017500000000605312431461761017372 0ustar apocapoc#!/usr/bin/perl # # This file is part of POE-Component-SSLify # # This software is copyright (c) 2014 by Apocalypse. # # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # use strict; use warnings; use POE; use Socket qw( inet_ntoa unpack_sockaddr_in ); use POE::Component::SSLify qw( Server_SSLify SSLify_Options SSLify_GetCipher SSLify_GetSocket ); use POE::Wheel::ReadWrite; use POE::Wheel::SocketFactory; use POE::Driver::SysRW; use POE::Filter::Line; POE::Session->create( 'inline_states' => { '_start' => sub { # Okay, set the SSL certificate info eval { SSLify_Options( 'mylib/example.key', 'mylib/example.crt' ); }; SSLify_Options( '../mylib/example.key', '../mylib/example.crt' ) if ( $@ ); # Set the alias $_[KERNEL]->alias_set( 'main' ); # Create the socketfactory wheel to listen for requests $_[HEAP]->{'SOCKETFACTORY'} = POE::Wheel::SocketFactory->new( 'BindPort' => 9898, 'BindAddress' => 'localhost', 'Reuse' => 'yes', 'SuccessEvent' => 'Got_Connection', 'FailureEvent' => 'ListenerError', ); return 1; }, 'Got_Connection' => sub { # ARG0 = Socket, ARG1 = Remote Address, ARG2 = Remote Port my $socket = $_[ ARG0 ]; # SSLify it! $socket = Server_SSLify( $socket ); # testing stuff warn "got connection from: " . inet_ntoa( ( unpack_sockaddr_in( getpeername( SSLify_GetSocket( $socket ) ) ) )[1] ) . " cipher type: " . SSLify_GetCipher( $socket ) . "\n"; # Hand it off to ReadWrite my $wheel = POE::Wheel::ReadWrite->new( 'Handle' => $socket, 'Driver' => POE::Driver::SysRW->new(), 'Filter' => POE::Filter::Line->new(), 'InputEvent' => 'Got_Input', 'FlushedEvent' => 'Got_Flush', 'ErrorEvent' => 'Got_Error', ); # Store it... $_[HEAP]->{'WHEELS'}->{ $wheel->ID } = $wheel; return 1; }, 'ListenerError' => sub { # ARG0 = operation, ARG1 = error number, ARG2 = error string, ARG3 = wheel ID my ( $operation, $errnum, $errstr, $wheel_id ) = @_[ ARG0 .. ARG3 ]; warn "SocketFactory Wheel $wheel_id generated $operation error $errnum: $errstr\n"; return 1; }, 'Got_Input' => sub { # ARG0: The Line, ARG1: Wheel ID # testing stuff my $socket = $_[HEAP]->{'WHEELS'}->{ $_[ARG1] }->get_output_handle(); warn "got input from: " . inet_ntoa( ( unpack_sockaddr_in( getpeername( SSLify_GetSocket( $socket ) ) ) )[1] ) . " cipher type: (" . SSLify_GetCipher( $socket ) . ") input: '$_[ARG0]'\n"; # Send back to the client the line! $_[HEAP]->{'WHEELS'}->{ $_[ARG1] }->put( $_[ARG0] ); return 1; }, 'Got_Flush' => sub { # We don't care about this event return 1; }, 'Got_Error' => sub { # ARG0 = operation, ARG1 = error number, ARG2 = error string, ARG3 = wheel ID my ( $operation, $errnum, $errstr, $id ) = @_[ ARG0 .. ARG3 ]; warn "Wheel $id generated $operation error $errnum: $errstr\n"; # Done with a wheel delete $_[HEAP]->{'WHEELS'}->{ $_[ARG0] }; return 1; }, }, ); # Start POE! POE::Kernel->run(); exit 0; POE-Component-SSLify-1.012/examples/serverclient.pl0000755000175000017500000001335712431461761020576 0ustar apocapoc#!/usr/bin/perl # # This file is part of POE-Component-SSLify # # This software is copyright (c) 2014 by Apocalypse. # # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # use strict; use warnings; use POE; use Socket qw( inet_ntoa unpack_sockaddr_in ); use POE::Component::SSLify qw( Client_SSLify Server_SSLify SSLify_Options SSLify_GetCipher SSLify_GetSocket ); use POE::Wheel::ReadWrite; use POE::Wheel::SocketFactory; use POE::Driver::SysRW; use POE::Filter::Line; use POE::Wheel::ReadLine; # create the server POE::Session->create( 'inline_states' => { '_start' => sub { # Okay, set the SSL certificate info eval { SSLify_Options( 'mylib/example.key', 'mylib/example.crt' ); }; SSLify_Options( '../mylib/example.key', '../mylib/example.crt' ) if ( $@ ); # Set the alias $_[KERNEL]->alias_set( 'server' ); # Create the socketfactory wheel to listen for requests $_[HEAP]->{'SOCKETFACTORY'} = POE::Wheel::SocketFactory->new( 'BindPort' => 9898, 'BindAddress' => 'localhost', 'Reuse' => 'yes', 'SuccessEvent' => 'Got_Connection', 'FailureEvent' => 'ListenerError', ); return 1; }, 'Got_Connection' => sub { # ARG0 = Socket, ARG1 = Remote Address, ARG2 = Remote Port my $socket = $_[ ARG0 ]; # testing stuff warn "got connection from: " . inet_ntoa( ( unpack_sockaddr_in( getpeername( $socket ) ) )[1] ) . " - commencing Server_SSLify()\n"; # SSLify it! $socket = Server_SSLify( $socket ); # testing stuff warn "SSLified: " . inet_ntoa( ( unpack_sockaddr_in( getpeername( SSLify_GetSocket( $socket ) ) ) )[1] ) . " cipher type: (" . SSLify_GetCipher( $socket ) . ")\n"; # Hand it off to ReadWrite my $wheel = POE::Wheel::ReadWrite->new( 'Handle' => $socket, 'Driver' => POE::Driver::SysRW->new(), 'Filter' => POE::Filter::Line->new(), 'InputEvent' => 'Got_Input', 'ErrorEvent' => 'Got_Error', ); # Store it... $_[HEAP]->{'WHEELS'}->{ $wheel->ID } = $wheel; return; }, 'ListenerError' => sub { # ARG0 = operation, ARG1 = error number, ARG2 = error string, ARG3 = wheel ID my ( $operation, $errnum, $errstr, $wheel_id ) = @_[ ARG0 .. ARG3 ]; warn "SocketFactory Wheel $wheel_id generated $operation error $errnum: $errstr\n"; return; }, 'Got_Input' => sub { # ARG0: The Line, ARG1: Wheel ID # testing stuff my $socket = $_[HEAP]->{'WHEELS'}->{ $_[ARG1] }->get_output_handle(); warn "got input from: " . inet_ntoa( ( unpack_sockaddr_in( getpeername( SSLify_GetSocket( $socket ) ) ) )[1] ) . " cipher type: (" . SSLify_GetCipher( $socket ) . ") input: '$_[ARG0]'\n"; # Send back to the client the line! $_[HEAP]->{'WHEELS'}->{ $_[ARG1] }->put( $_[ARG0] ); return; }, 'Got_Error' => sub { # ARG0 = operation, ARG1 = error number, ARG2 = error string, ARG3 = wheel ID my ( $operation, $errnum, $errstr, $id ) = @_[ ARG0 .. ARG3 ]; warn "Wheel $id generated $operation error $errnum: $errstr\n"; # Done with a wheel delete $_[HEAP]->{'WHEELS'}->{ $_[ARG0] }; return; }, }, ); # create the client POE::Session->create( 'inline_states' => { '_start' => sub { # Set the alias $_[KERNEL]->alias_set( 'client' ); # Setup our ReadLine stuff $_[HEAP]->{'RL'} = POE::Wheel::ReadLine->new( 'InputEvent' => 'Got_ReadLine', ); # Connect to the server! $_[KERNEL]->yield( 'do_connect' ); return; }, 'do_connect' => sub { # Create the socketfactory wheel to listen for requests $_[HEAP]->{'SOCKETFACTORY'} = POE::Wheel::SocketFactory->new( 'RemotePort' => 9898, 'RemoteAddress' => 'localhost', 'Reuse' => 'yes', 'SuccessEvent' => 'Got_Connection', 'FailureEvent' => 'ConnectError', ); return; }, 'Got_ReadLine' => sub { if ( defined $_[ARG0] ) { if ( exists $_[HEAP]->{'WHEEL'} ) { $_[HEAP]->{'WHEEL'}->put( $_[ARG0] ); } } else { if ( $_[ARG1] eq 'interrupt' ) { die 'stopped'; } } return; }, 'Got_Connection' => sub { # ARG0 = Socket, ARG1 = Remote Address, ARG2 = Remote Port my $socket = $_[ ARG0 ]; warn "Connected to server, commencing Client_SSLify()\n"; # SSLify it! $socket = Client_SSLify( $socket ); warn "SSLified the connection to the server\n"; # Hand it off to ReadWrite my $wheel = POE::Wheel::ReadWrite->new( 'Handle' => $socket, 'Driver' => POE::Driver::SysRW->new(), 'Filter' => POE::Filter::Line->new(), 'InputEvent' => 'Got_Input', 'ErrorEvent' => 'Got_Error', ); # Store it... $_[HEAP]->{'WHEEL'} = $wheel; $_[HEAP]->{'RL'}->put( 'Connected to SSL server' ); $_[HEAP]->{'RL'}->get( 'Input: ' ); return; }, 'ConnectError' => sub { # ARG0 = operation, ARG1 = error number, ARG2 = error string, ARG3 = wheel ID my ( $operation, $errnum, $errstr, $wheel_id ) = @_[ ARG0 .. ARG3 ]; warn "SocketFactory Wheel $wheel_id generated $operation error $errnum: $errstr\n"; delete $_[HEAP]->{'SOCKETFACTORY'}; $_[HEAP]->{'RL'}->put( 'Unable to connect to SSL server...' ); $_[KERNEL]->delay_set( 'do_connect', 5 ); return; }, 'Got_Input' => sub { # ARG0: The Line, ARG1: Wheel ID # Send back to the client the line! $_[HEAP]->{'RL'}->put( 'Got Reply: ' . $_[ARG0] ); $_[HEAP]->{'RL'}->get( 'Input: ' ); return; }, 'Got_Error' => sub { # ARG0 = operation, ARG1 = error number, ARG2 = error string, ARG3 = wheel ID my ( $operation, $errnum, $errstr, $id ) = @_[ ARG0 .. ARG3 ]; warn "Wheel $id generated $operation error $errnum: $errstr\n"; delete $_[HEAP]->{'WHEEL'}; $_[HEAP]->{'RL'}->put( 'Disconnected from SSL server...' ); $_[KERNEL]->delay_set( 'do_connect', 5 ); return; }, }, ); # Start POE! POE::Kernel->run(); exit 0; POE-Component-SSLify-1.012/examples/client.pl0000755000175000017500000000575112431461761017346 0ustar apocapoc#!/usr/bin/perl # # This file is part of POE-Component-SSLify # # This software is copyright (c) 2014 by Apocalypse. # # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # use strict; use warnings; use POE; use POE::Component::SSLify qw( Client_SSLify ); use POE::Wheel::ReadWrite; use POE::Wheel::SocketFactory; use POE::Driver::SysRW; use POE::Filter::Line; use POE::Wheel::ReadLine; POE::Session->create( 'inline_states' => { '_start' => sub { # Set the alias $_[KERNEL]->alias_set( 'main' ); # Setup our ReadLine stuff $_[HEAP]->{'RL'} = POE::Wheel::ReadLine->new( 'InputEvent' => 'Got_ReadLine', ); # Connect to the server! $_[KERNEL]->yield( 'do_connect' ); return 1; }, 'do_connect' => sub { # Create the socketfactory wheel to listen for requests $_[HEAP]->{'SOCKETFACTORY'} = POE::Wheel::SocketFactory->new( 'RemotePort' => 9898, 'RemoteAddress' => 'localhost', 'Reuse' => 'yes', 'SuccessEvent' => 'Got_Connection', 'FailureEvent' => 'ConnectError', ); return 1; }, 'Got_ReadLine' => sub { if ( defined $_[ARG0] ) { if ( exists $_[HEAP]->{'WHEEL'} ) { $_[HEAP]->{'WHEEL'}->put( $_[ARG0] ); } } else { if ( $_[ARG1] eq 'interrupt' ) { die 'stopped'; } } }, 'Got_Connection' => sub { # ARG0 = Socket, ARG1 = Remote Address, ARG2 = Remote Port my $socket = $_[ ARG0 ]; # SSLify it! $socket = Client_SSLify( $socket ); # Hand it off to ReadWrite my $wheel = POE::Wheel::ReadWrite->new( 'Handle' => $socket, 'Driver' => POE::Driver::SysRW->new(), 'Filter' => POE::Filter::Line->new(), 'InputEvent' => 'Got_Input', 'ErrorEvent' => 'Got_Error', ); # Store it... $_[HEAP]->{'WHEEL'} = $wheel; $_[HEAP]->{'RL'}->put( 'Connected to SSL server' ); $_[HEAP]->{'RL'}->get( 'Input: ' ); return 1; }, 'ConnectError' => sub { # ARG0 = operation, ARG1 = error number, ARG2 = error string, ARG3 = wheel ID my ( $operation, $errnum, $errstr, $wheel_id ) = @_[ ARG0 .. ARG3 ]; warn "SocketFactory Wheel $wheel_id generated $operation error $errnum: $errstr\n"; delete $_[HEAP]->{'SOCKETFACTORY'}; $_[HEAP]->{'RL'}->put( 'Unable to connect to SSL server...' ); $_[KERNEL]->delay_set( 'do_connect', 5 ); return 1; }, 'Got_Input' => sub { # ARG0: The Line, ARG1: Wheel ID # Send back to the client the line! $_[HEAP]->{'RL'}->put( 'Got Reply: ' . $_[ARG0] ); $_[HEAP]->{'RL'}->get( 'Input: ' ); return 1; }, 'Got_Error' => sub { # ARG0 = operation, ARG1 = error number, ARG2 = error string, ARG3 = wheel ID my ( $operation, $errnum, $errstr, $id ) = @_[ ARG0 .. ARG3 ]; warn "Wheel $id generated $operation error $errnum: $errstr\n"; delete $_[HEAP]->{'WHEEL'}; $_[HEAP]->{'RL'}->put( 'Disconnected from SSL server...' ); $_[KERNEL]->delay_set( 'do_connect', 5 ); return 1; }, }, ); # Start POE! POE::Kernel->run(); exit 0; POE-Component-SSLify-1.012/MANIFEST0000644000175000017500000000151712431461761015037 0ustar apocapoc# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.024. AUTHOR_PLEDGE Build.PL Changes CommitLog INSTALL LICENSE MANIFEST MANIFEST.SKIP META.json META.yml Makefile.PL README SIGNATURE cpanfile dist.ini doap.xml examples/client.pl examples/server.pl examples/serverclient.pl lib/POE/Component/SSLify.pm lib/POE/Component/SSLify/ClientHandle.pm lib/POE/Component/SSLify/ServerHandle.pm mylib/example.crt mylib/example.key t/00-compile.t t/00-report-prereqs.dd t/00-report-prereqs.t t/00-ssleay-info.t t/99_mire_test.t t/apocalypse.t t/connect_hook.t t/connect_hook_nodata.t t/connfail_client.t t/connfail_server.t t/renegotiate_client.t t/renegotiate_client_pings.t t/renegotiate_server.t t/simple.t t/simple_large.t t/simple_parallel.t t/simple_parallel_large.t t/simple_parallel_superbig.t t/simple_superbig.t t/upgrade.t POE-Component-SSLify-1.012/cpanfile0000644000175000017500000000200712431461761015405 0ustar apocapocrequires "Exporter" => "0"; requires "IO::Handle" => "1.28"; requires "Net::SSLeay" => "1.36"; requires "POE" => "1.267"; requires "Scalar::Util" => "0"; requires "Symbol" => "0"; requires "Task::Weaken" => "1.03"; requires "parent" => "0"; requires "perl" => "5.006"; requires "strict" => "0"; requires "warnings" => "0"; on 'test' => sub { requires "ExtUtils::MakeMaker" => "0"; requires "File::Spec" => "0"; requires "File::Temp" => "0"; requires "IO::Handle" => "1.28"; requires "IPC::Open3" => "0"; requires "POE" => "1.267"; requires "POE::Component::Client::TCP" => "0"; requires "POE::Component::Server::TCP" => "0"; requires "POE::Filter::Stream" => "0"; requires "Socket" => "0"; requires "Test::FailWarnings" => "0"; requires "Test::More" => "1.001002"; requires "perl" => "5.006"; }; on 'test' => sub { recommends "CPAN::Meta" => "2.120900"; }; on 'configure' => sub { requires "ExtUtils::MakeMaker" => "0"; requires "Module::Build::Tiny" => "0.039"; requires "perl" => "5.006"; }; POE-Component-SSLify-1.012/dist.ini0000644000175000017500000000005312431461761015344 0ustar apocapocname = POE-Component-SSLify [@Apocalyptic] POE-Component-SSLify-1.012/README0000644000175000017500000005033412431461761014567 0ustar apocapocNAME POE::Component::SSLify - Makes using SSL in the world of POE easy! VERSION This document describes v1.012 of POE::Component::SSLify - released November 14, 2014 as part of POE-Component-SSLify. SYNOPSIS # look at the DESCRIPTION for client and server example code DESCRIPTION This component is a method to simplify the SSLification of a socket before it is passed to a POE::Wheel::ReadWrite wheel in your application. Client usage # Import the module use POE::Component::SSLify qw( Client_SSLify ); # Create a normal SocketFactory wheel and connect to a SSL-enabled server my $factory = POE::Wheel::SocketFactory->new; # Time passes, SocketFactory gives you a socket when it connects in SuccessEvent # Convert the socket into a SSL socket POE can communicate with my $socket = shift; eval { $socket = Client_SSLify( $socket ) }; if ( $@ ) { # Unable to SSLify it... } # Now, hand it off to ReadWrite my $rw = POE::Wheel::ReadWrite->new( Handle => $socket, # other options as usual ); Server usage # !!! Make sure you have a public key + certificate # excellent howto: http://www.akadia.com/services/ssh_test_certificate.html # Import the module use POE::Component::SSLify qw( Server_SSLify SSLify_Options ); # Set the key + certificate file eval { SSLify_Options( 'server.key', 'server.crt' ) }; if ( $@ ) { # Unable to load key or certificate file... } # Create a normal SocketFactory wheel to listen for connections my $factory = POE::Wheel::SocketFactory->new; # Time passes, SocketFactory gives you a socket when it gets a connection in SuccessEvent # Convert the socket into a SSL socket POE can communicate with my $socket = shift; eval { $socket = Server_SSLify( $socket ) }; if ( $@ ) { # Unable to SSLify it... } # Now, hand it off to ReadWrite my $rw = POE::Wheel::ReadWrite->new( Handle => $socket, # other options as usual ); FUNCTIONS Client_SSLify This function sslifies a client-side socket. You can pass several options to it: my $socket = shift; $socket = Client_SSLify( $socket, $version, $options, $ctx, $callback ); $socket is the non-ssl socket you got from somewhere ( required ) $version is the SSL version you want to use $options is the SSL options you want to use $ctx is the custom SSL context you want to use $callback is the callback hook on success/failure of sslification # This is an example of the callback and you should pass it as Client_SSLify( $socket, ... , \&callback ); sub callback { my( $socket, $status, $errval ) = @_; # $socket is the original sslified socket in case you need to play with it # $status is either 1 or 0; with 1 signifying success and 0 failure # $errval will be defined if $status == 0; it's the numeric SSL error code # check http://www.openssl.org/docs/ssl/SSL_get_error.html for the possible error values ( and import them from Net::SSLeay! ) # The return value from the callback is discarded } If $ctx is defined, SSLify will ignore $version and $options. Otherwise, it will be created from the $version and $options parameters. If all of them are undefined, it will follow the defaults in "SSLify_ContextCreate". BEWARE: If you passed in a CTX, SSLify will do Net::SSLeay::CTX_free( $ctx ) when the socket is destroyed. This means you cannot reuse contexts! NOTE: The way to have a client socket with proper certificates set up is: my $socket = shift; # get the socket from somewhere my $ctx = SSLify_ContextCreate( 'server.key', 'server.crt' ); $socket = Client_SSLify( $socket, undef, undef, $ctx ); NOTE: You can pass the callback anywhere in the arguments, we'll figure it out for you! If you want to call a POE event, please look into the postback/callback stuff in POE::Session. # we got this from POE::Wheel::SocketFactory sub event_SuccessEvent { my $socket = $_[ARG0]; $socket = Client_SSLify( $socket, $_[SESSION]->callback( 'sslify_result' ) ); $_[HEAP]->{client} = POE::Wheel::ReadWrite->new( Handle => $socket, ... ); return; } # the callback event sub event_sslify_result { my ($creation_args, $called_args) = @_[ARG0, ARG1]; my( $socket, $status, $errval ) = @$called_args; if ( $status ) { print "Yay, SSLification worked!"; } else { print "Aw, SSLification failed with error $errval"; } } Server_SSLify This function sslifies a server-side socket. You can pass several options to it: my $socket = shift; $socket = Server_SSLify( $socket, $ctx, $callback ); $socket is the non-ssl socket you got from somewhere ( required ) $ctx is the custom SSL context you want to use; overrides the global ctx set in SSLify_Options $callback is the callback hook on success/failure of sslification BEWARE: "SSLify_Options" must be called first if you aren't passing a $ctx. If you want to set some options per-connection, do this: my $socket = shift; # get the socket from somewhere my $ctx = SSLify_ContextCreate(); # set various options on $ctx as desired $socket = Server_SSLify( $socket, $ctx ); NOTE: You can use "SSLify_GetCTX" to modify the global, and avoid doing this on every connection if the options are the same... Please look at "Client_SSLify" for more details on the callback hook. SSLify_ContextCreate Accepts some options, and returns a brand-new Net::SSLeay context object ( $ctx ) my $ctx = SSLify_ContextCreate( $key, $cert, $version, $options ); $key is the certificate key file $cert is the certificate file $version is the SSL version to use $options is the SSL options to use You can then call various Net::SSLeay methods on the context my $mode = Net::SSLeay::CTX_get_mode( $ctx ); By default we don't use the SSL key + certificate files By default we use the version: default. Known versions of the SSL connection - look at http://www.openssl.org/docs/ssl/SSL_CTX_new.html for more info. * sslv2 * sslv3 * tlsv1 * sslv23 * default ( sslv23 ) By default we don't set any options - look at http://www.openssl.org/docs/ssl/SSL_CTX_set_options.html for more info. SSLify_Options Call this function to initialize the global server-side context object. This will be the default context whenever you call "Server_SSLify" without passing a custom context to it. SSLify_Options( $key, $cert, $version, $options ); $key is the certificate key file ( required ) $cert is the certificate file ( required ) $version is the SSL version to use $options is the SSL options to use By default we use the version: default By default we use the options: Net::SSLeay::OP_ALL Please look at "SSLify_ContextCreate" for more info on the available versions/options. SSLify_GetCTX Returns the actual Net::SSLeay context object in case you wanted to play with it :) If passed in a socket, it will return that socket's $ctx instead of the global. my $ctx = SSLify_GetCTX(); # get the one set via SSLify_Options my $ctx = SSLify_GetCTX( $sslified_sock ); # get the one in the object SSLify_GetCipher Returns the cipher used by the SSLified socket print "SSL Cipher is: " . SSLify_GetCipher( $sslified_sock ) . "\n"; NOTE: Doing this immediately after Client_SSLify or Server_SSLify will result in "(NONE)" because the SSL handshake is not done yet. The socket is nonblocking, so you will have to wait a little bit for it to get ready. apoc@blackhole:~/mygit/perl-poe-sslify/examples$ perl serverclient.pl got connection from: 127.0.0.1 - commencing Server_SSLify() SSLified: 127.0.0.1 cipher type: ((NONE)) Connected to server, commencing Client_SSLify() SSLified the connection to the server Connected to SSL server Input: hola got input from: 127.0.0.1 cipher type: (AES256-SHA) input: 'hola' Got Reply: hola Input: ^C stopped at serverclient.pl line 126. SSLify_GetSocket Returns the actual socket used by the SSLified socket, useful for stuff like getpeername()/getsockname() print "Remote IP is: " . inet_ntoa( ( unpack_sockaddr_in( getpeername( SSLify_GetSocket( $sslified_sock ) ) ) )[1] ) . "\n"; SSLify_GetSSL Returns the actual Net::SSLeay object so you can call methods on it print Net::SSLeay::dump_peer_certificate( SSLify_GetSSL( $sslified_sock ) ); SSLify_GetStatus Returns the status of the SSL negotiation/handshake/connection. See http://www.openssl.org/docs/ssl/SSL_connect.html#RETURN_VALUES for more info. my $status = SSLify_GetStatus( $socket ); -1 = still in negotiation stage ( or error ) 0 = internal SSL error, connection will be dead 1 = negotiation successful NOTES Socket methods doesn't work The new socket this module gives you actually is tied socket magic, so you cannot do stuff like getpeername() or getsockname(). The only way to do it is to use "SSLify_GetSocket" and then operate on the socket it returns. Dying everywhere... This module will die() if Net::SSLeay could not be loaded or it is not the version we want. So, it is recommended that you check for errors and not use SSL, like so: eval { use POE::Component::SSLify }; if ( $@ ) { $sslavailable = 0; } else { $sslavailable = 1; } # Make socket SSL! if ( $sslavailable ) { eval { $socket = POE::Component::SSLify::Client_SSLify( $socket ) }; if ( $@ ) { # Unable to SSLify the socket... } } $IGNORE_SSL_ERRORS As of SSLify v1.003 you can override this variable to temporarily ignore some SSL errors. This is useful if you are doing crazy things with the underlying Net::SSLeay stuff and don't want to die. However, it won't ignore all errors as some is still considered fatal. Here's an example: { local $POE::Component::SSLify::IGNORE_SSL_ERRORS=1; my $ctx = SSLify_CreateContext(...); #Some more stuff } OpenSSL functions Theoretically you can do anything that Net::SSLeay exports from the OpenSSL libs on the socket. However, I have not tested every possible function against SSLify, so use them carefully! Net::SSLeay::renegotiate This function has been tested ( it's in t/2_renegotiate_client.t ) but it doesn't work on FreeBSD! I tracked it down to this security advisory: http://security.freebsd.org/advisories/FreeBSD-SA-09:15.ssl.asc which explains it in detail. The test will skip this function if it detects that you're on a broken system. However, if you have the updated OpenSSL library that fixes this you can use it. NOTE: Calling this means the callback function you passed in "Client_SSLify" or "Server_SSLify" will not fire! If you need this please let me know and we can come up with a way to make it work. Upgrading a non-ssl socket to SSL You can have a normal plaintext socket, and convert it to SSL anytime. Just keep in mind that the client and the server must agree to sslify at the same time, or they will be waiting on each other forever! See t/3_upgrade.t for an example of how this works. Downgrading a SSL socket to non-ssl As of now this is unsupported. If you need this feature please let us know and we'll work on it together! MSWin32 is not supported This module doesn't work on MSWin32 platforms at all ( XP, Vista, 7, etc ) because of some weird underlying fd issues. Since I'm not a windows developer, I'm unable to fix this. However, it seems like Cygwin on MSWin32 works just fine! Please help me fix this if you can, thanks! LOAD_SSL_ENGINES OpenSSL supports loading ENGINEs to accelerate the crypto algorithms. SSLify v1.004 automatically loaded the engines, but there was some problems on certain platforms that caused coredumps. A big shout-out to BinGOs and CPANTesters for catching this! It's now disabled in v1.007 and you would need to explicitly enable it. sub POE::Component::SSLify::LOAD_SSL_ENGINES () { 1 } use POE::Component::SSLify qw( Client::SSLify ); EXPORT Stuffs all of the functions in @EXPORT_OK so you have to request them directly. SEE ALSO Please see those modules/websites for more information related to this module. * POE * Net::SSLeay SUPPORT Perldoc You can find documentation for this module with the perldoc command. perldoc POE::Component::SSLify Websites The following websites have more information about this module, and may be of help to you. As always, in addition to those websites please use your favorite search engine to discover more resources. * MetaCPAN A modern, open-source CPAN search engine, useful to view POD in HTML format. http://metacpan.org/release/POE-Component-SSLify * Search CPAN The default CPAN search engine, useful to view POD in HTML format. http://search.cpan.org/dist/POE-Component-SSLify * RT: CPAN's Bug Tracker The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN. http://rt.cpan.org/NoAuth/Bugs.html?Dist=POE-Component-SSLify * AnnoCPAN The AnnoCPAN is a website that allows community annotations of Perl module documentation. http://annocpan.org/dist/POE-Component-SSLify * CPAN Ratings The CPAN Ratings is a website that allows community ratings and reviews of Perl modules. http://cpanratings.perl.org/d/POE-Component-SSLify * CPAN Forum The CPAN Forum is a web forum for discussing Perl modules. http://cpanforum.com/dist/POE-Component-SSLify * CPANTS The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution. http://cpants.cpanauthors.org/dist/overview/POE-Component-SSLify * CPAN Testers The CPAN Testers is a network of smokers who run automated tests on uploaded CPAN distributions. http://www.cpantesters.org/distro/P/POE-Component-SSLify * CPAN Testers Matrix The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms. http://matrix.cpantesters.org/?dist=POE-Component-SSLify * CPAN Testers Dependencies The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution. http://deps.cpantesters.org/?module=POE::Component::SSLify Email You can email the author of this module at APOCAL at cpan.org asking for help with any problems you have. Internet Relay Chat You can get live help by using IRC ( Internet Relay Chat ). If you don't know what IRC is, please read this excellent guide: http://en.wikipedia.org/wiki/Internet_Relay_Chat. Please be courteous and patient when talking to us, as we might be busy or sleeping! You can join those networks/channels and get help: * irc.perl.org You can connect to the server at 'irc.perl.org' and join this channel: #perl-help then talk to this person for help: Apocalypse. * irc.freenode.net You can connect to the server at 'irc.freenode.net' and join this channel: #perl then talk to this person for help: Apocal. * irc.efnet.org You can connect to the server at 'irc.efnet.org' and join this channel: #perl then talk to this person for help: Ap0cal. Bugs / Feature Requests Please report any bugs or feature requests by email to bug-poe-component-sslify at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=POE-Component-SSLify. You will be automatically notified of any progress on the request by the system. Source Code The code is open to the world, and available for you to hack on. Please feel free to browse it and play with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull from your repository :) https://github.com/apocalypse/perl-poe-sslify git clone https://github.com/apocalypse/perl-poe-sslify.git AUTHOR Apocalypse ACKNOWLEDGEMENTS Original code is entirely Rocco Caputo ( Creator of POE ) -> I simply packaged up the code into something everyone could use and accepted the burden of maintaining it :) From the PoCo::Client::HTTP code =] # This code should probably become a POE::Kernel method, # seeing as it's rather baroque and potentially useful in a number # of places. ASCENT also helped a lot with the nonblocking mode, without his hard work this module would still be stuck in the stone age :) A lot of people helped add various features/functions - please look at the changelog for more detail. COPYRIGHT AND LICENSE This software is copyright (c) 2014 by Apocalypse. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. The full text of the license can be found in the LICENSE file included with this distribution. DISCLAIMER OF WARRANTY THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. POE-Component-SSLify-1.012/mylib/0000775000175000017500000000000012431461761015020 5ustar apocapocPOE-Component-SSLify-1.012/mylib/example.key0000644000175000017500000000321712431461761017166 0ustar apocapoc-----BEGIN RSA PRIVATE KEY----- MIIEpQIBAAKCAQEAy7vONqMnWdBNGEstmvJDH3vmDh/yZxgpkJhKNTIEbyo5B+m2 9mc860A4VNKGmi/c/Z0zx7ETu5GpTZAvVdhr9LWHKh6jvH4xGfCfCCfyZtFIxEsI awpaRi2AkKRb4386NCDXdomVCiihAEn2VKS13nZaztMuEwVFg3l5jIj8sHE9UJbT mbCQOJre1brAK/2l0FEfy03oCygYvtTUzYksbLNsNiG7LJ/Y8opoKwdcboVzMOg1 dnoY6a3J7hpDd6FSTKcpqxNltk3x1fWh+zEd0Pl3YAMFuW1mIbOIuSuQD9mZqcxD IaAb/yrU5N82zh7Kkba3MCs1B6eaCWPJcDFeFwIDAQABAoIBAQDAWYEZHrMBXePb 4uac2su6xuxuO4VOBob/qHivfpinJ9MOgH8oZlIivdAxbU599mCL5cbEa4/40E5r F41JXHqYYGbLwn/Ob8oF9qL/PU/j+QXdpgW9odmXVlCCv1quECmwm60xkjXvkGpp bmsugQ/giBe2G7XtaVW3CpJSt+by4VW+qf8ke3Y8TQHoW+dUPiexb9KFFTvy9i1O HV1Z3pQ3Y8yH1qb5xzCNYv1/ofjbAMlv1Cf9CHpAnIWlXA7QCb1VktF2eMjv435d oxhEhYidARWZfxiYRcewt0FfPU7/yDZXgphLSrQLWEJs6bOxDRhA6l/cOcQX/XG1 t7I5I9JhAoGBAPuweXOTUEfZdrveXM5716/o+qYMZC330LvOqbpJnB5up8cPR9sl VB1dZqFMYdFTVD9oPKPY726RxptE8ylShhe5LuPRjF3/aYmXlrQROSJJ5uJ5exr9 mJjXaRp9AW8wTOqDkHbiyb+WrpVL5klYHvgnJrivokzc246tdsvADJ6xAoGBAM85 EgTQhHT5OFe4bQavROd8khuTTD3iGQQO0cR5Oh8EjbMc3ejp7qUE41I30DoFpn64 uOiQzxzpOJFGiid+8FoG7k2/K96j0j9JiBNv93Te1OhOvG+2JirrygoM9E3ofmF5 trDpCVgs5+mAkdJctmpXME5PPmEKo5+b2cK9S8tHAoGAS5s0sLJVEHBUCZV/nYt4 PGCpQs5AHcruyiwHsm1AV6f4AIUnmb456WRQWy3dyIrWqQGADdwx+K4T0jrBLO2c WG4Jlugw2V/LbUi7PbZaymEW2XuSroX1nBxBd3KLxsHkqSICeKQh5Mq4ASM+t1Og Yf0o1Zv1Dk/eKJsVL5mucNECgYEAst3nIMK/4pwQNx+Y9DErf8i18Rl2sN/NigQk qrudIJL0oMtk/JuYA1axxREqKjsgWLen3A7Kx4DD9Bn4PFlEq+DZp8BA5L9xRnF5 BJYb+gQxsIft/VsznM7EKWK/KdRp6kd+Gzw7daHlWFdDB1pBlo7FwoKCLI9bZvTG xWJR3xcCgYEAyHPtp36K2epbFkpCf5pmtWCVk4lRNs6MSE0aJmbqZhRW971V81ev xa2DZj3KHcXCfDW5Dnjiyx9qf7GS1ts9dfWyKjr6qEwBcGQMXW3C6p9fuFXkxGhe Yx2KYA48kiY5Rj5wTpixwdq3YWASlZOQs282UEb+cxZHxpT2YUiIJkc= -----END RSA PRIVATE KEY----- POE-Component-SSLify-1.012/mylib/example.crt0000644000175000017500000000216712431461761017171 0ustar apocapoc-----BEGIN CERTIFICATE----- MIIDIDCCAggCCQCFFIApNMYn+zANBgkqhkiG9w0BAQUFADBSMQswCQYDVQQGEwJY WDETMBEGA1UECBMKU29tZS1TdGF0ZTESMBAGA1UEBxMJU29tZS1DaXR5MRowGAYD VQQKExFTb21lLUNvbXBhbnkgTHRkLjAeFw0xMDAzMDkyMzM0NDBaFw0yMzExMTYy MzM0NDBaMFIxCzAJBgNVBAYTAlhYMRMwEQYDVQQIEwpTb21lLVN0YXRlMRIwEAYD VQQHEwlTb21lLUNpdHkxGjAYBgNVBAoTEVNvbWUtQ29tcGFueSBMdGQuMIIBIjAN BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAy7vONqMnWdBNGEstmvJDH3vmDh/y ZxgpkJhKNTIEbyo5B+m29mc860A4VNKGmi/c/Z0zx7ETu5GpTZAvVdhr9LWHKh6j vH4xGfCfCCfyZtFIxEsIawpaRi2AkKRb4386NCDXdomVCiihAEn2VKS13nZaztMu EwVFg3l5jIj8sHE9UJbTmbCQOJre1brAK/2l0FEfy03oCygYvtTUzYksbLNsNiG7 LJ/Y8opoKwdcboVzMOg1dnoY6a3J7hpDd6FSTKcpqxNltk3x1fWh+zEd0Pl3YAMF uW1mIbOIuSuQD9mZqcxDIaAb/yrU5N82zh7Kkba3MCs1B6eaCWPJcDFeFwIDAQAB MA0GCSqGSIb3DQEBBQUAA4IBAQBDXa1fKk1NF05/9w93q8/QDINXQhlWFZDIr5oB A0rU2Rezljji92ElZCl/nGfianeCoCjA6+xMY37eUn8OOfJh1e6a45E1sRyXgZZv tlZmt65K/UlZCYQ8+jEPjP+Ea/iKq3IUN0RKObOxB3QvOucx0ECfqZeiApuhkjZJ I97dcD3ybwQ2rZcRzIccKQYsfnzLIzUjLlEbvyIOk6jyGKV6lZfmkeyuDbFlBdcG 85Ts5GpXM7lojmdz858PgNEtCEkoSO8LQSdWftsoCxWTEPdMTBPotMN0FgySO5Wr d91Rn/uL5LFSGD4CV8u94IcS/qLf1IqheGUWPYZ7edwt+zQm -----END CERTIFICATE----- POE-Component-SSLify-1.012/LICENSE0000644000175000017500000004364712431461761014725 0ustar apocapocThis software is copyright (c) 2014 by Apocalypse. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2014 by Apocalypse. This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Artistic License 1.0 --- This software is Copyright (c) 2014 by Apocalypse. This is free software, licensed under: The Artistic License 1.0 The Artistic License Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: - "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. - "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder. - "Copyright Holder" is whoever is named in the copyright or copyrights for the package. - "You" is you, if you're thinking about copying or distributing this Package. - "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) - "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. 7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package. 8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End POE-Component-SSLify-1.012/META.json0000644000175000017500000006553612431461761015342 0ustar apocapoc{ "abstract" : "Makes using SSL in the world of POE easy!", "author" : [ "Apocalypse " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 5.024, CPAN::Meta::Converter version 2.142690", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "POE-Component-SSLify", "no_index" : { "directory" : [ "t", "examples", "mylib" ] }, "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0", "Module::Build::Tiny" : "0.039", "perl" : "5.006" } }, "runtime" : { "requires" : { "Exporter" : "0", "IO::Handle" : "1.28", "Net::SSLeay" : "1.36", "POE" : "1.267", "Scalar::Util" : "0", "Symbol" : "0", "Task::Weaken" : "1.03", "parent" : "0", "perl" : "5.006", "strict" : "0", "warnings" : "0" } }, "test" : { "recommends" : { "CPAN::Meta" : "2.120900" }, "requires" : { "ExtUtils::MakeMaker" : "0", "File::Spec" : "0", "File::Temp" : "0", "IO::Handle" : "1.28", "IPC::Open3" : "0", "POE" : "1.267", "POE::Component::Client::TCP" : "0", "POE::Component::Server::TCP" : "0", "POE::Filter::Stream" : "0", "Socket" : "0", "Test::FailWarnings" : "0", "Test::More" : "1.001002", "perl" : "5.006" } } }, "provides" : { "POE::Component::SSLify" : { "file" : "lib/POE/Component/SSLify.pm", "version" : "1.012" }, "POE::Component::SSLify::ClientHandle" : { "file" : "lib/POE/Component/SSLify/ClientHandle.pm", "version" : "1.012" }, "POE::Component::SSLify::ServerHandle" : { "file" : "lib/POE/Component/SSLify/ServerHandle.pm", "version" : "1.012" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "mailto" : "bug-poe-component-sslify at rt.cpan.org", "web" : "http://rt.cpan.org/Public/Dist/Display.html?Name=POE-Component-SSLify" }, "homepage" : "https://github.com/apocalypse/perl-poe-sslify", "license" : [ "http://dev.perl.org/licenses/" ], "repository" : { "type" : "git", "url" : "https://github.com/apocalypse/perl-poe-sslify.git", "web" : "https://github.com/apocalypse/perl-poe-sslify" } }, "version" : "1.012", "x_BuiltWith" : { "modules" : { "CPAN::Meta" : "2.142690", "Exporter" : "5.70", "ExtUtils::MakeMaker" : "7.00", "File::Spec" : "3.47", "File::Temp" : "0.2304", "IO::Handle" : "1.34", "IPC::Open3" : "1.13", "Module::Build::Tiny" : "0.039", "Net::SSLeay" : "1.66", "POE" : "1.365", "POE::Component::Client::TCP" : "1.365", "POE::Component::Server::TCP" : "1.365", "POE::Filter::Stream" : "1.365", "Scalar::Util" : "1.41", "Socket" : "2.016", "Symbol" : "1.07", "Task::Weaken" : "1.04", "Test::FailWarnings" : "0.008", "Test::More" : "1.001009", "parent" : "0.228", "strict" : "1.07", "warnings" : "1.18" }, "perl" : { "original" : "v5.18.2", "qv" : 1, "version" : [ 5, 18, 2 ] }, "platform" : "linux", "uname" : "Linux 3.13.0-35-generic x86_64" }, "x_Dist_Zilla" : { "perl" : { "version" : "5.018002" }, "plugins" : [ { "class" : "Dist::Zilla::Plugin::Git::NextVersion", "config" : { "Dist::Zilla::Plugin::Git::NextVersion" : { "first_version" : "0.001", "version_by_branch" : "0", "version_regexp" : "(?^:^release-(.+)$)" }, "Dist::Zilla::Role::Git::Repo" : { "repo_root" : "." } }, "name" : "@Apocalyptic/Git::NextVersion", "version" : "2.025" }, { "class" : "Dist::Zilla::Plugin::Git::GatherDir", "config" : { "Dist::Zilla::Plugin::GatherDir" : { "exclude_filename" : [ "README.pod" ], "exclude_match" : [], "follow_symlinks" : "0", "include_dotfiles" : "1", "prefix" : "", "prune_directory" : [], "root" : "." }, "Dist::Zilla::Plugin::Git::GatherDir" : { "include_untracked" : "0" }, "Dist::Zilla::Role::Git::Repo" : { "repo_root" : "." } }, "name" : "@Apocalyptic/Git::GatherDir", "version" : "2.025" }, { "class" : "Dist::Zilla::Plugin::PruneCruft", "name" : "@Apocalyptic/PruneCruft", "version" : "5.024" }, { "class" : "Dist::Zilla::Plugin::AutoPrereqs", "name" : "@Apocalyptic/AutoPrereqs", "version" : "5.024" }, { "class" : "Dist::Zilla::Plugin::GenerateFile", "name" : "@Apocalyptic/MANIFEST.SKIP", "version" : "5.024" }, { "class" : "Dist::Zilla::Plugin::ManifestSkip", "name" : "@Apocalyptic/ManifestSkip", "version" : "5.024" }, { "class" : "Dist::Zilla::Plugin::Test::Compile", "config" : { "Dist::Zilla::Plugin::Test::Compile" : { "bail_out_on_fail" : "0", "fail_on_warning" : "author", "fake_home" : "1", "filename" : "t/00-compile.t", "module_finder" : [ ":InstallModules" ], "needs_display" : "0", "phase" : "test", "script_finder" : [ ":ExecFiles" ], "skips" : [] } }, "name" : "@Apocalyptic/Test::Compile", "version" : "2.051" }, { "class" : "Dist::Zilla::Plugin::ApocalypseTests", "name" : "@Apocalyptic/ApocalypseTests", "version" : "1.002" }, { "class" : "Dist::Zilla::Plugin::Test::ReportPrereqs", "name" : "@Apocalyptic/Test::ReportPrereqs", "version" : "0.019" }, { "class" : "Dist::Zilla::Plugin::Prepender", "name" : "@Apocalyptic/Prepender", "version" : "1.112280" }, { "class" : "Dist::Zilla::Plugin::Authority", "name" : "@Apocalyptic/Authority", "version" : "1.009" }, { "class" : "Dist::Zilla::Plugin::Git::Describe", "name" : "@Apocalyptic/Git::Describe", "version" : "0.003" }, { "class" : "Dist::Zilla::Plugin::PkgVersion", "name" : "@Apocalyptic/PkgVersion", "version" : "5.024" }, { "class" : "Dist::Zilla::Plugin::PodWeaver", "config" : { "Dist::Zilla::Plugin::PodWeaver" : { "config_plugins" : [ "@Apocalyptic" ], "finder" : [ ":InstallModules", ":ExecFiles" ], "plugins" : [ { "class" : "Pod::Weaver::Plugin::EnsurePod5", "name" : "@CorePrep/EnsurePod5", "version" : "4.006" }, { "class" : "Pod::Weaver::Plugin::H1Nester", "name" : "@CorePrep/H1Nester", "version" : "4.006" }, { "class" : "Pod::Weaver::Plugin::SingleEncoding", "name" : "@Apocalyptic/SingleEncoding", "version" : "4.006" }, { "class" : "Pod::Weaver::Section::Region", "name" : "@Apocalyptic/PodCoverage", "version" : "4.006" }, { "class" : "Pod::Weaver::Plugin::StopWords", "name" : "@Apocalyptic/StopWords", "version" : "1.009" }, { "class" : "Pod::Weaver::Section::Name", "name" : "@Apocalyptic/Name", "version" : "4.006" }, { "class" : "Pod::Weaver::Section::Version", "name" : "@Apocalyptic/Version", "version" : "4.006" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "@Apocalyptic/Synopsis", "version" : "4.006" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "@Apocalyptic/Description", "version" : "4.006" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "@Apocalyptic/Attributes", "version" : "4.006" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "@Apocalyptic/Methods", "version" : "4.006" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "@Apocalyptic/Functions", "version" : "4.006" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "@Apocalyptic/POEvents", "version" : "4.006" }, { "class" : "Pod::Weaver::Section::Leftovers", "name" : "@Apocalyptic/Leftovers", "version" : "4.006" }, { "class" : "Pod::Weaver::Section::SeeAlso", "name" : "@Apocalyptic/SeeAlso", "version" : "1.003" }, { "class" : "Pod::Weaver::Section::Support", "name" : "@Apocalyptic/Support", "version" : "1.006" }, { "class" : "Pod::Weaver::Section::Authors", "name" : "@Apocalyptic/Authors", "version" : "4.006" }, { "class" : "Pod::Weaver::Section::Contributors", "name" : "@Apocalyptic/Contributors", "version" : "0.008" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "@Apocalyptic/ACK", "version" : "4.006" }, { "class" : "Pod::Weaver::Section::Legal", "name" : "@Apocalyptic/Legal", "version" : "4.006" }, { "class" : "Pod::Weaver::Section::WarrantyDisclaimer::GPL3", "name" : "@Apocalyptic/Warranty", "version" : "0.121290" }, { "class" : "Pod::Weaver::Plugin::Transformer", "name" : "@Apocalyptic/ListTransformer", "version" : "4.006" }, { "class" : "Pod::Weaver::Plugin::EnsureUniqueSections", "name" : "@Apocalyptic/UniqueSections", "version" : "0.121550" } ] } }, "name" : "@Apocalyptic/PodWeaver", "version" : "4.006" }, { "class" : "Dist::Zilla::Plugin::NextRelease", "name" : "@Apocalyptic/NextRelease", "version" : "5.024" }, { "class" : "Dist::Zilla::Plugin::ChangelogFromGit", "name" : "@Apocalyptic/ChangelogFromGit", "version" : "0.016" }, { "class" : "Dist::Zilla::Plugin::MinimumPerl", "name" : "@Apocalyptic/MinimumPerl", "version" : "1.006" }, { "class" : "Dist::Zilla::Plugin::Bugtracker", "name" : "@Apocalyptic/Bugtracker", "version" : "1.111080" }, { "class" : "Dist::Zilla::Plugin::MetaConfig", "name" : "@Apocalyptic/MetaConfig", "version" : "5.024" }, { "class" : "Dist::Zilla::Plugin::Git::Contributors", "config" : { "Dist::Zilla::Plugin::Git::Contributors" : { "include_authors" : "0", "include_releaser" : "1", "order_by" : "name", "paths" : [] } }, "name" : "@Apocalyptic/Git::Contributors", "version" : "0.008" }, { "class" : "Dist::Zilla::Plugin::MetaData::BuiltWith", "config" : { "Dist::Zilla::Plugin::MetaData::BuiltWith" : { "_stash_key" : "x_BuiltWith", "show_config" : "0", "show_uname" : "1", "uname" : { "uname_args" : [ "-s", "-r", "-m" ], "uname_call" : "uname" } } }, "name" : "@Apocalyptic/MetaData::BuiltWith", "version" : "1.003001" }, { "class" : "Dist::Zilla::Plugin::GithubMeta", "name" : "@Apocalyptic/GithubMeta", "version" : "0.46" }, { "class" : "Dist::Zilla::Plugin::MetaResources", "name" : "@Apocalyptic/MetaResources", "version" : "5.024" }, { "class" : "Dist::Zilla::Plugin::Metadata", "name" : "@Apocalyptic/Metadata", "version" : "3.03" }, { "class" : "Dist::Zilla::Plugin::MetaNoIndex", "name" : "@Apocalyptic/MetaNoIndex", "version" : "5.024" }, { "class" : "Dist::Zilla::Plugin::MetaProvides::Package", "config" : { "Dist::Zilla::Plugin::MetaProvides::Package" : { "finder_objects" : [ { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : "@Apocalyptic/MetaProvides::Package/AUTOVIV/:InstallModulesPM", "version" : "5.024" } ] }, "Dist::Zilla::Role::MetaProvider::Provider" : { "inherit_missing" : "1", "inherit_version" : "1", "meta_noindex" : "1" } }, "name" : "@Apocalyptic/MetaProvides::Package", "version" : "2.001002" }, { "class" : "Dist::Zilla::Plugin::License", "name" : "@Apocalyptic/License", "version" : "5.024" }, { "class" : "Dist::Zilla::Plugin::ModuleBuildTiny", "config" : { "Dist::Zilla::Role::TestRunner" : { "default_jobs" : 1 } }, "name" : "@Apocalyptic/ModuleBuildTiny", "version" : "0.008" }, { "class" : "Dist::Zilla::Plugin::MakeMaker::Fallback", "config" : { "Dist::Zilla::Role::TestRunner" : { "default_jobs" : 1 } }, "name" : "@Apocalyptic/MakeMaker::Fallback", "version" : "0.014" }, { "class" : "Dist::Zilla::Plugin::MetaYAML", "name" : "@Apocalyptic/MetaYAML", "version" : "5.024" }, { "class" : "Dist::Zilla::Plugin::MetaJSON", "name" : "@Apocalyptic/MetaJSON", "version" : "5.024" }, { "class" : "Dist::Zilla::Plugin::InstallGuide", "name" : "@Apocalyptic/InstallGuide", "version" : "1.200005" }, { "class" : "Dist::Zilla::Plugin::DOAP", "name" : "@Apocalyptic/DOAP", "version" : "0.003" }, { "class" : "Dist::Zilla::Plugin::Covenant", "name" : "@Apocalyptic/Covenant", "version" : "0.1.0" }, { "class" : "Dist::Zilla::Plugin::CPANFile", "name" : "@Apocalyptic/CPANFile", "version" : "5.024" }, { "class" : "Dist::Zilla::Plugin::ReadmeAnyFromPod", "name" : "@Apocalyptic/ReadmeAnyFromPod", "version" : "0.142470" }, { "class" : "Dist::Zilla::Plugin::ReadmeAnyFromPod", "name" : "@Apocalyptic/pod for github", "version" : "0.142470" }, { "class" : "Dist::Zilla::Plugin::ChangeStats::Git", "name" : "@Apocalyptic/ChangeStats::Git", "version" : "0.3.0" }, { "class" : "Dist::Zilla::Plugin::Signature", "name" : "@Apocalyptic/Signature", "version" : "1.100930" }, { "class" : "Dist::Zilla::Plugin::Manifest", "name" : "@Apocalyptic/Manifest", "version" : "5.024" }, { "class" : "Dist::Zilla::Plugin::CheckChangesHasContent", "name" : "@Apocalyptic/CheckChangesHasContent", "version" : "0.007" }, { "class" : "Dist::Zilla::Plugin::Git::Check", "config" : { "Dist::Zilla::Plugin::Git::Check" : { "untracked_files" : "die" }, "Dist::Zilla::Role::Git::DirtyFiles" : { "allow_dirty" : [ "README.pod", "Changes" ], "allow_dirty_match" : [], "changelog" : "Changes" }, "Dist::Zilla::Role::Git::Repo" : { "repo_root" : "." } }, "name" : "@Apocalyptic/Git::Check", "version" : "2.025" }, { "class" : "Dist::Zilla::Plugin::Git::CheckFor::CorrectBranch", "config" : { "Dist::Zilla::Role::Git::Repo" : { "repo_root" : "." } }, "name" : "@Apocalyptic/Git::CheckFor::CorrectBranch", "version" : "0.011" }, { "class" : "Dist::Zilla::Plugin::Git::CheckFor::MergeConflicts", "config" : { "Dist::Zilla::Role::Git::Repo" : { "repo_root" : "." } }, "name" : "@Apocalyptic/Git::CheckFor::MergeConflicts", "version" : "0.011" }, { "class" : "Dist::Zilla::Plugin::Git::Remote::Check", "name" : "@Apocalyptic/Git::Remote::Check", "version" : "0.1.2" }, { "class" : "Dist::Zilla::Plugin::PromptIfStale", "config" : { "Dist::Zilla::Plugin::PromptIfStale" : { "check_all_plugins" : "1", "check_all_prereqs" : "1", "modules" : [], "phase" : "release", "skip" : [] } }, "name" : "@Apocalyptic/PromptIfStale", "version" : "0.029" }, { "class" : "Dist::Zilla::Plugin::TestRelease", "name" : "@Apocalyptic/TestRelease", "version" : "5.024" }, { "class" : "Dist::Zilla::Plugin::CheckPrereqsIndexed", "name" : "@Apocalyptic/CheckPrereqsIndexed", "version" : "0.012" }, { "class" : "Dist::Zilla::Plugin::CheckSelfDependency", "config" : { "Dist::Zilla::Plugin::CheckSelfDependency" : { "finder" : [ ":InstallModules" ] } }, "name" : "@Apocalyptic/CheckSelfDependency", "version" : "0.007" }, { "class" : "Dist::Zilla::Plugin::CheckIssues", "name" : "@Apocalyptic/CheckIssues", "version" : "0.004" }, { "class" : "Dist::Zilla::Plugin::ConfirmRelease", "name" : "@Apocalyptic/ConfirmRelease", "version" : "5.024" }, { "class" : "Dist::Zilla::Plugin::UploadToCPAN", "name" : "@Apocalyptic/UploadToCPAN", "version" : "5.024" }, { "class" : "Dist::Zilla::Plugin::ArchiveRelease", "name" : "@Apocalyptic/ArchiveRelease", "version" : "4.00" }, { "class" : "Dist::Zilla::Plugin::Git::Commit", "config" : { "Dist::Zilla::Plugin::Git::Commit" : { "add_files_in" : [ "releases" ], "commit_msg" : "New CPAN release of %N - v%v%n%n%c", "time_zone" : "UTC" }, "Dist::Zilla::Role::Git::DirtyFiles" : { "allow_dirty" : [ "README.pod", "Changes" ], "allow_dirty_match" : [], "changelog" : "Changes" }, "Dist::Zilla::Role::Git::Repo" : { "repo_root" : "." } }, "name" : "@Apocalyptic/Git::Commit", "version" : "2.025" }, { "class" : "Dist::Zilla::Plugin::Git::Tag", "config" : { "Dist::Zilla::Plugin::Git::Tag" : { "branch" : null, "signed" : 0, "tag" : "release-1.012", "tag_format" : "release-%v", "tag_message" : "Tagged release-%v", "time_zone" : "local" }, "Dist::Zilla::Role::Git::Repo" : { "repo_root" : "." } }, "name" : "@Apocalyptic/Git::Tag", "version" : "2.025" }, { "class" : "Dist::Zilla::Plugin::Git::Push", "config" : { "Dist::Zilla::Plugin::Git::Push" : { "push_to" : [ "origin", "bitbucket" ], "remotes_must_exist" : 1 }, "Dist::Zilla::Role::Git::Repo" : { "repo_root" : "." } }, "name" : "@Apocalyptic/Git::Push", "version" : "2.025" }, { "class" : "Dist::Zilla::Plugin::GitHub::Update", "name" : "@Apocalyptic/GitHub::Update", "version" : "0.38" }, { "class" : "Dist::Zilla::Plugin::Bitbucket::Update", "name" : "@Apocalyptic/Bitbucket::Update", "version" : "0.001" }, { "class" : "Dist::Zilla::Plugin::Clean", "name" : "@Apocalyptic/Clean", "version" : "0.07" }, { "class" : "Dist::Zilla::Plugin::SchwartzRatio", "name" : "@Apocalyptic/SchwartzRatio", "version" : "0.2.0" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":InstallModules", "version" : "5.024" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":IncModules", "version" : "5.024" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":TestFiles", "version" : "5.024" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExecFiles", "version" : "5.024" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ShareFiles", "version" : "5.024" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":MainModule", "version" : "5.024" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":AllFiles", "version" : "5.024" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":NoFiles", "version" : "5.024" }, { "class" : "Dist::Zilla::Plugin::VerifyPhases", "name" : "@Apocalyptic/VerifyPhases", "version" : "0.006" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : "@Apocalyptic/MetaProvides::Package/AUTOVIV/:InstallModulesPM", "version" : "5.024" } ], "zilla" : { "class" : "Dist::Zilla::Dist::Builder", "config" : { "is_trial" : "0" }, "version" : "5.024" } }, "x_IRC" : { "url" : "irc://irc.perl.org/#perl-help", "web" : "https://chat.mibbit.com/?channel=%23perl-help&server=irc.perl.org" }, "x_author_pledge" : { "version" : 1 }, "x_authority" : "cpan:APOCAL" } POE-Component-SSLify-1.012/doap.xml0000644000175000017500000000210012431461761015340 0ustar apocapoc POE-Component-SSLify Makes using SSL in the world of POE easy! Apocalypse Perl