summaryrefslogtreecommitdiffstats
path: root/testing/aaudit/aaudit-shell
blob: 733341bae9f93fb58ba7e6859cf851dcb4dc6db8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/lua5.2

local json = require 'cjson'
local aas = require 'aaudit.server'

local req = json.decode(io.read())
req.remote_ip = (os.getenv("SSH_CLIENT") or ""):match("[^ ]+")
req.identity = arg[1]

local ok, msg, extra = aas.handle(req, io.stdin)

local object = extra or {}
object.ok = ok
object.msg = msg
print(json.encode(object))