aboutsummaryrefslogtreecommitdiffstats
path: root/main/aaudit/aaudit-shell
diff options
context:
space:
mode:
Diffstat (limited to 'main/aaudit/aaudit-shell')
-rwxr-xr-xmain/aaudit/aaudit-shell15
1 files changed, 15 insertions, 0 deletions
diff --git a/main/aaudit/aaudit-shell b/main/aaudit/aaudit-shell
new file mode 100755
index 0000000000..733341bae9
--- /dev/null
+++ b/main/aaudit/aaudit-shell
@@ -0,0 +1,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))