memo.xight.org

/ / memo.xight.org

2006-11-25

Net::SSL::ExpireDate + Test::Base で証明書の期限切れをチェック

- Summary
Net::SSL::ExpireDateTest::Baseを用いて,SSL証明書の期限切れをチェック.

#!/usr/bin/env perl
# -*- mode: cperl; -*-
use Test::Base;
use Net::SSL::ExpireDate;
use Regexp::Common qw(net);
 
my $Check_Duration;
# $Check_Duration = '15 years';
 
plan tests => 1 * blocks;
 
run {
    my $block = shift;
    my $ed = Net::SSL::ExpireDate->new( build_arg($block->name) );
    is($ed->is_expired($Check_Duration) && $ed->expire_date->iso8601,
        undef,
        $block->name);
};
 
sub build_arg {
    my ($v) = @_;
    if ($v =~ m{^(file)://(.+)}) {
        return $1 => $2;
    } elsif ($v =~ m{^(https)://([^/]+)}) {
        return $1 => $2;
    } elsif ($v =~ m{^$RE{net}{domain}{-nospace}{-keep}$}) {
        return 'https' => $1;
    } elsif (-r $v) {
        return 'file' => $v;
    } else {
        croak "$v: assume file. but cannot read.";
    }
}
 
__END__
=== rt.cpan.org
=== www.google.com


- Reference
(ひ)メモ - Net::SSL::ExpireDate + Test::Base で証明書の期限切れをチェック
http://d.hatena.ne.jp/hirose31/20061121/1164042331

- via
オレンジニュース - 2006-11-21
http://secure.ddo.jp/~kaku/tdiary/20061121.html#p10
カテゴリ: [Perl]
2006-11 /

Color Reference

ChangeLogを検索
携帯電話からアクセス!

カテゴリ

最近の話題

リンク

過去ログ

Google

QR Code

Since
2002-11-28
Update
2008-12-02 10:52
Copyright © 2005 xight.org All Rights Reserved.