Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1

ARG ANONADDY_VERSION=1.5.0
ARG ANONADDY_VERSION=1.6.0
ARG ALPINE_VERSION=3.23

FROM tianon/gosu:latest AS gosu
Expand Down Expand Up @@ -101,7 +101,6 @@ RUN apk --no-cache add -t build-dependencies \
&& git fetch --depth 1 origin "v${ANONADDY_VERSION}" && git checkout -q FETCH_HEAD \
&& composer install --optimize-autoloader --no-dev --no-interaction --no-ansi --ignore-platform-req=php-64bit \
&& chown -R anonaddy:anonaddy /var/www/anonaddy \
&& npm install --package-lock-only --ignore-scripts --no-audit --no-fund \
&& npm ci --ignore-scripts --no-audit --no-fund \
&& APP_URL=https://addy-sh.test npm run production \
&& chown -R nobody:nogroup /var/www/anonaddy \
Expand Down
42 changes: 41 additions & 1 deletion rootfs/etc/cont-init.d/14-config-rspamd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,14 @@ actions = {
}
EOL

echo "Setting Rspamd actions.conf"
cat >/etc/rspamd/local.d/actions.conf <<EOL
reject = 500;
EOL

echo "Setting Rspamd milter_headers.conf"
cat >/etc/rspamd/local.d/milter_headers.conf <<EOL
use = ["authentication-results", "remove-headers", "spam-header", "add_dmarc_allow_header"];
use = ["authentication-results", "remove-headers", "spam-header", "add_dmarc_allow_header", "add_should_quarantine_header"];

routines {
remove-headers {
Expand Down Expand Up @@ -187,6 +192,41 @@ return function(task, common_meta)
{['X-AnonAddy-Dmarc-Allow'] = 0},
{}
end
EOD;
add_should_quarantine_header = <<EOD
return function(task, common_meta)
local metric = task:get_metric_score('default')
local score = metric and metric[1] or 0
local reject_threshold = 15.0
local should_quarantine = false
local quarantine_reason = nil

if score >= reject_threshold then
should_quarantine = true
quarantine_reason = quarantine_reason or '5.7.1 Spam message rejected'
end

if should_quarantine then
return nil,
{
['X-AnonAddy-Should-Quarantine'] = 'Yes',
['X-AnonAddy-Quarantine-Reason'] = quarantine_reason or '5.7.1 Spam message rejected'
},
{
['X-AnonAddy-Should-Quarantine'] = 0,
['X-AnonAddy-Quarantine-Reason'] = 0
},
{}
end

return nil,
{},
{
['X-AnonAddy-Should-Quarantine'] = 0,
['X-AnonAddy-Quarantine-Reason'] = 0
},
{}
end
EOD;
}
EOL
Expand Down