Changeset 11734 for lang/perl/Punc

Show
Ignore:
Timestamp:
05/17/08 14:22:06 (6 months ago)
Author:
mizzy
Message:

自動署名に対応

Location:
lang/perl/Punc/trunk
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/Punc/trunk

    • Property svn:ignore
      •  

        old new  
        11META.yml 
         2Makefile 
        23Makefile.old 
        34_Inline 
  • lang/perl/Punc/trunk/Makefile.PL

    r11104 r11734  
    2121                       Moose 
    2222                       MooseX::ClassAttribute 
     23                       Class::ErrorHandler 
    2324                   /); 
    2425 
  • lang/perl/Punc/trunk/bin/puncmasterd

    r10103 r11734  
    99use Punc::Master::Daemon; 
    1010use Getopt::Long; 
     11use Punc::ConfigLoader; 
    1112 
    1213GetOptions( 
    13     '--port=i'    => \my $port, 
    14     '--confdir=s' => \my $confdir, 
     14    '--port=i'     => \my $port, 
     15    '--confdir=s'  => \my $confdir, 
     16    '--autosign=s' => \my $autosign, 
    1517); 
    1618 
     
    1820$confdir ||= "$FindBin::Bin/../etc"; 
    1921 
     22my $yaml = File::Spec->catfile($confdir, 'puncmasterd.yaml'); 
     23 
     24my $conf = -f $yaml ? Punc::ConfigLoader->new->load($yaml) : {}; 
     25$conf->{autosign} ||= $autosign; 
     26 
    2027my $daemon = Punc::Master::Daemon->new({ 
    2128    port    => $port, 
    2229    confdir => $confdir, 
    2330    context => Punc->new->context, 
     31    conf    => $conf, 
    2432}); 
    2533 
  • lang/perl/Punc/trunk/lib/Punc/Master/Daemon.pm

    r11518 r11734  
    8686    $self->{ca}->save_csr($csr); 
    8787 
    88     ### TODO: 自動署名 
    89     while ( 1 ) { 
    90         last if $self->{ca}->is_signed($csr); 
    91         sleep 1; 
     88    my $autosign = $self->{conf}->{autosign} || ''; 
     89    $autosign =~ s/\*/\.\*/g; 
     90    if ( $hostname =~ /$autosign/ ) { 
     91        $self->{ca}->sign($hostname); 
     92    } 
     93    else { 
     94        while ( 1 ) { 
     95            last if $self->{ca}->is_signed($csr); 
     96            sleep 1; 
     97        } 
    9298    } 
    9399