summaryrefslogtreecommitdiffstats
path: root/roles/IMAP/tasks/spam.yml
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2013-12-09 08:11:16 +0100
committerGuilhem Moulin <guilhem@fripost.org>2015-06-07 02:51:17 +0200
commit7c089f71667a1a14cc508772ca289d4d1d2edd27 (patch)
tree2858164a1015603ebb8f2478b920e84a7dd62dd6 /roles/IMAP/tasks/spam.yml
parent185cf14065554038820c696e7d35f47017b43783 (diff)
Configure the content filter.
Antispam & antivirus, using ClamAV and SpamAssassin through Amavisd-new. Each user has his/her amavis preferences, and own Bayes filter (to maximize privacy). One question remains, though: how to set spamassassin's trusted_networks / internal_networks / msa_networks? It seems not obivious to get it write with IPSec and dynamic IPs. (Cf. https://wiki.apache.org/spamassassin/AwlWrongWay)
Diffstat (limited to 'roles/IMAP/tasks/spam.yml')
-rw-r--r--roles/IMAP/tasks/spam.yml51
1 files changed, 51 insertions, 0 deletions
diff --git a/roles/IMAP/tasks/spam.yml b/roles/IMAP/tasks/spam.yml
new file mode 100644
index 0000000..d326656
--- /dev/null
+++ b/roles/IMAP/tasks/spam.yml
@@ -0,0 +1,51 @@
+- name: Install spamassassin
+ apt: pkg={{ item }}
+ with_items:
+ - razor
+ - spamassassin
+ - spamc
+ - libdbi-perl
+ notify:
+ - Restart Amavis
+
+- name: Create a 'spamassassin' database
+ mysql_db: name=spamassassin state=present
+ encoding=latin1 collation=latin1_general_ci
+ notify:
+ - Copy SQL tables for spamassassin
+ - Create SQL tables for spamassassin
+
+- meta: flush_handlers
+
+- name: Copy SpamAssassin's configuration
+ copy: src=etc/{{ item }}
+ dest=/etc/{{ item }}
+ owner=root group=root
+ mode=0644
+ with_items:
+ - spamassassin/local.cf
+ - spamassassin/v310.pre
+ notify:
+ - Restart Amavis
+
+- name: Ensure SpamAssassin is not auto-started at boot time
+ lineinfile: dest=/etc/default/spamassassin
+ regexp='^(\s*#)?\s*ENABLED='
+ line='ENABLED=0'
+ owner=root group=root
+ mode=0644
+
+- name: Create a 'amavis' SQL user
+ # This *must* be the user we run spamd as
+ # See https://svn.apache.org/repos/asf/spamassassin/trunk/sql/README.bayes
+ mysql_user: >
+ name=amavis auth_plugin=auth_socket
+ priv="spamassassin.awl: SELECT,INSERT,UPDATE,DELETE
+ /spamassassin.bayes_seen: SELECT,INSERT, DELETE
+ /spamassassin.bayes_token: SELECT,INSERT,UPDATE,DELETE
+ /spamassassin.bayes_global_vars: SELECT
+ /spamassassin.bayes_vars: SELECT,INSERT,UPDATE,DELETE
+ /spamassassin.bayes_expire: SELECT,INSERT, DELETE"
+ state=present
+ notify:
+ - Restart Amavis