dnssec-sign
changeset 32 d1addc2ec712
parent 31 1cea07056124
child 33 d3269961e944
equal deleted inserted replaced
31:1cea07056124 32:d1addc2ec712
    39 my $zone;
    39 my $zone;
    40 my ( @manu, @auto );
    40 my ( @manu, @auto );
    41 my @zone_sig_content;
    41 my @zone_sig_content;
    42 my $sig_date;
    42 my $sig_date;
    43 my $kc;
    43 my $kc;
       
    44 my $serial_up = 0;
       
    45 
       
    46 for (@ARGV) {
       
    47     if ( $_ eq "-s" ) {
       
    48         $serial_up = 1;
       
    49         shift @ARGV;
       
    50     }
       
    51 }
    44 
    52 
    45 # prueft zonen aus ARGV und fuegt sie in die liste @manu ein
    53 # prueft zonen aus ARGV und fuegt sie in die liste @manu ein
    46 for (@ARGV) {
    54 for (@ARGV) {
    47     chomp( my $zone = `idn --quiet "$_"` );
    55     chomp( my $zone = `idn --quiet "$_"` );
    48 
    56 
    49     if ( -e "$master_dir/$zone" ) {
    57     if ( -e "$master_dir/$zone/.keycounter" ) {
    50         push @manu, $zone;
    58         push @manu, $zone;
    51     }
       
    52     else {
       
    53         print "$zone ist keine verwaltete zone \n";
       
    54     }
    59     }
    55 }
    60 }
    56 
    61 
    57 chomp( my $unixtime = `date +%s` );
    62 chomp( my $unixtime = `date +%s` );
    58 $unixtime = $unixtime + ( 3600 * $sign_alert_time );
    63 $unixtime = $unixtime + ( 3600 * $sign_alert_time );
    97             push @auto, $zone;
   102             push @auto, $zone;
    98         }
   103         }
    99     }
   104     }
   100 }
   105 }
   101 
   106 
       
   107 #erhoeht den serial der zone 
       
   108 for ( &del_double( @auto, @manu ) ) {
       
   109     unless ($serial_up == 1) {
       
   110         last
       
   111     }
       
   112 
       
   113     $zone = $_;
       
   114     my @zonefile = ();
       
   115     my $serial;
       
   116 
       
   117     open ( ZONEFILE, "$master_dir/$zone/$zone")
       
   118         or die "$master_dir/$zone/$zone: $!\n";
       
   119     @zonefile = <ZONEFILE>;
       
   120     close (ZONEFILE);
       
   121 
       
   122     for (@zonefile) {
       
   123         if (m#([0-9]{10}).*;.*serial#) {
       
   124             $serial = $1 + 1;
       
   125             s#(.*)([0-9]{10})(.*)#$1$serial$3#;
       
   126         }
       
   127     }
       
   128 
       
   129     open ( ZONEFILE, ">$master_dir/$zone/$zone")
       
   130         or die "$master_dir/$zone/$zone: $!\n";
       
   131     print ZONEFILE @zonefile;
       
   132     close (ZONEFILE);
       
   133 }
       
   134 
   102 # signiert alle zonen in @auto und @manu und erhoeht den wert in
   135 # signiert alle zonen in @auto und @manu und erhoeht den wert in
   103 # der keycounter-datei
   136 # der keycounter-datei
   104 for ( &del_double( @auto, @manu ) ) {
   137 for ( &del_double( @auto, @manu ) ) {
   105     $zone = $_;
   138     $zone = $_;
   106 
   139