email: Use drop-in config component for /etc files

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 2023-06-05 20:28:58 -04:00
1 parent 99b23b75a4
commit 340c8bd156
19 files changed
+40 -1

No files matched your search

@@ -0,0 +1,36 @@
# Serve rspamd web UI:
# https://www.rspamd.com/doc/faq.html#how-to-use-the-webui-behind-a-proxy-server
<LocationMatch "^/rspamd$">
Redirect "/rspamd/"
</LocationMatch>
<Location "/rspamd/">
ProxyPass http://127.0.0.1:11334/
ProxyPassReverse http://127.0.0.1:11334/
# Don't add X-Forwarded* headers to make rspamd think that request is coming
# from localhost. This disables rspamd's password auth mechanism in favor of
# FreedomBox authentication and authorization below.
ProxyAddHeaders off
# Require SSO
Include includes/freedombox-single-sign-on.conf
<IfModule mod_auth_pubtkt.c>
TKTAuthToken "admin"
</IfModule>
</Location>
# Automatic configuration for clients like Thunderbird:
# https://wiki.mozilla.org/Thunderbird:Autoconfiguration#Implementation
<Location "/.well-known/autoconfig/mail/config-v1.1.xml">
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^ /plinth/apps/email/config.xml [PT]
</IfModule>
</Location>
# If Roundcube is not yet installed and the user clicks on 'Launch web client',
# redirect to the installation page instead of Apache's Not Found page.
<Location "/roundcube/">
ErrorDocument 404 /plinth/apps/roundcube/
</Location>
@@ -0,0 +1,15 @@
# Do not edit this file. Manage your settings on FreedomBox.
# See:
# https://doc.dovecot.org/configuration_manual/authentication/password_databases_passdb/
#
# For passdb, the passwd driver looks up using NSS. In FreedomBox, NSS is
# configured to lookup LDAP with the help of libnss-ldapd. Lookup using passdb
# would have been sufficient if FreedomBox allowed all its users to login using
# pam. However, by default, FreedomBox disallows all users but 'admin' group to
# login. Hence, the need for LDAP lookup.
#
passdb {
driver = ldap
args = /etc/dovecot/conf.d/freedombox-ldap.conf.ext
}
@@ -0,0 +1,28 @@
# Do not edit this file. Manage your settings on FreedomBox.
# See:
# https://doc.dovecot.org/configuration_manual/authentication/user_databases_userdb/
#
# Users in FreedomBox are not expected to access mail by logging into the
# system. Storing the mail in single location instead of home directories and
# with single UID/GID simplifies security reasoning and backup/restore
# operations.
#
# When FreedomBox has multiple domains a user is expected to get a mailbox that
# is same across the domains. Changing an domain name is not uncommon in
# FreedomBox. So, authenticate and store mails based on username only instead of
# including domain names in storage path.
#
# Directories are created under /var/mail as necessary by dovecot. Permissions
# for newly created directories are inherited from parent directory. FreedomBox
# will remove all permissions for 'others' from /var/mail to ensure that mail is
# not read by non-root users.
#
# userdb provides lookup for three parameters after authentication of a user.
# These parameters are uid, gid, and home directory of the user. If these do not
# change from user to user, a 'static' database type with fixed values is
# sufficient as userdb.
userdb {
driver = static
args = home=/var/mail/%Ln uid=mail gid=mail
}
@@ -0,0 +1,11 @@
# Do not edit this file. Manage your settings on FreedomBox.
# See: https://doc.dovecot.org/settings/core/
# Outlook and Windows Mail works only with LOGIN mechanism, not the standard
# PLAIN:
auth_mechanisms = plain login
# Allow authentication from attempts that provide username as
# user@domain.example.
auth_username_format = %Ln
@@ -0,0 +1,18 @@
# Do not edit this file. Manage your settings on FreedomBox.
# See: https://doc.dovecot.org/configuration_manual/mail_location/
# See: https://doc.dovecot.org/settings/core/
# Use sdbox, a format specific to dovecot, for storing mails. The format allows
# better performance with some IMAP queries. When this is combined with Full
# Text Search (FTS), users will get optimal web and desktop mail experience.
# Don't pick mdbox format because is requires regular expunge maintenance. We
# have enabled btrfs filesystem compression by default.
mail_location = sdbox:~/mail
# We try to deliver all mail using a single UID 'mail' and a single GID 'mail'.
# In Debian, UID of mail user is 8 and GID of mail user is 8 as set in
# /usr/share/base-passwd/{passwd|group}.master. By default first valid UID in
# dovecot is 500.
first_valid_uid = 8
last_valid_uid = 8
@@ -0,0 +1,8 @@
# Do not edit this file. Manage your settings on FreedomBox.
# See: https://doc.dovecot.org/configuration_manual/sieve/configuration/
# Enable the sieve plugin to sort mail during delivery using sieve scripts.
protocol lmtp {
mail_plugins = $mail_plugins sieve
}
@@ -0,0 +1,71 @@
# Do not edit this file. Manage your settings on FreedomBox.
# Mark various mailboxes with special use flags (RFC 6154). Various names used
# in mail clients for mailboxes: https://www.imapwiki.org/SpecialUse
# See: https://doc.dovecot.org/configuration_manual/namespace/
namespace inbox {
# Archive
mailbox Archive {
auto = subscribe
special_use = \Archive
}
mailbox Archives { # Thunderbird
auto = no
special_use = \Archive
}
# Drafts
mailbox Drafts {
auto = subscribe
special_use = \Drafts
}
# Sent
mailbox Sent {
auto = subscribe
special_use = \Sent
}
mailbox "Sent Items" { # Outlook 2010/2013
auto = no
special_use = \Sent
}
mailbox "Sent Messages" { # iOS
auto = no
special_use = \Sent
}
# Junk
mailbox Junk {
auto = subscribe
autoexpunge = 60d
special_use = \Junk
}
mailbox Spam { # KMail, K-9 Mail
auto = no
autoexpunge = 60d
special_use = \Junk
}
mailbox "Junk E-mail" { # Outlook 2010
auto = no
autoexpunge = 60d
special_use = \Junk
}
mailbox INBOX.Junk {
auto = no
autoexpunge = 60d
special_use = \Junk
}
# Trash
mailbox Trash {
auto = subscribe
autoexpunge = 60d
special_use = \Trash
}
mailbox INBOX.Trash {
auto = no
autoexpunge = 60d
special_use = \Trash
}
}
@@ -0,0 +1,21 @@
# Do not edit this file. Manage your settings on FreedomBox.
# Listen on Unix domain sockets for postfix to use dovecot SASL authentication
# and for postfix to deliver mail using dovecot to local mailboxes. See:
# https://doc.dovecot.org/configuration_manual/howto/postfix_and_dovecot_sasl/
service auth {
unix_listener /var/spool/postfix/private/auth {
mode = 0600
user = postfix
group = postfix
}
}
service lmtp {
unix_listener /var/spool/postfix/private/dovecot-lmtp {
mode = 0600
user = postfix
group = postfix
}
}
@@ -0,0 +1,11 @@
# Do not edit this file. Manage your settings on FreedomBox.
# Mozilla Guideline v5.6, Dovecot 2.3.9, OpenSSL 1.1.1d, intermediate.
# Generated 2021-08: https://ssl-config.mozilla.org/
# See: https://doc.dovecot.org/configuration_manual/dovecot_ssl_configuration/
ssl = required
ssl_min_protocol = TLSv1.2
ssl_prefer_server_ciphers = no
ssl_cipher_list = ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
@@ -0,0 +1,9 @@
# Do not edit this file. Manage your settings on FreedomBox.
# Default sieve scripts applied for delivery to all users. To move mail to Junk
# folder based on classification headers set by rspamd. See:
# https://doc.dovecot.org/settings/pigeonhole/
plugin {
sieve_after = /etc/dovecot/freedombox-sieve-after
}
@@ -0,0 +1,8 @@
# Do not edit this file. Manage your settings on FreedomBox.
# See: https://wiki.dovecot.org/AuthDatabase/LDAP/AuthBinds
uris = ldapi:///
base = dc=thisbox
auth_bind = yes
auth_bind_userdn = uid=%u,ou=users,dc=thisbox
@@ -0,0 +1,11 @@
# Do not edit this file. Manage your settings on FreedomBox.
# A simple sieve script that applies to all users. Moves mail to Junk folder
# based on classification header set by rspamd.
# See: https://docs.gandi.net/en/gandimail/sieve/sieve_tutorial.html
require ["fileinto", "mailbox"];
if header :is "X-Spam" "Yes" {
fileinto :create "Junk";
}
@@ -0,0 +1,3 @@
[dovecot]
enabled = true
maxretry = 30
@@ -0,0 +1,7 @@
# Do not edit this file. Manage your settings on FreedomBox.
# Configuration for sqlite based postfix lookup table for aliases. See:
# https://www.postfix.org/SQLITE_README.html
dbpath = /var/lib/postfix/freedombox-aliases/aliases.sqlite3
query = SELECT value FROM alias WHERE name='%s'
@@ -0,0 +1,13 @@
# Do not edit this file. Manage your settings on FreedomBox.
# Configure which/how headers are added by rspamd before returning mail to
# postfix. See: https://rspamd.com/doc/modules/milter_headers.html
use = ["authentication-results", "x-spam-level", "x-spam-status",
"x-spamd-bar", "x-spamd-result"];
routines {
authentication-results {
add_smtp_user = false;
}
}
@@ -0,0 +1,8 @@
# Do not edit this file. Manage your settings on FreedomBox.
# Many modules such as bayes classifier require redis. Default configuration
# does not connect to a local redis server. See:
# https://rspamd.com/doc/configuration/redis.html
servers = "127.0.0.1";
db = "7"; # Use database number 8 not to clash with other clients