]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
4396. [func] dnssec-keymgr now takes a '-r randomfile' option.
authorMark Andrews <marka@isc.org>
Fri, 24 Jun 2016 04:12:24 +0000 (14:12 +1000)
committerMark Andrews <marka@isc.org>
Fri, 24 Jun 2016 04:12:24 +0000 (14:12 +1000)
                        [RT #42455]

CHANGES
bin/python/dnssec-keymgr.docbook
bin/python/isc/dnskey.py.in
bin/python/isc/keymgr.py.in
bin/python/isc/keyseries.py.in
bin/tests/system/keymgr/tests.sh

diff --git a/CHANGES b/CHANGES
index eba827d0626912cf2420319c4cae11b95decb2fc..1049556a05d1b648db2477f2e4299636fa87ffb8 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,7 @@
-4395   [bug]           Improve out-of-tree installation of python modules.
+4396.  [func]          dnssec-keymgr now takes a '-r randomfile' option.
+                       [RT #42455]
+
+4395.  [bug]           Improve out-of-tree installation of python modules.
                        [RT #42586]
 
 4394.  [func]          Add rndc command "dnstap-reopen" to close and
index 29c0a598a9ebc4d2b20a02d743a120dc7dbca55c..1bf4c6d700c9ac79065d5f5cd4e8c66568802b7e 100644 (file)
  - PERFORMANCE OF THIS SOFTWARE.
 -->
 
-<!-- Converted by db4-upgrade version 1.0 -->
 <refentry xmlns="http://docbook.org/ns/docbook" version="5.0" xml:id="man.dnssec-keymgr">
   <info>
-    <date>2016-04-03</date>
+    <date>2016-06-03</date>
   </info>
   <refentryinfo>
     <corpname>ISC</corpname>
@@ -53,6 +52,7 @@
       <arg choice="opt" rep="norepeat"><option>-v</option></arg>
       <arg choice="opt" rep="norepeat"><option>-z</option></arg>
       <arg choice="opt" rep="norepeat"><option>-g <replaceable class="parameter">path</replaceable></option></arg>
+      <arg choice="opt" rep="norepeat"><option>-r <replaceable class="parameter">path</replaceable></option></arg>
       <arg choice="opt" rep="norepeat"><option>-s <replaceable class="parameter">path</replaceable></option></arg>
       <arg choice="opt" rep="repeat">zone</arg>
     </cmdsynopsis>
         </listitem>
       </varlistentry>
 
+      <varlistentry>
+        <term>-r <replaceable class="parameter">randomdev</replaceable></term>
+        <listitem>
+          <para>
+            Specifies a path to a file containing random data.
+            This is passed to the <command>dnssec-keygen</command> binary
+            using its <option>-r</option> option.
+<!-- TODO: what to do about "-r keyboard"? -->
+          </para>
+        </listitem>
+      </varlistentry>
+
       <varlistentry>
         <term>-s <replaceable class="parameter">settime-path</replaceable></term>
         <listitem>
index 36825118e25179f846ed047926c2c10cf34831e6..a87de63c41012dfa327e734b1446fb9b88e5c643 100644 (file)
@@ -170,12 +170,15 @@ class dnskey:
                 self._changed[prop] = False
 
     @classmethod
-    def generate(cls, keygen_bin, keys_dir, name, alg, keysize, sep,
+    def generate(cls, keygen_bin, randomdev, keys_dir, name, alg, keysize, sep,
                  ttl, publish=None, activate=None, **kwargs):
         quiet = kwargs.get('quiet', False)
 
         keygen_cmd = [keygen_bin, "-q", "-K", keys_dir, "-L", str(ttl)]
 
+        if randomdev:
+            keygen_cmd += ["-r", randomdev]
+
         if sep:
             keygen_cmd.append("-fk")
 
@@ -210,7 +213,7 @@ class dnskey:
         except Exception as e:
             raise Exception('unable to parse generated key: %s' % str(e))
 
-    def generate_successor(self, keygen_bin, **kwargs):
+    def generate_successor(self, keygen_bin, randomdev, **kwargs):
         quiet = kwargs.get('quiet', False)
 
         if not self.inactive():
@@ -221,6 +224,9 @@ class dnskey:
         if self.ttl:
             keygen_cmd += ["-L", str(self.ttl)]
 
+        if randomdev:
+            keygen_cmd += ["-r", randomdev]
+
         if not quiet:
             print('# ' + ' '.join(keygen_cmd))
 
index e3e9ad3bddd2bad6566f27de9ab870d3c925c977..920504a440b8615c1b573b42e1fa090dc8bd696e 100644 (file)
@@ -80,6 +80,9 @@ def parse_args():
     parser.add_argument('-g', dest='keygen', default=keygen, type=str,
                         help='Path to \'dnssec-keygen\'',
                         metavar='path')
+    parser.add_argument('-r', dest='randomdev', type=str, default=None,
+                        help='Path to a file containing random data to pass to \'dnssec-keygen\'',
+                        metavar='path')
     parser.add_argument('-s', dest='settime', default=settime, type=str,
                         help='Path to \'dnssec-settime\'',
                         metavar='path')
@@ -130,7 +133,8 @@ def main():
     # into a context object that can be passed around
     context = {'keygen_path': args.keygen,
                'settime_path': args.settime,
-               'keys_path': args.path}
+               'keys_path': args.path,
+               'randomdev': args.randomdev}
 
     try:
         dp = policy.dnssec_policy(args.policyfile)
index 3120d0226d7e46623560b9703725f9f8a12f8792..613b9e29030dc4ab9c4cd618dc29088cd7771e9d 100644 (file)
@@ -131,6 +131,7 @@ class keyseries:
             # generated if Inactive has been set in the predecessor key
             prev.commit(self._context['settime_path'], **kwargs)
             key = prev.generate_successor(self._context['keygen_path'],
+                                          self._context['randomdev'],
                                           **kwargs)
 
             key.setinactive(key.activate() + rp, **kwargs)
@@ -166,6 +167,7 @@ class keyseries:
             if 'ksk' not in kwargs or not kwargs['ksk']:
                 if len(self._Z[zone][algnum]) == 0:
                     k = dnskey.generate(self._context['keygen_path'],
+                                        self._context['randomdev'],
                                         keys_dir, zone, alg,
                                         policy.zsk_keysize, False,
                                         policy.keyttl or 3600,
@@ -176,6 +178,7 @@ class keyseries:
             if 'zsk' not in kwargs or not kwargs['zsk']:
                 if len(self._K[zone][algnum]) == 0:
                     k = dnskey.generate(self._context['keygen_path'],
+                                        self._context['randomdev'],
                                         keys_dir, zone, alg,
                                         policy.ksk_keysize, True,
                                         policy.keyttl or 3600,
index a34bb46e20bf3f961fffd05c3c3a7cde09636a3b..dd5849d12f46a1283146a018c65fa29c4ac792cd 100644 (file)
@@ -39,7 +39,7 @@ for dir in [0-9][0-9]-*; do
         . $dir/expect
 
         # run keymgr to update keys
-        $KEYMGR -K $dir -g $KEYGEN -s $SETTIME $kargs > keymgr.$n 2>&1
+        $KEYMGR -K $dir -g $KEYGEN -r $RANDFILE -s $SETTIME $kargs > keymgr.$n 2>&1
         # check that return code matches expectations
         found=$?
         if [ $found -ne $kret ]; then