nixio: Fix generation of private key for axtls

This commit is contained in:
Steven Barth 2009-03-04 18:30:56 +00:00
parent fc45514531
commit f1b667fc6f

View file

@ -6,11 +6,11 @@ if not defkey or io.open(defkey) then
os.exit(0)
end
if os.execute("which openssl") then
if os.execute("which openssl >/dev/null") == 0 then
io.stderr:write("Warning: OpenSSL detected "..
"but it looks like nixio was linked against axtls\n")
os.execute("umask 0077;openssl genrsa -out '" .. defkey .. "' 2048")
elseif os.execute("which dropbearkey && which dropbearconvert") then
elseif os.execute("which dropbearkey >/dev/null && which dropbearconvert >/dev/null") == 0 then
os.execute("dropbearkey -t rsa -s 2048 -f /tmp/dbkey.rsa")
os.execute("umask 0077;dropbearconvert dropbear openssh /tmp/dbkey.rsa '"..defkey.."'")
os.remove("/tmp/dbkey.rsa")