Created
May 22, 2013 08:06
-
-
Save CLCL/5625992 to your computer and use it in GitHub Desktop.
指定したURLにSSLアクセスして、SSL通信が自己署名証明書(オレオレ証明書)かどうかざっくり調べる。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use LWP::UserAgent; | |
my $url = 'https://www.verisign.co.jp/'; | |
my $ua = LWP::UserAgent->new( ssl_opts => { verify_hostname => 0 } ) or die $!; | |
my $res = $ua->head( $url ) or die $!; | |
if ( $res->header("client-ssl-cert-issuer") eq $res->header("client-ssl-cert-subject") ) { | |
print "SSL証明書が自己署名証明書(オレオレ証明書)です。\n"; | |
} | |
else { | |
print "SSL証明書が自己署名証明書ではないような気がします……\n"; | |
} | |
exit; | |
__END__ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment