freebsd_mailserver_sieve
freebsd_mailserver_sieve
Ansible role. FreeBSD. Install and configure dovecot-pigeonhole (Sieve RFC5228).
Feel free to share your feedback and report issues.
Requirements and dependencies
Roles
The dependencies are not listed in the meta file. Install them manually.
- vbotka.freebsd_mailserver Install and configure Postfix and Dovecot.
- vbotka.ansible_lib Library of Ansible tasks.
Collections
- community.crypto
- community.general
Variables
See the defaults and examples in vars.
Workflow
- 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'
- 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
- Install collections if necessary
shell> ansible-galaxy collection install community.crypto
shell> ansible-galaxy collection install community.general
Fit variables to your needs.
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
- Install and configure Sieve.
shell> ansible-playbook freebsd-mailserver-sieve.yml
- Consider to test the mailserver with http://mxtoolbox.com/
User configuration
- Create .forward in user home directory
shell> cat .forward
| "/usr/local/libexec/dovecot/dovecot-lda"
- 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";
}
- 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
Author Information
About
FreeBSD. Install and configure Dovecot-pigeonhole (Sieve RFC5228).
Install
ansible-galaxy install vbotka/ansible-freebsd-mailserver-sieve
License
bsd-2-clause
Downloads
38
Owner