| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
=pod |
| 5 |
|
| 6 |
=head1 NAME |
| 7 |
|
| 8 |
imap_ssl_cert - connects to an IMAP server using SSL and saves the server certificate into a .pem file |
| 9 |
|
| 10 |
=head1 SYNOPSIS |
| 11 |
|
| 12 |
imap_ssl_cert -H imap.server.com > server_ca_file.pem |
| 13 |
imap_ssl_cert -? |
| 14 |
imap_ssl_cert --help |
| 15 |
|
| 16 |
=head1 DEPENDENCIES |
| 17 |
|
| 18 |
This utility requires the following perl modules to be installed: |
| 19 |
|
| 20 |
Getopt::Long |
| 21 |
Mail::IMAPClient |
| 22 |
IO::Socket::SSL |
| 23 |
Net::SSLeay |
| 24 |
|
| 25 |
=head1 OPTIONS |
| 26 |
|
| 27 |
=over |
| 28 |
|
| 29 |
=item --timeout <seconds> |
| 30 |
|
| 31 |
Abort with critical status if it takes longer than <seconds> to connect to the IMAP server. Default is 60 seconds. |
| 32 |
The difference between timeout and critical is that, with the default settings, if it takes 45 seconds to |
| 33 |
connect to the server then the connection will succeed but the plugin will return CRITICAL because it took longer |
| 34 |
than 30 seconds. |
| 35 |
Also known as: -t <seconds> |
| 36 |
|
| 37 |
=item --hostname <server> |
| 38 |
|
| 39 |
Address or name of the IMAP server. Examples: mail.server.com, localhost, 192.168.1.100 |
| 40 |
Also known as: -H <server> |
| 41 |
|
| 42 |
=item --port <number> |
| 43 |
|
| 44 |
Service port on the IMAP server. Default is 143. If you use SSL, default is 993. |
| 45 |
Also known as: -p <number> |
| 46 |
|
| 47 |
=item --verbose |
| 48 |
|
| 49 |
Display additional information. Useful for troubleshooting. |
| 50 |
|
| 51 |
Also known as: -v |
| 52 |
|
| 53 |
=item --version |
| 54 |
|
| 55 |
Display plugin version and exit. |
| 56 |
Also known as: -V |
| 57 |
|
| 58 |
=item --help |
| 59 |
|
| 60 |
Display this documentation and exit. |
| 61 |
Also known as: -h |
| 62 |
|
| 63 |
=item --usage |
| 64 |
|
| 65 |
Display a short usage instruction and exit. |
| 66 |
|
| 67 |
=back |
| 68 |
|
| 69 |
=head1 EXAMPLES |
| 70 |
|
| 71 |
=head2 Print the server's SSL certificate chain |
| 72 |
|
| 73 |
$ perl imap_ssl_cert.pl -H imap.server.com > ca_file.pem |
| 74 |
$ cat ca_file.pem |
| 75 |
|
| 76 |
-----BEGIN CERTIFICATE----- |
| 77 |
MIID1zCCAr+gAwIBAgIQPr3bVk0SkuXygjxgA7EVGDANBgkqhkiG9w0BAQUFADA8 |
| 78 |
[...snip...] |
| 79 |
0FF4warjskrfqaVtWeIV58LJheaM4cPJkc2M |
| 80 |
-----END CERTIFICATE----- |
| 81 |
|
| 82 |
$ openssl x509 -in ca_file.pem -text |
| 83 |
|
| 84 |
|
| 85 |
=head1 SEE ALSO |
| 86 |
|
| 87 |
http://en.wikipedia.org/wiki/X.509 |
| 88 |
http://en.wikipedia.org/wiki/Privacy_Enhanced_Mail |
| 89 |
http://tools.ietf.org/html/rfc1422 |
| 90 |
http://search.cpan.org/~mikem/Net-SSLeay-1.42/lib/Net/SSLeay.pm |
| 91 |
http://search.cpan.org/~plobbes/Mail-IMAPClient-3.29/lib/Mail/IMAPClient.pod |
| 92 |
|
| 93 |
=head1 CHANGES |
| 94 |
|
| 95 |
Fri Nov 11 03:38:13 AST 2011 |
| 96 |
+ version 0.1 |
| 97 |
|
| 98 |
=head1 AUTHOR |
| 99 |
|
| 100 |
Jonathan Buhacoff <[email protected]> |
| 101 |
|
| 102 |
=head1 COPYRIGHT AND LICENSE |
| 103 |
|
| 104 |
Copyright (C) 2011 Jonathan Buhacoff |
| 105 |
|
| 106 |
This program is free software; you can redistribute it and/or modify |
| 107 |
it under the terms of the GNU General Public License as published by |
| 108 |
the Free Software Foundation; either version 3 of the License, or |
| 109 |
(at your option) any later version. |
| 110 |
|
| 111 |
This program is distributed in the hope that it will be useful, |
| 112 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 113 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 114 |
GNU General Public License for more details. |
| 115 |
|
| 116 |
You should have received a copy of the GNU General Public License |
| 117 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 118 |
|
| 119 |
http://www.gnu.org/licenses/gpl.txt |
| 120 |
|
| 121 |
=cut |
| 122 |
|