From 724d877995dfcc10c462a18dcb4ea6c8b60c2d03 Mon Sep 17 00:00:00 2001 From: Sam Chudnick Date: Sun, 2 Jul 2023 19:04:30 -0400 Subject: initial commit --- roles/spamassassin/defaults/main.yml | 0 roles/spamassassin/files/defaults | 9 +++++++ roles/spamassassin/handlers/main.yml | 0 roles/spamassassin/tasks/main.yml | 40 ++++++++++++++++++++++++++++++++ roles/spamassassin/templates/local.cf.j2 | 18 ++++++++++++++ 5 files changed, 67 insertions(+) create mode 100644 roles/spamassassin/defaults/main.yml create mode 100644 roles/spamassassin/files/defaults create mode 100644 roles/spamassassin/handlers/main.yml create mode 100644 roles/spamassassin/tasks/main.yml create mode 100644 roles/spamassassin/templates/local.cf.j2 (limited to 'roles/spamassassin') diff --git a/roles/spamassassin/defaults/main.yml b/roles/spamassassin/defaults/main.yml new file mode 100644 index 0000000..e69de29 diff --git a/roles/spamassassin/files/defaults b/roles/spamassassin/files/defaults new file mode 100644 index 0000000..a38795c --- /dev/null +++ b/roles/spamassassin/files/defaults @@ -0,0 +1,9 @@ +OPTIONS="--listen /var/run/spamd.sock --max-children 5 --socketpath=/var/spool/postfix/spamd/spamd.sock --socketowner root --socketgroup root --socketmode 0666" + +PIDFILE=/var/run/spamd.pid + +# Cronjob +# Set to anything but 0 to enable the cron job to automatically update +# spamassassin's rules on a nightly basis +CRON=1 + diff --git a/roles/spamassassin/handlers/main.yml b/roles/spamassassin/handlers/main.yml new file mode 100644 index 0000000..e69de29 diff --git a/roles/spamassassin/tasks/main.yml b/roles/spamassassin/tasks/main.yml new file mode 100644 index 0000000..4c69be5 --- /dev/null +++ b/roles/spamassassin/tasks/main.yml @@ -0,0 +1,40 @@ +- name: install packages + package: + name: + - spamassassin + state: latest + +- name: make directory in postfix chroot + file: + path: /var/spool/postfix/spamd + owner: root + group: root + mode: '0755' + state: directory + +- name: deploy configuration + template: + src: local.cf.j2 + dest: /etc/spamassassin/local.cf + owner: root + group: root + mode: '0644' + +- name: deploy defaults file + copy: + src: defaults + dest: /etc/default/spamd + owner: root + group: root + mode: '0644' + +- name: enable spamassassin + systemd: + enabled: yes + masked: no + name: spamd + +- name: restart spamassassin + service: + name: spamd + state: restarted diff --git a/roles/spamassassin/templates/local.cf.j2 b/roles/spamassassin/templates/local.cf.j2 new file mode 100644 index 0000000..1fdc978 --- /dev/null +++ b/roles/spamassassin/templates/local.cf.j2 @@ -0,0 +1,18 @@ +# SpamAssassin Configuration +# Clearly indicate message is spam to user +rewrite_header Subject *****SPAM***** +rewrite_header From *****SPAM***** + +# Halves default spam score thus implementing a very strict spam policy +# Comment or edit as needed for your deployment +required_score {{ spam_score }} + +# Attach original messages as text/plain instead of message/rfc822 to spam reports +# This is basically a safety net to prevent mail clients from automatically loading +# attached spam messages. Note though that this makes the original message harder to recover +# If this is not something you are worried about, comment the next line to use the default. +report_safe 2 + +# This specifies languages considered OK for incoming mail +# If you expect to receive mail in non-western character sets, comment or edit as needed +ok_locales {{ sa_locales }} -- cgit v1.2.3