email: Drop special handling for outbound filtering

- Reduces a lot of complexity and avoids running a couple of more postfix
daemons (one on 10025 port and other on socket fbxcleanup).

- Cleaning outbound headers for privacy can be done in a simpler way. This may
be re-implemented later.

- Masquerading domains is not very important for FreedomBox use case. Users are
expected to send all mail using MUA using properly configured email addresses.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa authored and James Valleroy committed 2022-03-02 07:37:53 -05:00
1 parent 84f7b60bc5
commit 0d5366a356
8 files changed
+7 -132

No files matched your search

@@ -1,14 +0,0 @@
# -*- mode: conf-space -*-
# This file is managed by FreedomBox. Direct edits will be lost!
# Outbound header privacy
/^Delivered-To:/ IGNORE
/^Received[:-]/ IGNORE
/^User-Agent:/ IGNORE
/^X-EIP:/ IGNORE
/^X-Mailer:/ IGNORE
/^X-Originating-IP:/ IGNORE
/^X-Sender:/ IGNORE
# Currently localhost:10025 does not have a milter
# so it is fine to delete internal headers now
/^X-Fbx-/ IGNORE
@@ -1,5 +0,0 @@
# -*- mode: conf-space -*-
# This file is managed by FreedomBox. Direct edits will be lost!
# Scrub all internal headers
/^X-Fbx-/ IGNORE
@@ -1,7 +0,0 @@
# -*- mode: conf-space -*-
# This file is managed by FreedomBox
# regexp sender canonical map
# Remove the domain part from email addresses
# Postfix will append @$myhostname
/^([^@]+)@/ $1
@@ -1,39 +1,10 @@
# The following section is managed by FreedomBox
# Be careful not to edit
# The file is managed by FreedomBox. Do not to edit.
use = ["x-fbx-mail-type", "authentication-results", "x-spam-level",
"x-spam-status", "x-spamd-bar", "x-spamd-result"];
use = ["authentication-results", "x-spam-level", "x-spam-status",
"x-spamd-bar", "x-spamd-result"];
routines {
authentication-results {
add_smtp_user = false;
}
}
# Custom headers required by FreedomBox filtering system
custom {
x-fbx-mail-type = <<EOD
return function(task, common_meta)
-- parameters are task and metadata from previous functions
-- add headers
local add_table = {["x-fbx-mail-type"] = "unknown;"}
local auth_user = task:get_user()
if auth_user == nil or auth_user == "" then
add_table["x-fbx-mail-type"] = "smtpd-anon;"
else
add_table["x-fbx-mail-type"] = "smtpd-submission;"
-- add_table["x-fbx-sasl-user"] = auth_user
end
-- remove foreign x-fbx- headers
local remove_table = {}
local function callback(header_name, header_value)
local prefix = "x-fbx-"
if header_name:lower():sub(1, #prefix) == prefix then
remove_table[header_name] = 0
end
end
task:headers_foreach(callback, {full = 'true'})
return nil, add_table, remove_table, {}
end
EOD;
}
@@ -1,5 +0,0 @@
DO NOT PUT PERSONAL ITEMS HERE!
This folder in its entirety is managed by FreedomBox.
/var/spool/postfix/fbx-managed/ contains config files read by chrooted Postfix
services.
@@ -1,7 +0,0 @@
# -*- mode: conf-space -*-
# This file is managed by FreedomBox. Direct edits will be lost!
# Outbound
/^X-Fbx-Mail-Type: smtpd-submission;/ FILTER smtp:[127.0.0.1]:10025
# Inbound
/^X-Fbx-Mail-Type: smtpd-anon;/ IGNORE