2 local keyfile = "/etc/nixio/rsa_main.der"
3 local certfile = "/etc/nixio/cert_main.der"
5 local px5g = require "px5g"
6 local nixio = require "nixio"
7 local fs = require "nixio.fs"
8 local os = require "os"
11 if not fs.access(certfile) then
12 local key = px5g.genkey(2048)
13 fs.writefile(keyfile, key:asn1())
15 local cert = key:create_selfsigned(
16 {CN=nixio.uname().nodename, O="LuCI Keymaster"},
17 os.time(), os.time() + 3600 * 24 * 366 * 15)
18 fs.writefile(certfile, cert)