chiark / gitweb /
stest: Transfer pubkeys from test-example
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 3 Dec 2019 20:56:42 +0000 (20:56 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 7 Dec 2019 21:52:07 +0000 (21:52 +0000)
We are going to have tests which use the peer-keys site config key,
which refers to external key files from a pubkeys directory.  In the
case of stest, these are pubkeys from test-example.

Because secnet may rename files etc. in this directory, we need a
private one per test.  So, for each test, when making the config file,
make a copy of the pubkeys directory.  Of course this means that
directory needs to exist, so mkdir it (and clean it), although the
machinery for populating it doesn't exist yet.

Also, when copying the sites.conf file, adjust references to
test-example to refer to the copy.  (Currently there won't be any such
references.)

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
.gitignore
stest/common.tcl
test-example/Subdir.sd.mk

index a7fb58f28236b704e3e9f01c0dbebc53c6be71ea..42dd54b7f6af651ce436dada121df7a9dd2e490f 100644 (file)
@@ -44,6 +44,7 @@ debian/secnet.substvars
 
 test-example/*.key
 test-example/*.privkeys
+test-example/pubkeys
 test-example/sites.conf
 test-example/bogus-setup-request
 build-stamp
index 7891e1d4a4901ce696242b550c92a2767b1a0eb9..5b87e73fc643b921c1894a8452de21336d0a19c3 100644 (file)
@@ -96,13 +96,22 @@ exec cat
        transform eax-serpent { }, serpent256-cbc { };
     }
 
+    set pubkeys $tmp/$site.pubkeys
+    file delete -force $pubkeys
+    exec cp -rl $builddir/test-example/pubkeys $pubkeys
+
     set f [open $builddir/test-example/sites.conf r]
+    while {[gets $f l] >= 0} {
+       regsub {\"[^\"]*test-example/pubkeys/} $l "\"$pubkeys/" l
+       append cfg $l "\n"
+    }
     set sites [read $f]
     close $f
     append cfg $sites
     append cfg {
        sites map(site,all-sites);
     }
+
     return $cfg
 }
 
index a6a9367b9c09e802f76b542bd30911e49460c31c..4c4887c6414e0b1dfb057630bf69b017053a39e6 100644 (file)
@@ -6,8 +6,12 @@ include common.make
        base64 -d <$< >$@.new && mv -f $@.new $@
 
 &sites.conf: $(src)/make-secnet-sites &^/sites &/Subdir.mk
+       mkdir -p &pubkeys
        $(src)/make-secnet-sites &^/sites $@
 
+&clean::
+       rm -rf &pubkeys
+
 define privkey
 &/$1.privkeys/priv.$2: &/$3
        mkdir -p $$(dir $$@) && cp $$< $$@.tmp && mv -f $$@.tmp $$@