Rules Files

 

The Selor server has events that we can execute a rule or indicate a file with rules where we can make many tests and actions. The true control of your email server is in this rules files.

When a event occurs, the server calls these rules or rules files.
Example:
When a customer or remote host connects on port 25 of your server, the event 'Connection' (Event.connection) occurs and the rule ou rules-file specified by option Event.connection is executed.

Here are the events of MTA Selor:

 Event name  Option Event description
Limit  Event.limit  Event called when a probable DoS attack is detected
Connection  Event.connection  Event called when the server receives a new TCP/IP connection
 Helo  Event.helo Event called when the SMTP command helo or ehlo is passed
 From  Event.from Event called when the connected host specify a sender address
 Rcpt  Event.rcpt Event called when the connected host specify a recipient address
 Data  Event.data Event called when the connected host finishes to send the message of email
 Qend_process  Event.qend_process Event called when the connected host finishes to process a queue file. This event can be used to execute programs and analyze the email message.
Error_report Event.error_report Event called when the Selor will report a MAILER-DAEMON
Dl_rcpt Event.dl_rcpt Event called when the Selor receives a answer from remote host about the recipient specified during 'rcpt to' command.
Lrcpt_refused Event.lrcpt_refused Event called when a local recipient is refused

 

The rules can be created by conditions and actions. All conditions has the character '?' at end and actions has the character '!'
The actions will execute whether all conditions that precede are true
Example of a rule:

From? "user@domainexample.net" Reply! "550 This sender is not allowed to deliver messages here" Deny!

This rule checks if the sender is 'user@domainexample.net', if is true, then action 'Reply!' is executed and the answer "550 This sender is not allowed to deliver messages here" is sent to remote host and after this, the 'Deny!' action is executed and this address is refused

This rule can be inserted in rules file specified by options: Event.from, Event.rcpt e Event.data.

You can use multiple conditions and actions in same rule.
The Selor server reads these rules from left to right, then, when a condition is false the processing of current line is canceled and the next line of file is executed

Is not needed restart the Selor when you change a rules file. The restart of Selor Daemon is only needed when you change the selor.conf
You must see the next chapter where a list of all conditions and actions of MTA Selor is available.

 

 

Here is a diagram of SMTP protocol and its events

 

SMTP Protocol and its events

 

Powered by C - Assembly