freebsd_mailserver_sieve

freebsd_mailserver_sieve

quality Build Status GitHub tag

Ansible role. FreeBSD. Install and configure dovecot-pigeonhole (Sieve RFC5228).

Feel free to share your feedback and report issues.

Contributions are welcome.

Requirements and dependencies

Roles

The dependencies are not listed in the meta file. Install them manually.

Collections

  • community.crypto
  • community.general

Variables

See the defaults and examples in vars.

Workflow

  1. Change shell to /bin/sh if necessary
shell> ansible mailserver -e 'ansible_shell_type=csh ansible_shell_executable=/bin/csh' -a 'sudo pw usermod freebsd -s /bin/sh'
  1. Install roles
shell> ansible-galaxy role install vbotka.freebsd_mailserver
shell> ansible-galaxy role install vbotka.freebsd_mailserver_sieve
shell> ansible-galaxy role install vbotka.ansible_lib
  1. Install collections if necessary
shell> ansible-galaxy collection install community.crypto
shell> ansible-galaxy collection install community.general
  1. Fit variables to your needs.

  2. Create the playbook and inventory

shell> cat freebsd-mailserver-sieve.yml

- hosts: mailserver
  roles:
    - vbotka.freebsd_mailserver
    - vbotka.freebsd_mailserver_sieve
shell> cat hosts
[mailserver]
<mailserver-ip-or-fqdn>
[mailserver:vars]
ansible_connection=ssh
ansible_user=freebsd
ansible_become=yes
ansible_become_method=sudo
ansible_python_interpreter=/usr/local/bin/python3.9
ansible_perl_interpreter=/usr/local/bin/perl
  1. Install and configure Sieve.
shell> ansible-playbook freebsd-mailserver-sieve.yml
  1. Consider to test the mailserver with http://mxtoolbox.com/

User configuration

  1. Create .forward in user home directory
shell> cat .forward
| "/usr/local/libexec/dovecot/dovecot-lda"
  1. Create filter /home/user/sieve/managesieve.sieve
require ["fileinto"];
# rule:[spam-01]
if allof (header :contains "subject" "*****SPAM*****")
{
    fileinto "Spam";
    stop;
}
# rule:[spam-02]
if header :contains "X-Spam-Flag" "YES" {
  fileinto "Spam";
       }
  1. Create directory for spam
~/Maildir/Spam

If this directory shall be visible in the Roundcube webmail create the Spam directory in Roundcube Settings->Folders

Ansible lint

Use the configuration file .ansible-lint.local when running ansible-lint. Some rules might be disabled and some warnings might be ignored. See the notes in the configuration file.

shell> ansible-lint -c .ansible-lint.local

References

License

license

Author Information

Vladimir Botka

About

FreeBSD. Install and configure Dovecot-pigeonhole (Sieve RFC5228).

Install
ansible-galaxy install vbotka/ansible-freebsd-mailserver-sieve
GitHub repository
License
bsd-2-clause
Downloads
35