Limit the number of SSHFP records we generate
authorTom Hughes <tom@compton.nu>
Sat, 8 Feb 2020 16:02:02 +0000 (16:02 +0000)
committerTom Hughes <tom@compton.nu>
Sat, 8 Feb 2020 16:02:02 +0000 (16:02 +0000)
Makefile
bin/mksshfp

index 8a26dd0..7811651 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -66,7 +66,7 @@ data/switch2osm.org: src/switch2osm
 data/switch2osm.com: src/switch2osm
 data/stateofthemap.eu: src/stateofthemap-eu
 
-include/sshfp.js:
+include/sshfp.js: $(wildcard /etc/ssh/ssh_known_hosts)
        bin/mksshfp
 
 origins/tile.openstreetmap.yml: bin/mkcountries lib/countries.xml bandwidth/tile.openstreetmap.yml
index e4bc8ed..7c0f518 100755 (executable)
@@ -18,7 +18,11 @@ if (-f "/etc/ssh/ssh_known_hosts")
             my $type = $3;
             my $value = $4;
 
-            print SSHFP_JS qq|  SSHFP("${host}", ${algorithm}, ${type}, "${value}"),\n|;
+            if ($type == 2 &&
+                ($algorithm == 3 || $algorithm == 4))
+            {
+                print SSHFP_JS qq|  SSHFP("${host}", ${algorithm}, ${type}, "${value}"),\n|;
+            }
         }
         else
         {