chiark / gitweb /
make-secnet-sites: Add new pubkeys-dir option, and pubkey paths
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 1 Dec 2019 16:51:24 +0000 (16:51 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 15 Feb 2020 21:56:52 +0000 (21:56 +0000)
This is where we are going to store peer public keys for each site.

Nothing uses it yet.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
README.make-secnet-sites
make-secnet-sites

index 17af35c4266672d30166355d801f551b88bfc94a..ed76b61f269bd7054b422106fdf427ba8549c20b 100644 (file)
@@ -47,6 +47,16 @@ OPTIONS
                If NUMBER is higher than make-secnet-sites supports,
                it writes out what it can.
 
+       --pubkeys-dir PUBKEYS
+
+               Specifies the live pubkeys area pathname.
+               The default is /var/lib/secnet/pubkeys.
+
+               Key files are named
+                       PUBKEYS/peer.<mangled-peer-name>[~...]
+               mangled-peer-name is chosen by make-secnet-sites
+                       / => ,
+
        --debug | -D
 
                Increase amount of debugging output.
index f5795ee85c5684db50cf1b34fe85e8c57db01ea6..1caf53dc3dfd919f5bd65cb59ebb787e6b99f968 100755 (executable)
@@ -253,6 +253,7 @@ def parse_args():
        global key_prefix
        global debug_level
        global output_version
+       global pubkeys_dir
 
        ap = argparse.ArgumentParser(description='process secnet sites files')
        ap.add_argument('--userv', '-u', action='store_true',
@@ -260,6 +261,9 @@ def parse_args():
        ap.add_argument('--conf-key-prefix', action=ActionNoYes,
                        default=True,
                 help='prefix conf file key names derived from sites data')
+       ap.add_argument('--pubkeys-dir',  nargs=1,
+                       help='public key directory',
+                       default=['/var/lib/secnet/pubkeys'])
        ap.add_argument('--output-version', nargs=1, type=int,
                        help='sites file output version',
                        default=[max_version])
@@ -274,6 +278,7 @@ def parse_args():
        prefix = '' if av.prefix is None else av.prefix[0]
        key_prefix = av.conf_key_prefix
        output_version = av.output_version[0]
+       pubkeys_dir = av.pubkeys_dir[0]
        if service:
                if len(av.arg)!=4:
                        print("Wrong number of arguments")
@@ -619,6 +624,10 @@ class sitelevel(level):
         'peer':"Gateway address of the site",
         'pub':"public key of the site",
        }
+       def mangle_name(self):
+               return self.name.replace('/',',')
+       def pubkeys_path(self):
+               return pubkeys_dir + '/peer.' + self.mangle_name()
        def __init__(self,w):
                level.__init__(self,w)
        def output_data(self,w,path):