[merge] from default branch hs12
authorHeiko Schlittermann <hs@schlittermann.de>
Thu, 23 Dec 2010 23:59:27 +0100
branchhs12
changeset 53 291588cb5e84
parent 50 3b469e9bda9e (current diff)
parent 52 53c95f2ff0ac (diff)
child 54 bba32c45a832
[merge] from default branch
dnssec-keytool.pl
update-serial.pl
--- a/dnssec-keytool.pl	Tue Dec 21 16:58:25 2010 +0100
+++ b/dnssec-keytool.pl	Thu Dec 23 23:59:27 2010 +0100
@@ -6,7 +6,7 @@
 
 sub read_conf {
 
-    # liest die Konfiguration ein
+    # read configuration
     my @configs = ("$FindBin::Bin/dnstools.conf", "/etc/dnstools.conf");
     our %config;
 
@@ -30,8 +30,7 @@
 }
 
 sub read_argv {
-
-    # wertet argv aus oder gibt die hilfe aus
+    # evaluate argv or print the help
     my $arg = shift @ARGV;
     my $zone;
     our $do;
@@ -40,11 +39,11 @@
 
     if (!defined $arg) {
         print " usage: dnssec-keytool <option> zone\n";
-        print "   -z  erstellt einen neuen ZSK\n";
-        print "   -k  erstellt je einen neuen ZSK und KSK\n";
-        print "   -rm loescht das Schluesselmaterial einer Zone\n";
-        print "   -c  erstellt bei existierenden ksk konfigurationsdateien\n";
-        print "       fuer die dnstools, sowie einen neuen zsk\n";
+        print "   -z  created a new ZSK\n";
+        print "   -k  created a new ZSK and KSK\n";
+        print "   -rm deletes the key-set of a zone\n";
+        print "   -c  created configuration files for the dnstools\n";
+        print "       and a new ZSK for an existing KSK\n";
         print "\n";
 
         exit;
@@ -54,11 +53,11 @@
     elsif ($arg eq "-c")  { $do = "ck"; }
     elsif ($arg eq "-z")  { $do = "zsk"; }
     else {
-        print "keine gueltige Option.\n";
+        print "not a valid option.\n";
         exit;
     }
 
-    # prueft die zonen in argv ob es verwaltete zonen sind
+    # checks the zones in argv if there are managed zones
     for (@ARGV) {
         chomp($zone = `idn --quiet "$_"`);
         if (-e "$master_dir/$zone/$zone") {
@@ -68,6 +67,7 @@
 }
 
 sub rm_keys {
+    # deletes all the keys were handed over -rm in argv
     our @zones;
     our $master_dir;
     my $zone;
@@ -99,14 +99,13 @@
             unlink "$zpf/keyset-$zone." and $ep = 1;
         }
 
-        for (`ls $zpf/K$zone*`) {
+        for (glob("$zpf/K$zone*")) { 
             chomp($_);
-            print "weg du scheissezwerg $_";
-            unlink("$_");
+            unlink ("$_");
         }
 
         if ($ep == 1) {
-            print " * $zone: schluesselmaterial entfernt\n";
+            print " * $zone: removed key-set\n";
         }
 
         open(ZONE, "$zpf/$zone")
@@ -156,9 +155,9 @@
         close(INDEX);
 
         chomp($keyname);
-        print " * $zone: neuer KSK $keyname\n";
+        print " * $zone: new KSK $keyname\n";
 
-        print "!! DER KSK muss der Chain of Trust veroeffentlicht werden !! \n";
+        print "!! THE KSK must be published !! \n";
 
     }
 }
@@ -193,7 +192,7 @@
         close(INDEX);
 
         chomp($keyname);
-        print " * $zone: neuer ZSK $keyname\n";
+        print " * $zone: new ZSK $keyname\n";
 
         open(KC, ">.keycounter") or die "$zpf/keycounter: $!\n";
         print KC "0";
@@ -235,7 +234,7 @@
         }
         close(INDEX);
 
-        print " * $zone: neue .index.ksk erzeugt\n";
+        print " * $zone: new .index.ksk created\n";
 
         if (-f "$zpf/.index.zsk") {
             unlink("$zpf/.index.zsk") or die "$zpf/.index.zsk: $!\n";
@@ -259,8 +258,8 @@
 
 sub kill_useless_keys {
 
-    # die funktion loescht alle schluessel die nicht in der index.zsk
-    # der uebergebenen zone stehen
+    # the function deletes all keys that are not available in the zone
+    # of index.zsk
     our $master_dir;
     my $zone    = $_[0];
     my @keylist = ();
@@ -272,16 +271,16 @@
     open(INDEX, "<$zpf/.index.ksk") or die "$zpf/.index.ksk: $!\n";
     push @keylist, <INDEX>;
 
-    # kuerzt die schluessel-bezeichnung aus der indexdatei auf die id um sie
-    # besser vergleichen zu koennen.
+    # shortened the key name from the index file on the id in order to
+    # be able to compare
     for (@keylist) {
         chomp;
         s#K.*\+.*\+(.*)#$1#;
     }
 
-    # prueft alle schluesseldateien (ksk, zsk) ob sie in der jeweiligen
-    # indexdatei beschrieben sind. wenn nicht werden sie geloescht.
-    for (`ls $master_dir/$zone/K*[key,private]`) {
+    # reviewed every key file (KSK, ZSK), whether they are described in
+    # the respective index file. if not they will be deleted.
+    for ( glob("$master_dir/$zone/K*") {
         chomp;
         my $file     = $_;
         my $rm_count = 1;
@@ -300,7 +299,7 @@
 
 sub key_to_zonefile {
 
-    # die funktion fugt alle schluessel in eine zonedatei
+    # the function added all keys to the indexfile
     our $master_dir;
     my $zone = $_[0];
     my $zpf  = "$master_dir/$zone";
@@ -328,8 +327,8 @@
 &read_conf;
 
 our %config;
-our $do;       # arbeitsschritte aus argv
-our @zones;    # liste der zonen in argv
+our $do;       # statements from argv
+our @zones;    # list of zones from argv
 our $master_dir      = $config{master_dir};
 our $bind_dir        = $config{bind_dir};
 our $conf_dir        = $config{zone_conf_dir};
@@ -340,8 +339,8 @@
 
 &read_argv;
 
-unless (@zones) { exit; }    # beendet das programm, wurden keine
-                             # gueltigen zonen uebergeben
+# completed the program, if not a valid zones was handed over
+unless (@zones) { exit; }
 
 if ($do eq "rm") { &rm_keys; exit; }
 if ($do eq "ck") { &ck_zone; }
@@ -350,3 +349,16 @@
 &creat_zsk;
 &post_creat;
 
+__END__
+
+=pod
+
+=head1 NAME
+
+dnssec-keytool
+
+=head1 SYNOPSIS
+
+dnssec-keytool <option> zone
+
+=head1 DESCRIPTION
--- a/update-serial.pl	Tue Dec 21 16:58:25 2010 +0100
+++ b/update-serial.pl	Thu Dec 23 23:59:27 2010 +0100
@@ -82,6 +82,7 @@
 }
 
 sub uniq(@) {
+    # remove duplicate entries
     my %all;
     @all{@_} = ();
     keys %all;
@@ -108,9 +109,8 @@
 }
 
 sub add_argv {
-
-    # prueft ob zonen aus ARGV verwaltete zonen sind
-    # und fuegt sie, falls ja in die liste @new_serial ein
+    # checked whether the zones in argv are managed zones and
+    #inserted them into the list new_serial
     our @new_serial;
     our $master_dir;
     my $zone;
@@ -148,8 +148,8 @@
 }
 
 sub sign_end {
-    our $sign_alert_time;    # die zeit zwischen dem ende und der neuen
-                             # signierung (siehe externe konfiguration)
+    our $sign_alert_time;    # the time between the end and the new signing
+                             # (see external configuration)
     our $master_dir;
     our @new_serial;