How to change or add sieve scripts in SecurityGateway

This article explains how to configure SecurityGateway’s sieve scipts system, including adding a new script for processing of incoming mail, or to change the order in which scripts are processed, if you wish to run a certain script before another.

From the Dashboard, after logging in:

  1. Click on Security in the lower-left corner.
  2. Click on Sieve Scripts, under the Advanced sub-section, on the left.

You will then see SecurityGateway’s Sieve Scripts list, with a number of default scripts corresponding to the various security processes that are run on incoming messages. The list is divided into multiple categories, depending on what event of the incoming session they pertain to:

  • IP, for scripts relating to checking the connecting IP address, or host.
  • HELO, for scripts related to checking the information given in the connecting host’s HELO/EHLO command.
  • AUTH, for scripts related to SMTP authentication, if the connecting host either elect to authenticate or not.
  • MAIL, for scripts related to the address given in the MAIL FROM command.
  • RCPT, for scripts related to the address given in the RCPT TO command.
  • DATA, for scripts related to the DATA command, and on the message sent to the server.

There are also a number of columns, describing information about the scripts:

  • Enabled, which shows if the script is currently being used or not. This can be checked on or off to determine status. Note that the default scripts cannot be enabled or disabled via the sieve scripts list, and must be changed from their corresponding section.
  • Scope, which shows if the script affects all connections coming into the server, or only ones for specific domains. Note that only RCPT and DATA sieve scripts can have a specific domain scope.
  • Order, which allows you to change the order in which SecurityGateway runs the scripts for that particular category. Click on the up-arrow or down-arrow to move the script up or down the list as you choose. Note that script at the very top, or very bottom, will have the up-arrow and down-arrow greyed out, respectively.
  • Script Name, which is the name of the particular script.
  • Script, denoted by an icon which looks like a magnifying glass which when hovered over will display he script’s code.

To add a new rule, click on the New button along the top to bring up the Rule Editor window, and specify the name of the rule, which event during the connection process that it applies to, and choose either a global scope to affect the entire server, or a specific domain. Choosing Domain will bring up a fourth option to specify which domain it applies to. Once you are done, click on Save and Close to close the window.

To edit a rule, select the rule in question you wish to edit, and click on Edit along the top to bring up the Rule Editor window. Make any changes to it you wish, then click on Save and Close to close out the window. Note that system defined scripts (scripts created automatically by SecurityGateway by changing settings) cannot be edited directly.

More information on how to create new sieve-rules can be found in the SecurityGateway helpfile, which can be opened by clicking the ‘Help’ link in the upper-right corner of the SecurityGateway window.