aboutsummaryrefslogtreecommitdiffstats
path: root/main/aaudit/aaudit-update-keys
diff options
context:
space:
mode:
authorLeonardo Arena <rnalrd@alpinelinux.org>2014-06-12 07:56:57 +0000
committerLeonardo Arena <rnalrd@alpinelinux.org>2014-06-12 07:57:18 +0000
commit15f898ca8068419fc02364231bb2981cc54971cb (patch)
treee3ec5995d70831834d467d40615870b44bca7044 /main/aaudit/aaudit-update-keys
parent94983a506d2e95be0a5864ae7bcc7d7d61dc6cce (diff)
downloadaports-15f898ca8068419fc02364231bb2981cc54971cb.tar.bz2
aports-15f898ca8068419fc02364231bb2981cc54971cb.tar.xz
testing/aaudit: move to main
Diffstat (limited to 'main/aaudit/aaudit-update-keys')
-rwxr-xr-xmain/aaudit/aaudit-update-keys18
1 files changed, 18 insertions, 0 deletions
diff --git a/main/aaudit/aaudit-update-keys b/main/aaudit/aaudit-update-keys
new file mode 100755
index 0000000000..3521808cba
--- /dev/null
+++ b/main/aaudit/aaudit-update-keys
@@ -0,0 +1,18 @@
+#!/usr/bin/lua5.2
+
+local posix = require 'posix'
+local aac = require 'aaudit.common'
+
+local home = os.getenv("HOME")
+local allkeys = {}
+for _, keyfile in ipairs(posix.glob(("%s/keydir/*.pub"):format(home))) do
+ local identity = keyfile:match("keydir/(.*).pub$")
+ for sshkey in io.lines(keyfile) do
+ table.insert(allkeys,
+ ('command="/usr/libexec/aaudit/aaudit-shell %s"'..
+ ',no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty %s\n')
+ :format(identity, sshkey))
+ end
+end
+
+aac.writefile(table.concat(allkeys), ("%s/.ssh/authorized_keys"):format(home))