aboutsummaryrefslogtreecommitdiffstats
path: root/main/aaudit
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2015-01-20 09:05:36 +0200
committerTimo Teräs <timo.teras@iki.fi>2015-01-20 09:05:36 +0200
commitf2c45aef4503685588c0e2b673d15511dffe277c (patch)
tree24635058f09e3135461a3f667c2a10cd5bbb12cf /main/aaudit
parent3bf077826d07a46aa624c749260a05d5a6c81ebe (diff)
downloadaports-f2c45aef4503685588c0e2b673d15511dffe277c.tar.bz2
aports-f2c45aef4503685588c0e2b673d15511dffe277c.tar.xz
main/aaudit: server side fixes, and improvements
Diffstat (limited to 'main/aaudit')
-rw-r--r--main/aaudit/APKBUILD8
-rw-r--r--main/aaudit/aaudit-server.lua40
2 files changed, 31 insertions, 17 deletions
diff --git a/main/aaudit/APKBUILD b/main/aaudit/APKBUILD
index 7272fb9915..b8af7b6666 100644
--- a/main/aaudit/APKBUILD
+++ b/main/aaudit/APKBUILD
@@ -1,7 +1,7 @@
# Contributor: Timo Teräs <timo.teras@iki.fi>
# Maintainer: Timo Teräs <timo.teras@iki.fi>
pkgname=aaudit
-pkgver=0.7.1
+pkgver=0.7.2
pkgrel=0
pkgdesc="Alpine Auditor"
url="http://alpinelinux.org"
@@ -50,7 +50,7 @@ server() {
}
md5sums="b81b0707b297a69dacbc1606324de029 aaudit-common.lua
-10fe426bac7030cda718239295328fc4 aaudit-server.lua
+6cadd5483e5bb048539e35db9a45695d aaudit-server.lua
246782b6d8a47dc3568f4c232e35b638 aaudit
f5de73f12b6df1a751c89f19c92871be aaudit-shell
feef077f56f40002ca11846512d347af aaudit-update-keys
@@ -58,7 +58,7 @@ feef077f56f40002ca11846512d347af aaudit-update-keys
8a80554c91d9fca8acb82f023de02f11 aaudit.json
f0e97a7a07a472278298b5999a397f58 aaudit-server.json"
sha256sums="ee1998e730356c2de0ff9d5e27d9e0277e3c1f051777146b7c5b820437edfd7f aaudit-common.lua
-8d9324e78bece410bb7b63a993be9f571b0f3dd2cc928f2396ff18591654be54 aaudit-server.lua
+bad27a9a3df8fb1503389a9ece0e76d31f8b58b57ddf912c33eac0391ba7115b aaudit-server.lua
8c92fc5dd339883b940364ef27accb4d1756609a429682dd8f462b76d61fc8b7 aaudit
659c755cfca95a76da78f4d28d0ab9a32d55bea0077be7420ceaf9d45c518354 aaudit-shell
660dcf86f02a9d0e3ff47cb359e0291a0921d03215e368552a2878d2d691a9cc aaudit-update-keys
@@ -66,7 +66,7 @@ sha256sums="ee1998e730356c2de0ff9d5e27d9e0277e3c1f051777146b7c5b820437edfd7f aa
ca3d163bab055381827226140568f3bef7eaac187cebd76878e0b63e9e442356 aaudit.json
ab276c9caeaa238c8999c79cd3b016f4ba149e6793475c5cde088597cedd849c aaudit-server.json"
sha512sums="aaa378fd710d17cb3663954648e97dd5128406cc6f37e9834075046aed1912dcc9e448b6c96502350b8d3496e00b7803cae671a4be2c12c584a84dc0b6e843e9 aaudit-common.lua
-3df9e6cebb0c927be0fabea22b21394d5bfb2f3efd27d34ac50119dd5828da46a74027a12f22de50c8cecc036350f25016e34c00a44ed391cf363b11e2e46613 aaudit-server.lua
+023d017a03ed782ef9075c4fbabda3f5e2ea4936ef5a36f4f246e7c3ec930e1c0594b3fd7b26a7b39c0b4c815398b9d503e56cfa7d627a176bf261b4d5e0bc0b aaudit-server.lua
f9f7f9d12bcb08571d6f071ee7557ec9ca17fbaefd27e6dc085331d84434a42df05a483b8d11b187530f146757bce4390b9bb149791d2f63254ade80cf900801 aaudit
18499771d7d425f9305209c562eb8e62ef41910e88b08219baf010cdb472d49087080feb67384c4826c53bddcc0ce92c0c23c78df22dc40c64f1b17bf0ad05ec aaudit-shell
aec728a9a1e4c92baeb94a9d95e1785ea166652a157571fe2e848e71c1246635ecb99512e92435e1314c620b1fa8e4f37400350bed78bd375db4a63828c500f0 aaudit-update-keys
diff --git a/main/aaudit/aaudit-server.lua b/main/aaudit/aaudit-server.lua
index b039e2c775..6798c0b3ad 100644
--- a/main/aaudit/aaudit-server.lua
+++ b/main/aaudit/aaudit-server.lua
@@ -89,6 +89,7 @@ end
function M.sendemail(mail)
local to = {}
+ local tocheck = {}
local m = {
headers = {
["Content-Type"] = 'text/plain; charset=utf8',
@@ -100,9 +101,12 @@ function M.sendemail(mail)
}
local rcpt = {}
for _, addr in ipairs(mail.to) do
- local rfc822 = rfc822_address(addr)
- table.insert(to, rfc822)
- table.insert(rcpt, rfc822_email(rfc822))
+ if tocheck[addr] == nil then
+ tocheck[addr] = true
+ local rfc822 = rfc822_address(addr)
+ table.insert(to, rfc822)
+ table.insert(rcpt, rfc822_email(rfc822))
+ end
end
m.headers.to = table.concat(to, ", ")
return smtp.send{
@@ -127,18 +131,20 @@ local function sendcommitdiff(body, req, R, G)
if not G.notify_emails then return true end
if #G.notify_emails == 0 then return true end
+ local subject = ("config change - %s (%s)"):format(R.description, R.address)
+
local mail = {
from = req.committer,
to = G.notify_emails,
- subject = ("config change - %s (%s)"):format(R.description, R.address),
- message = table.concat(body, '\n')
+ subject = subject,
+ message = subject .. "\n\n" .. table.concat(body, '\n')
}
-- Set Request Tracker headers if relevant
local rtqueue = M.serverconfig.rtqueue
if rtqueue then
for k,no in req.message:gmatch("(%a+) #(%d+)") do
- local action = rt_keywords[k]
+ local action = rt_keywords[k:lower()]
if action ~= nil then
mail.subject = ("[%s #%s] %s"):format(rtqueue, no, mail.subject)
if action == true then
@@ -289,17 +295,25 @@ function M.loadrepoconfig(repohome)
return aac.readconfig(("%s/aaudit-repo.json"):format(repohome))
end
+local function merge_configs(a, b)
+ a = a or {}
+ b = b or {}
+ a.notify_emails = merge_array(a.notify_emails, b.notify_emails)
+ a.track_filemode = merge_bool(a.track_filemode, b.track_filemode)
+ a.no_track = merge_array(a.no_track, b.no_track)
+ a.no_notify = merge_array(a.no_notify, b.no_notify)
+ a.no_diff = merge_array(a.no_diff, b.no_diff)
+ return a
+end
+
local function load_repo_configs(repohome)
local R = M.loadrepoconfig(repohome)
-- merge global and per-repository group configs
- local G = (M.serverconfig.groups or {}).all or {}
+ local G = merge_configs(nil, (M.serverconfig.groups or {}).all)
for _, name in pairs(R.groups or {}) do
- local g = M.serverconfig.groups[name] or {}
- G.notify_emails = merge_array(G.notify_emails, g.notify_emails)
- G.track_filemode = merge_bool(G.track_filemode, g.track_filemode)
- G.no_track = merge_array(G.no_track, g.no_track)
- G.no_notify = merge_array(G.no_notify, g.no_notify)
- G.no_diff = merge_array(G.no_diff, g.no_diff)
+ if name ~= "all" then
+ G = merge_configs(G, M.serverconfig.groups[name])
+ end
end
return R, G
end