Fight against spam part 5 – Dovecot Sieve

From previously posts we started using 4 different technologies to stop spam from reaching our server or being scanned by our rules.

But if any spam will reach us those application wont delete them or do anything with them because we don’t want to lost mail that was send from poorly configure mail server – maybe its important one.

If we use postfix with dovecot we could use dovecot to manipulate emails via IMAP protocol. Sieve is the tool we need that will move mails between folder.

Instalation:

Almost there:

Let sieve know about new rules:

Final restart to make it work:

 

Now if SpamAssassin mark mail as spam it will be move to JUNK folder.

 

Rest post related to this topic:

Postfix i Dovecot – perfect duo for mail server

Fight against spam part 1 – Postfix SPF

Fight against spam part 2 – Postfix DKIM

Fight against spam part 3 – Postfix DMARC

Fight against spam part 4 – Postfix SpamAssassin

Facebooktwittergoogle_plusreddit

Linux – Viewing emails with mailq and postcat

Installing and using postfix will give you ability to view mails processed by it:

 

Facebooktwittergoogle_plusreddit

Dovecot – Proper IDLE timeout for android phones

If you are using your own imap server with android you could (but not nesesery) notice bigger battery drain and email application being on top of application that drain battery.

This could be a server side problem, because default dovecot configuration have idle_timeout set to 2minuts, so basicly every 2 minuts your phone query/poll imap server information about new emails – which results in higher battery drain.

Lets evalueate this with simple shell command:

This should result i:

The interval between each ‘OK still here’ is that your imap clean see/does. By default this should be 2minut interval.

Let us change this:

systemctl restart dovecot.service

And we are done.

Facebooktwittergoogle_plusreddit

Mikrotik – Send email with information about clients connecting to WiFi network

Mikrotik devices give a lot of configuration options to play with, and this post is one of those configuration which automatically register information about login/logouts in wifi network, and at daily basis send them to custom email address.

Let assume you have already configure email capability in mikrotik system.

Next we want to set topic of information we want to store to file (ex. wifi.log):

Next lets create script that will be backuping log file, send it to your email account, delete backup to free up some space and delete user that will do those things to not make it a easy target:

 

Don’t forget to setup scheduler that will run our script on daily basis:

 

Facebooktwittergoogle_plusreddit

Postfix i Dovecot – perfect duo for mail server

Own mail server? Would be awesome! If you just ask ‘why’ this tutorial is not for you 😉

Goals:

  • own postfix and dovecot server
  • support for virtual accounts
  • disable system accounts support
  • use database as account backend

 

1. Instalation

General type of mail configuration: Internet Site

System mail name: domian.name

2. Mysql/MariaDB backend

First prepare backend:

 

Most important postfix config file main.cf

Next let us create configuration files for virtual account support:

Restart postfix:

 

This will test if postfix ‘see’ virtual account from database:

 

Next we need to edit other postfix config file master.cf

This looked scary but to be sure I included full config file, because there could be changes made in newest version to default config files.

Just reset postfix because we finish configure him 🙂

 

3. Dovecot

First we make backup of files that we will edit:

Edit dovecot.conf

Let us comment and uncomment lines according with this code:

We need to create vmail account

Restart dovecot

4. Adding more account to backend

 

5. SPAM

If you are interested, there are some post about way to fight with spam:

Fight against spam part 1 – Postfix SPF

Fight against spam part 2 – Postfix DKIM

Fight against spam part 3 – Postfix DMARC

Fight against spam part 4 – Postfix SpamAssassin

Fight against spam part 5 – Dovecot Sieve

 

Facebooktwittergoogle_plusreddit