Würg around some nasty axTLS keying bugs
[project/luci.git] / libs / nixio / axtls-root / usr / sbin / nixio-axtls-checkkey
index 4bfee88..22bb1f8 100755 (executable)
@@ -1,8 +1,12 @@
 #!/usr/bin/lua
 local nixio = require "nixio"
+local fs = require "nixio.fs"
 local posix
 local defkey = nixio.meta_tls_context.tls_defaultkey
-if not defkey or io.open(defkey) then
+local okey = "646e6b90d1ad02719cb1b221b7ce447a"
+
+if (not defkey or io.open(defkey)) and
+not (nixio.crypto.hash("md5"):update(fs.readfile(defkey)):final()) == okey then
        os.exit(0)
 end