1
0
mirror of https://github.com/kepler155c/opus synced 2025-10-26 13:17:39 +00:00

The big Anavrins security update (round 1)

This commit is contained in:
kepler155c@gmail.com
2019-06-27 21:08:46 -04:00
parent 97a442e999
commit bcd33af599
17 changed files with 2308 additions and 204 deletions

View File

@@ -1,4 +1,4 @@
local Crypto = require('crypto')
local Crypto = require('crypto.chacha20')
local Event = require('event')
local Security = require('security')
local Socket = require('socket')
@@ -14,7 +14,7 @@ local function trustConnection(socket)
data = Crypto.decrypt(data, password)
if data and data.pk and data.dh == socket.dhost then
local trustList = Util.readTable('usr/.known_hosts') or { }
trustList[data.dh] = data.pk
trustList[data.dh] = Util.byteArrayToHex(data.pk)
Util.writeTable('usr/.known_hosts', trustList)
socket:write({ success = true, msg = 'Trust accepted' })
@@ -26,8 +26,8 @@ local function trustConnection(socket)
end
Event.addRoutine(function()
print('trust: listening on port 19')
while true do
local socket = Socket.server(19)