parent
da41962b4a
commit
1c1f7cc619
@ -1,88 +0,0 @@
|
|||||||
##
|
|
||||||
## Settings specific to SMTP Submission
|
|
||||||
##
|
|
||||||
|
|
||||||
# SMTP Submission logout format string:
|
|
||||||
# %i - total number of bytes read from client
|
|
||||||
# %o - total number of bytes sent to client
|
|
||||||
# %{command_count} - Number of commands received from client
|
|
||||||
# %{reply_count} - Number of replies sent to client
|
|
||||||
# %{session} - Session ID of the login session
|
|
||||||
# %{transaction_id} - ID of the current transaction, if any
|
|
||||||
#submission_logout_format = in=%i out=%o
|
|
||||||
|
|
||||||
# Host name reported by the SMTP service, for example to the client in the
|
|
||||||
# initial greeting and to the relay server in the HELO/EHLO command.
|
|
||||||
# Default is the system's real hostname@domain.
|
|
||||||
hostname = {{ HOSTNAME }}
|
|
||||||
|
|
||||||
# Maximum size of messages accepted for relay. This announced in the SIZE
|
|
||||||
# capability. If not configured, this is either determined from the relay
|
|
||||||
# server or left unlimited if no limit is known (relay will reply with error
|
|
||||||
# if some unknown limit exists there, which is duly passed to our client).
|
|
||||||
#submission_max_mail_size =
|
|
||||||
|
|
||||||
# Maximum number of recipients accepted per connection (default: unlimited)
|
|
||||||
#submission_max_recipients =
|
|
||||||
|
|
||||||
# Workarounds for various client bugs:
|
|
||||||
# whitespace-before-path:
|
|
||||||
# Allow one or more spaces or tabs between `MAIL FROM:' and path and between
|
|
||||||
# `RCPT TO:' and path.
|
|
||||||
# mailbox-for-path:
|
|
||||||
# Allow using bare Mailbox syntax (i.e., without <...>) instead of full path
|
|
||||||
# syntax.
|
|
||||||
#
|
|
||||||
# The list is space-separated.
|
|
||||||
#submission_client_workarounds =
|
|
||||||
|
|
||||||
# Relay server configuration:
|
|
||||||
#
|
|
||||||
# The Dovecot SMTP submission service directly proxies the mail transaction
|
|
||||||
# to the SMTP relay configured here.
|
|
||||||
|
|
||||||
# Host name for the relay server (required)
|
|
||||||
submission_relay_host = {{ RELAY_HOST }}
|
|
||||||
|
|
||||||
# Port for the relay server
|
|
||||||
submission_relay_port = {{ RELAY_PORT }}
|
|
||||||
|
|
||||||
# Is the relay server trusted? This determines whether we try to send
|
|
||||||
# (Postfix-specific) XCLIENT data to the relay server
|
|
||||||
submission_relay_trusted = {{ RELAY_TRUSTED }}
|
|
||||||
|
|
||||||
# Authentication data for the relay server if authentication is required
|
|
||||||
#submission_relay_user =
|
|
||||||
#submission_relay_master_user =
|
|
||||||
#submission_relay_password =
|
|
||||||
|
|
||||||
# SSL configuration for connection to relay server
|
|
||||||
#
|
|
||||||
# submission_relay_ssl:
|
|
||||||
# Indicates whether SSL is used for the connection to the relay server. The
|
|
||||||
# following values are defined for this setting:
|
|
||||||
#
|
|
||||||
# no - No SSL is used
|
|
||||||
# smtps - An SMTPS connection (immediate SSL) is used
|
|
||||||
# starttls - The STARTTLS command is used to establish SSL layer
|
|
||||||
#submission_relay_ssl = no
|
|
||||||
|
|
||||||
# submission_relay_ssl_verify:
|
|
||||||
# Configures whether the SSL certificate of the relay server is to be
|
|
||||||
# verified.
|
|
||||||
#submission_relay_ssl_verify = yes
|
|
||||||
|
|
||||||
# Write protocol logs for relay connection to this directory for debugging
|
|
||||||
#submission_relay_rawlog_dir =
|
|
||||||
|
|
||||||
# BURL is configured implicitly by IMAP URLAUTH
|
|
||||||
|
|
||||||
protocol submission {
|
|
||||||
# Space-separated list of plugins to load (default is global mail_plugins).
|
|
||||||
#mail_plugins = $mail_plugins
|
|
||||||
|
|
||||||
# Maximum number of SMTP submission connections allowed for a user from
|
|
||||||
# each IP address.
|
|
||||||
# NOTE: The username is compared case-sensitively.
|
|
||||||
#mail_max_userip_connections = 10
|
|
||||||
}
|
|
@ -1,6 +1,24 @@
|
|||||||
|
# https://www.kernel-error.de/2020/05/04/rspamd-automatisch-spam-ham-lernen-mit-dovecot-und-imapsieve/
|
||||||
|
|
||||||
plugin {
|
plugin {
|
||||||
|
sieve_plugins = sieve_imapsieve sieve_extprograms
|
||||||
|
|
||||||
sieve = ~/sieve/.dovecot.sieve
|
sieve = ~/sieve/.dovecot.sieve
|
||||||
sieve_global_path = /data/sieve/default.sieve
|
|
||||||
sieve_dir = ~/sieve
|
sieve_dir = ~/sieve
|
||||||
|
sieve_global_path = /data/sieve/default.sieve
|
||||||
sieve_global_dir = /data/sieve/global/
|
sieve_global_dir = /data/sieve/global/
|
||||||
|
|
||||||
|
# From elsewhere to Spam folder or flag changed in Spam folder
|
||||||
|
imapsieve_mailbox1_name = Junk
|
||||||
|
imapsieve_mailbox1_causes = COPY FLAG
|
||||||
|
imapsieve_mailbox1_before = file:/data/sieve/global/report-spam.sieve
|
||||||
|
|
||||||
|
# From Spam folder to elsewhere
|
||||||
|
imapsieve_mailbox2_name = *
|
||||||
|
imapsieve_mailbox2_from = Junk
|
||||||
|
imapsieve_mailbox2_causes = COPY
|
||||||
|
imapsieve_mailbox2_before = file:/data/sieve/global/report-ham.sieve
|
||||||
|
|
||||||
|
sieve_pipe_bin_dir = /usr/lib/dovecot/sieve
|
||||||
|
sieve_global_extensions = +vnd.dovecot.pipe +vnd.dovecot.environment
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,26 @@
|
|||||||
driver = {{ SQL_TYPE }}
|
driver = {{ SQL_TYPE }}
|
||||||
connect = host={{ SQL_HOST }} dbname={{ SQL_DATABASE }} user={{ SQL_USER }} password={{ SQL_PASSWORD }}
|
connect = host={{ SQL_HOST }} dbname={{ SQL_DATABASE }} user={{ SQL_USER }} password={{ SQL_PASSWORD }}
|
||||||
default_pass_scheme = MD5
|
default_pass_scheme = MD5
|
||||||
user_query = \
|
# user_query = \
|
||||||
SELECT '/data/vmail/' || mb.maildir as home, '*:bytes=' || mb.quota AS quota_rule \
|
# SELECT '/data/vmail/' || mb.maildir as home, '*:bytes=' || mb.quota AS quota_rule \
|
||||||
FROM alias al \
|
# FROM alias al \
|
||||||
LEFT JOIN mailbox mb ON al.goto = mb.username \
|
# LEFT JOIN mailbox mb ON al.goto = mb.username \
|
||||||
WHERE (al.address = '%u' OR al.address = SUBSTR('%u', POSITION('@' in '%u'))) and mb.active = TRUE \
|
# WHERE (al.address = '%u' OR al.address = SUBSTR('%u', POSITION('@' in '%u'))) and mb.active = TRUE \
|
||||||
|
# LIMIT 1
|
||||||
|
|
||||||
|
# password_query = \
|
||||||
|
# SELECT mb.username as user, mb.password as password, '/data/vmail/' || mb.maildir as userdb_home, '*:bytes=' || mb.quota AS userdb_quota_rule \
|
||||||
|
# FROM alias al \
|
||||||
|
# LEFT JOIN mailbox mb ON al.goto = mb.username \
|
||||||
|
# WHERE (al.address = '%u' OR al.address = SUBSTR('%u', POSITION('@' in '%u'))) and mb.active = TRUE \
|
||||||
|
# LIMIT 1
|
||||||
|
|
||||||
|
user_query = SELECT '/data/vmail/' || mb.maildir as home, '*:bytes=' || mb.quota AS quota_rule \
|
||||||
|
FROM mailbox AS mb \
|
||||||
|
WHERE mb.username = '%u' and mb.active = TRUE \
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
|
|
||||||
password_query = \
|
password_query = SELECT mb.username as user, mb.password as password, '/data/vmail/' || mb.maildir as userdb_home, '*:bytes=' || mb.quota AS userdb_quota_rule \
|
||||||
SELECT mb.username as user, mb.password as password, '/data/vmail/' || mb.maildir as userdb_home, '*:bytes=' || mb.quota AS userdb_quota_rule \
|
FROM mailbox AS mb \
|
||||||
FROM alias al \
|
WHERE mb.username = '%u' and mb.active = TRUE \
|
||||||
LEFT JOIN mailbox mb ON al.goto = mb.username \
|
|
||||||
WHERE (al.address = '%u' OR al.address = SUBSTR('%u', POSITION('@' in '%u'))) and mb.active = TRUE \
|
|
||||||
LIMIT 1
|
LIMIT 1
|
@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
RSPAMD_HOSTPORT=$(cat /run/secrets/rspamd/HOSTPORT)
|
||||||
|
RSPAMD_PASSWORD=$(cat /run/secrets/rspamd/PASSWORD)
|
||||||
|
exec /usr/bin/rspamc --password $RSPAMD_PASSWORD -h $RSPAMD_HOSTPORT -S LOCAL_FUZZY_WHITE -w -2 fuzzy_add
|
@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
RSPAMD_HOSTPORT=$(cat /run/secrets/rspamd/HOSTPORT)
|
||||||
|
RSPAMD_PASSWORD=$(cat /run/secrets/rspamd/PASSWORD)
|
||||||
|
exec /usr/bin/rspamc --password $RSPAMD_PASSWORD -h $RSPAMD_HOSTPORT -S LOCAL_FUZZY_DENIED -w 15 fuzzy_add
|
@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
RSPAMD_HOSTPORT=$(cat /run/secrets/rspamd/HOSTPORT)
|
||||||
|
RSPAMD_PASSWORD=$(cat /run/secrets/rspamd/PASSWORD)
|
||||||
|
exec /usr/bin/rspamc --password $RSPAMD_PASSWORD -h $RSPAMD_HOSTPORT learn_ham
|
@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
RSPAMD_HOSTPORT=$(cat /run/secrets/rspamd/HOSTPORT)
|
||||||
|
RSPAMD_PASSWORD=$(cat /run/secrets/rspamd/PASSWORD)
|
||||||
|
exec /usr/bin/rspamc --password $RSPAMD_PASSWORD -h $RSPAMD_HOSTPORT learn_spam
|
@ -0,0 +1,12 @@
|
|||||||
|
require ["vnd.dovecot.pipe", "copy", "imapsieve", "environment", "variables"];
|
||||||
|
|
||||||
|
if environment :matches "imap.mailbox" "*" {
|
||||||
|
set "mailbox" "${1}";
|
||||||
|
}
|
||||||
|
|
||||||
|
if string "${mailbox}" [ "Trash", "train_ham", "train_prob", "train_spam" ] {
|
||||||
|
stop;
|
||||||
|
}
|
||||||
|
|
||||||
|
pipe :copy "rspamd-learn-ham.sh";
|
||||||
|
pipe :copy "rspamd-learn-fuzzy-ham.sh";
|
@ -0,0 +1,15 @@
|
|||||||
|
require ["vnd.dovecot.pipe", "copy", "imapsieve", "environment", "imap4flags"];
|
||||||
|
|
||||||
|
if environment :is "imap.cause" "COPY" {
|
||||||
|
pipe :copy "rspamd-learn-spam.sh";
|
||||||
|
pipe :copy "rspamd-learn-fuzzy-spam.sh";
|
||||||
|
}
|
||||||
|
|
||||||
|
# Catch replied or forwarded spam
|
||||||
|
elsif anyof (allof (hasflag "\\Answered",
|
||||||
|
environment :contains "imap.changedflags" "\\Answered"),
|
||||||
|
allof (hasflag "$Forwarded",
|
||||||
|
environment :contains "imap.changedflags" "$Forwarded")) {
|
||||||
|
pipe :copy "rspamd-learn-spam.sh";
|
||||||
|
pipe :copy "rspamd-learn-fuzzy-spam.sh";
|
||||||
|
}
|
Loading…
Reference in New Issue