Codebase list libnet-sslglue-perl / 455a9aa
Merge commit 'upstream/0.8' Dominic Hargreaves 12 years ago
6 changed file(s) with 49 addition(s) and 34 deletion(s). Raw diff Collapse all Expand all
0 0.8 2011/07/17
1 fixed wrong position for include encode_base64 and uri_unescape in *::LWP.
2 Thanks to mtelle[AT]kamp-dsl[DOT]de for reporting
3
4 0.7 2011/05/27
5 strip port from host/ip for name verification in Net::SSLGlue::SMTP
6
7 0.6 2011/05/02
8 fixed english, thanks to dom, https://rt.cpan.org/Ticket/Display.html?id=46284
9
010 0.5 2011/02/03
111 documentation fixes: http://rt.cpan.org/Ticket/Display.html?id=65258
212
00 --- #YAML:1.0
11 name: Net-SSLGlue
2 version: 0.5
2 version: 0.8
33 abstract: ~
44 author: []
55 license: unknown
1414 directory:
1515 - t
1616 - inc
17 generated_by: ExtUtils::MakeMaker version 6.54
17 generated_by: ExtUtils::MakeMaker version 6.55_02
1818 meta-spec:
1919 url: http://module-build.sourceforge.net/META-spec-v1.4.html
2020 version: 1.4
4242 L<Net::SSLGlue::LDAP> modifies L<Net::LDAP> so that it does proper certificate
4343 checking using the C<ldap> SSL_verify_scheme from L<IO::Socket::SSL>.
4444
45 Because L<Net::LDAP> does not have a mechanism to forward arbitrary parameter for
45 Because L<Net::LDAP> does not have a mechanism to forward arbitrary parameters for
4646 the construction of the underlying socket these parameters can be set globally
47 when including the package or with local settings of the
47 when including the package, or with local settings of the
4848 C<%Net::SSLGlue::LDAP::SSLopts> variable.
4949
50 All of the C<SSL_*> parameter from L<IO::Socket::SSL> can be used, especially
51 the following parameter is useful:
50 All of the C<SSL_*> parameters from L<IO::Socket::SSL> can be used; the
51 following parameter is especially useful:
5252
5353 =over 4
5454
5656
5757 Usually the name given as the hostname in the constructor is used to verify the
5858 identity of the certificate. If you want to check the certificate against
59 another name you might specify it with this parameter.
59 another name you can specify it with this parameter.
6060
6161 =back
6262
00 use strict;
11 use warnings;
22 package Net::SSLGlue::LWP;
3 our $VERSION = 0.3;
3 our $VERSION = 0.4;
44 use LWP::UserAgent '5.822';
55 use IO::Socket::SSL 1.19;
6 use URI::Escape 'uri_unescape';
7 use MIME::Base64 'encode_base64';
86 use URI;
97
108 # force Net::SSLGlue::LWP::Socket as superclass of Net::HTTPS, because
6664 use IO::Socket::SSL;
6765 use base 'IO::Socket::SSL';
6866 my $sockclass = 'IO::Socket::INET';
67 use URI::Escape 'uri_unescape';
68 use MIME::Base64 'encode_base64';
6969 $sockclass .= '6' if eval "require IO::Socket::INET6";
7070
7171 sub configure {
159159 =head1 DESCRIPTION
160160
161161 L<Net::SSLGlue::LWP> modifies L<Net::HTTPS> and L<LWP::Protocol::https> so that
162 L<Net::HTTPS> is forced to use L<IO::Socket::SSL> instead of L<Crypt::SSLeay>
162 L<Net::HTTPS> is forced to use L<IO::Socket::SSL> instead of L<Crypt::SSLeay>,
163163 and that L<LWP::Protocol::https> does proper certificate checking using the
164164 C<http> SSL_verify_scheme from L<IO::Socket::SSL>.
165165
166 Because L<LWP> does not have a mechanism to forward arbitrary parameter for
166 Because L<LWP> does not have a mechanism to forward arbitrary parameters for
167167 the construction of the underlying socket these parameters can be set globally
168 when including the package or with local settings of the
168 when including the package, or with local settings of the
169169 C<%Net::SSLGlue::LWP::SSLopts> variable.
170170
171 All of the C<SSL_*> parameter from L<IO::Socket::SSL> can be used, especially
172 the following parameters are useful:
171 All of the C<SSL_*> parameter from L<IO::Socket::SSL> can be used; the
172 following parameters are especially useful:
173173
174174 =over 4
175175
176176 =item SSL_ca_path, SSL_ca_file
177177
178178 Specifies the path or a file where the CAs used for checking the certificates
179 are located. Typical for UNIX systems is L</etc/ssl/certs>.
179 are located. This is typically L</etc/ssl/certs> on UNIX systems.
180180
181181 =item SSL_verify_mode
182182
183 If set to 0 disabled verification of the certificate. By default it is 1 which
184 means, that the peer certificate is checked.
183 If set to 0, verification of the certificate will be disabled. By default
184 it is set to 1 which means that the peer certificate is checked.
185185
186186 =item SSL_verifycn_name
187187
188188 Usually the name given as the hostname in the constructor is used to verify the
189189 identity of the certificate. If you want to check the certificate against
190 another name you might specify it with this parameter.
190 another name you can specify it with this parameter.
191191
192192 =back
193193
33 package Net::SSLGlue::SMTP;
44 use IO::Socket::SSL 1.19;
55 use Net::SMTP;
6 our $VERSION = 0.5;
6 our $VERSION = 0.7;
77
88 ##############################################################################
99 # mix starttls method into Net::SMTP which on SSL handshake success
1212 sub Net::SMTP::starttls {
1313 my $self = shift;
1414 $self->_STARTTLS or return;
15 my $host = ${*$self}{net_smtp_host};
16 # for name verification strip port from domain:port, ipv4:port, [ipv6]:port
17 $host =~s{^(?:[^:]+|.+\])\:(\d+)$}{};
18
1519 Net::SMTP::_SSLified->start_SSL( $self,
1620 SSL_verify_mode => 1,
1721 SSL_verifycn_scheme => 'smtp',
18 SSL_verifycn_name => ${*$self}{net_smtp_host},
22 SSL_verifycn_name => $host,
1923 @_
2024 );
2125 }
120124
121125 =head1 DESCRIPTION
122126
123 L<Net::SSLGlue::SMTP> expands L<Net::SMTP> so one can either start directly with SSL
127 L<Net::SSLGlue::SMTP> extends L<Net::SMTP> so one can either start directly with SSL
124128 or switch later to SSL using the STARTTLS command.
125129
126 By default it will take care to verfify the certificate according to the rules
130 By default it will take care to verify the certificate according to the rules
127131 for SMTP implemented in L<IO::Socket::SSL>.
128132
129133 =head1 METHODS
152156 =back
153157
154158 All of these methods can take the C<SSL_*> parameter from L<IO::Socket::SSL> to
155 change the behavior of the SSL connection. Especially the following parameter
156 are useful:
159 change the behavior of the SSL connection. The following parameters are
160 especially useful:
157161
158162 =over 4
159163
160164 =item SSL_ca_path, SSL_ca_file
161165
162166 Specifies the path or a file where the CAs used for checking the certificates
163 are located. Typical for UNIX systems is L</etc/ssl/certs>.
167 are located. This is typically L</etc/ssl/certs> on UNIX systems.
164168
165169 =item SSL_verify_mode
166170
167 If set to 0 disabled verification of the certificate. By default it is 1 which
168 means, that the peer certificate is checked.
171 If set to 0, verification of the certificate will be disabled. By default
172 it is set to 1 which means that the peer certificate is checked.
169173
170174 =item SSL_verifycn_name
171175
172176 Usually the name given as the hostname in the constructor is used to verify the
173177 identity of the certificate. If you want to check the certificate against
174 another name you might specify it with this parameter.
178 another name you can specify it with this parameter.
175179
176180 =back
177181
00 package Net::SSLGlue;
1 our $VERSION = 0.5;
1 our $VERSION = 0.8;
22
33 =head1 NAME
44
77 =head1 DESCRIPTION
88
99 Some commonly used perl modules don't have SSL support at all, even if the
10 protocol would support it. Others have SSL support, but most of them don't do
11 proper checking of the servers certificate.
10 protocol supports it. Others have SSL support, but most of them don't do
11 proper checking of the server's certificate.
1212
13 The C<Net::SSLGlue::*> modules try to add SSL support or proper certificate to
14 these modules. Currently is support for the following modules available:
13 The C<Net::SSLGlue::*> modules try to add SSL support or proper certificate
14 checking to these modules. Currently support for the following modules is
15 available:
1516
1617 =over 4
1718