diff options
Diffstat (limited to 'testing/aaudit/aaudit-shell')
-rwxr-xr-x | testing/aaudit/aaudit-shell | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/testing/aaudit/aaudit-shell b/testing/aaudit/aaudit-shell index 73ebd2e7eb..e54ac3a977 100755 --- a/testing/aaudit/aaudit-shell +++ b/testing/aaudit/aaudit-shell @@ -1,14 +1,11 @@ -#!/bin/sh +#!/usr/bin/lua5.2 -local ip="${SSH_CLIENT/ */}" -local identity="$1" -[ -z "$ip" -o -z "$identity" ] && exit 1 +local json = require 'cjson' +local aas = require 'aaudit.server' -set -- $SSH_ORIGINAL_COMMAND -cmd="$1" -shift +local req = json.decode(io.read("*all")) +req.remote_ip = (os.getenv("SSH_CLIENT") or ""):match("[^ ]+") +req.identity = arg[1] -case "$cmd" in -create) /usr/libexec/aaudit/aaudit-repo-create -a "$ip" "$@" -i "$identity" ;; -commit) /usr/libexec/aaudit/aaudit-repo-update -a "$ip" "$@" -i "$identity" ;; -esac +local ok, msg = aas.handle(req) +print(json.encode{ok=ok,msg=msg}) |