Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client Cert Support #9

Merged
merged 1 commit into from
May 27, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Revision history for Perl extension POE::Component::IRC.
- BotCommand: Adapted the Help Callback Options so it gets the Command and Arguments
- BotCommand: Added Support for Command Aliases
- BotCommand: Allowed No Arguments/Only Variable Arguments
- Implemented SSL Client Cert Support

6.82 Sat Mar 9 22:15:02 GMT 2013
- Add the Prefix to the "Syntax:" line of the command help
Expand Down
29 changes: 26 additions & 3 deletions lib/POE/Component/IRC.pm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ our ($GOT_SSL, $GOT_CLIENT_DNS, $GOT_SOCKET6, $GOT_ZLIB);
BEGIN {
eval {
require POE::Component::SSLify;
import POE::Component::SSLify qw( Client_SSLify );
import POE::Component::SSLify qw( Client_SSLify SSLify_ContextCreate );
$GOT_SSL = 1;
};
eval {
Expand Down Expand Up @@ -346,11 +346,26 @@ sub _sock_up {
# ssl!
if ($GOT_SSL and $self->{usessl}) {
eval {
$socket = Client_SSLify($socket);
my ($ctx);

if( $self->{sslctx} )
{
$ctx = $self->{sslctx};
}
elsif( $self->{sslkey} && $self->{sslcert} )
{
$ctx = SSLify_ContextCreate( $self->{sslkey}, $self->{sslcert} );
}
else
{
$ctx = undef;
}

$socket = Client_SSLify($socket, undef, undef, $ctx);
};

if ($@) {
chomp $@;
chomp $@;
warn "Couldn't use an SSL socket: $@\n";
$self->{usessl} = 0;
}
Expand Down Expand Up @@ -1703,6 +1718,14 @@ be used.
=item * B<'UseSSL'>, set to some true value if you want to connect using
SSL.

=item * B<'SSLCert'>, set to a SSL Certificate(PAM encoded) to connect using a client cert

=item * B<'SSLKey'>, set to a SSL Key(PAM encoded) to connect using a client cert

=item * B<'SSLCtx'>, set to a SSL Context to configure the SSL Connection

The B<'SSLCert'> and B<'SSLKey'> both need to be specified. The B<'SSLCtx'> takes precedence specified.

=item * B<'Raw'>, set to some true value to enable the component to send
L<C<irc_raw>|/irc_raw> and L<C<irc_raw_out>|/irc_raw_out> events.

Expand Down