diff --git a/templates/dovecot/conf.d/15-mailboxes.conf.j2 b/templates/dovecot/conf.d/15-mailboxes.conf.j2 index f99752c..ad0e6c9 100644 --- a/templates/dovecot/conf.d/15-mailboxes.conf.j2 +++ b/templates/dovecot/conf.d/15-mailboxes.conf.j2 @@ -50,21 +50,28 @@ namespace inbox { # These mailboxes are widely used and could perhaps be created automatically: mailbox Drafts { + auto = subscribe special_use = \Drafts } +{% if ansible_local['mailserver_have_antispam'] %} mailbox Junk { + auto = subscribe special_use = \Junk } +{% endif %} mailbox Trash { + auto = subscribe special_use = \Trash } # For \Sent mailboxes there are two widely used names. We'll mark both of # them as \Sent. User typically deletes one of them if duplicates are created. mailbox Sent { + auto = subscribe special_use = \Sent } mailbox "Sent Messages" { + auto = subscribe special_use = \Sent } diff --git a/templates/dovecot/conf.d/90-sieve-extprograms.conf.j2 b/templates/dovecot/conf.d/90-sieve-extprograms.conf.j2 deleted file mode 100644 index 7ac80e7..0000000 --- a/templates/dovecot/conf.d/90-sieve-extprograms.conf.j2 +++ /dev/null @@ -1,75 +0,0 @@ -############################################################################ -########### Managed by ansible (role: mailserver), do not edit! ############ -############################################################################ - -# Sieve Extprograms plugin configuration - -# Don't forget to add the sieve_extprograms plugin to the sieve_plugins setting. -# Also enable the extensions you need (one or more of vnd.dovecot.pipe, -# vnd.dovecot.filter and vnd.dovecot.execute) by adding these to the -# sieve_extensions or sieve_global_extensions settings. Restricting these -# extensions to a global context using sieve_global_extensions is recommended. - -plugin { - - # The directory where the program sockets are located for the - # vnd.dovecot.pipe, vnd.dovecot.filter and vnd.dovecot.execute extension - # respectively. The name of each unix socket contained in that directory - # directly maps to a program-name referenced from the Sieve script. - sieve_pipe_socket_dir = sieve-pipe - #sieve_filter_socket_dir = sieve-filter - #sieve_execute_socket_dir = sieve-execute - - # The directory where the scripts are located for direct execution by the - # vnd.dovecot.pipe, vnd.dovecot.filter and vnd.dovecot.execute extension - # respectively. The name of each script contained in that directory - # directly maps to a program-name referenced from the Sieve script. - #sieve_pipe_bin_dir = /usr/lib/dovecot/sieve-pipe - #sieve_filter_bin_dir = /usr/lib/dovecot/sieve-filter - #sieve_execute_bin_dir = /usr/lib/dovecot/sieve-execute -} - -# An example program service called 'do-something' to pipe messages to -#service do-something { - # Define the executed script as parameter to the sieve service - #executable = script /usr/lib/dovecot/sieve-pipe/do-something.sh - - # Use some unprivileged user for executing the program - #user = dovenull - - # The unix socket located in the sieve_pipe_socket_dir (as defined in the - # plugin {} section above) - #unix_listener sieve-pipe/do-something { - # LDA/LMTP must have access - # user = vmail - # mode = 0600 - #} -#} - -{% if ansible_local['mailserver_have_antispam'] %} -# For additional security, the sa-learn pipe scripts are not directly executed -# with the vmail user but used as a service that listenes on a pipe -service sieve-pipe-script { - executable = script /etc/dovecot/sieve/bin/sa-learn-spam.sh - user = vmail - process_min_avail = 8 - process_limit = 32 - unix_listener sieve-pipe/sa-spam { - user = {{ mailserver_mailbox_user }} - group = {{ mailserver_mailbox_group }} - mode = 0660 - } -} - -service sieve-pipe-script { - executable = script /etc/dovecot/sieve/bin/sa-learn-ham.sh - user = vmail - process_min_avail = 8 - process_limit = 32 - unix_listener sieve-pipe/sa-ham { - user = {{ mailserver_mailbox_user }} - group = {{ mailserver_mailbox_group }} - mode = 0660 - } -} -{% endif %} diff --git a/templates/dovecot/sieve/report-ham.sieve.j2 b/templates/dovecot/sieve/report-ham.sieve.j2 index 33e6c5b..79506fc 100644 --- a/templates/dovecot/sieve/report-ham.sieve.j2 +++ b/templates/dovecot/sieve/report-ham.sieve.j2 @@ -2,7 +2,7 @@ ########### Managed by ansible (role: mailserver), do not edit! ############ ############################################################################ -require ["copy"]; +require ["variables", "copy", "environment"]; if environment :matches "imap.mailbox" "*" { set "mailbox" "${1}"; @@ -12,4 +12,4 @@ if string "${mailbox}" "Trash" { stop; } -redirect :copy "__spamuser_spam@{{ mailserver_domain }}"; +redirect :copy "__spamuser_ham@{{ mailserver_domain }}"; diff --git a/templates/dovecot/users.j2 b/templates/dovecot/users.j2 index 89935fd..5611fae 100644 --- a/templates/dovecot/users.j2 +++ b/templates/dovecot/users.j2 @@ -1,2 +1,2 @@ -__spamuser_spam:{plain}password::::: -__spamuser_ham:{plain}password::::: +__spamuser_spam:{plain}password:vmail:vmail::/var/mail/boxes/__spamuser_spam:/usr/sbin/nologin:userdb_mail=mbox:/var/mail/boxes/__spamuser_spam +__spamuser_ham:{plain}password:vmail:vmail::/var/mail/boxes/__spamuser_spam:/usr/sbin/nologin:userdb_mail=mbox:/var/mail/boxes/__spamuser_ham diff --git a/templates/postfix/main.cf.j2 b/templates/postfix/main.cf.j2 index c85ae85..af97208 100644 --- a/templates/postfix/main.cf.j2 +++ b/templates/postfix/main.cf.j2 @@ -212,9 +212,11 @@ non_smtpd_milters = inet:127.0.0.1:42420 {% endif %} {% if ansible_local['mailserver_have_antispam']|default(False) %} +{% if antispam_amavis|default(False) %} # Pass incoming messages through amavis for virus checks # Spamassassin is done elsewhere content_filter = amavisfeed:[127.0.0.1]:10024 +{% endif %} # Remove repeated Received headers from amavis header_checks = pcre:/etc/postfix/cleanup-headers {% endif %}