Please enable JavaScript to view this site.

SecurityGateway for Email Servers v9.0

Navigation: Security

Sieve Scripts

Scroll Prev Top Next More

Sieve is a proposed standard email filtering language that is extensible and highly versatile. SecurityGateway makes extensive use of Sieve scripts in its core functionality, uses Sieve as the basis of the Message Content Filtering feature, and supports custom scripts that can be used for a large variety of purposes. There are two categories of scripts used by SecurityGateway, managed from the Sieve Scripts page:

System Generated—SecurityGateway's core functionality is implemented by these scripts. When a configuration change is made via the administrative interface, the script that is associated with the changed option is modified on the Sieve Scripts page. This is the only way that system generated scripts can be modified; they are read only and therefore cannot be edited directly on the Sieve Scripts page. However, even though you cannot edit the system generated scripts themselves, you can use the up and down arrows associated with each listed script to rearrange the order in which they will be processed.

Administrator Defined—you can use the Sieve Scripts page to create your own custom scripts, and because Sieve provides such flexible filtering methodology, you can define any number of these scripts to suit your specific needs. However, a basic working knowledge of SMTP and scripting with the Sieve filtering language is required to create these scripts. SecurityGateway’s implementation of Sieve includes the base language, several standard extensions, and a significant number of custom extensions.

Although basic information about Sieve and how it is used in SecurityGateway is provided here and on the Creating Sieve Scripts and SecurityGateway Sieve Extensions pages, a complete discussion of the language itself is beyond the scope of this guide. For more information on Sieve, you should review the authoritative documents online at the IETF web site: Sieve: An Email Filtering Language (RFC-5228), Sieve's Copy Extension (RFC 3894), Sieve's Body Extension (RFC-5173), Sieve's Reject Extension (RFC-5429), Sieve's Variables Extension (RFC-5229), and Spamtest and VirusTest Extensions (RFC-3685).

Sieve Script List

The Sieve Script page contains a list of all system generated and administrator defined scripts. The list contains six sections: IP, HELO, AUTH, MAIL, RCPT, and DATA. These sections correspond to the various stages or Mail Events of the SMTP process, with each script listed in the section to which it relates. Scripts are processed one section at a time, global scripts first and domain specific scripts second, in the order that they are listed. You can control the order in which the scripts are processed in each section by using the up and down arrows associated with a given script to change its position in the list.

The toolbar at the top of the page contains the following three options:

New

Click New to open the Sieve Script Editor, used for creating your script.

Edit

Select a script and then click Edit on the toolbar to open it in the Sieve Script Editor. Alternatively, you can simply double-click the script. System generated scripts cannot be edited, but they can still be opened in the script editor for review or to copy the text of the script so that you can paste it into a new, custom rule.

Delete

To delete a custom script, select it in the list and then click Delete. A box will open asking you to confirm the decision to delete the script. System generated scripts cannot be deleted.

 

The script list has the following five columns:

Enabled

This column has a checkbox for each listed script, so that you can quickly enable or disable a script by checking or clearing its corresponding box. Only custom scripts can be enabled and disabled using this option. To enable or disable a system generated script you must use the interface's controls that correspond to the feature associated with that script (i.e. Greylisting, IP Shielding, Bayesian Auto Learning, and so on).

Scope

This column lists the scope of the script. The scope can be "Global" or domain specific. Global scripts are processed for all messages. Domain specific scripts are only processed for the associated domain's messages.

Order

Scripts are processed in the order in which they are listed. If you wish to change their order then you can use the up and down arrows in this column to rearrange them.

Script Name

This is a title or descriptive name used to identify the script. You will designate this name when you create a custom script.

Script

Hover your mouse over this icon to see the script's text displayed in a tooltip. If you wish to examine a script's text more thoroughly then double-click the script to open it in the Sieve Script Editor.

Sieve Script Editor

The Sieve Script Editor is opened whenever you click New or Edit on the Sieve Script page's toolbar. It is used both to create new Sieve Scripts and to edit existing ones. After using the editor to create or edit your script, click Save and Close on the toolbar to save the script and return to the Sieve Scripts page.

Script Properties

Enable processing of this script

This box corresponds to the Enabled column in the Sieve Script list. By default, scripts are enabled when you create them, meaning that they will be added to the list of scripts and processed during the Mail Event designated below. Clear this box if you wish to disable the script. When disabled, the script will still appear in the list but will not be processed with the others. Further, system generated scripts cannot be enabled or disable with this option. They must be managed via the options on the various interface pages corresponding to the specific scripts.

Script Name:

Use this text box to designate a title or descriptive name for your script. System generated scripts cannot be renamed.

Mail Event:

When creating a script, use this drop-down list to choose the mail event or stage of the SMTP session during which you wish the script to be processed. For example, if you create a script that compares something to the recipient of a message, then you would choose either RCPT or DATA in this option since the recipient of the message isn't known until the RCPT phase of the SMTP session is reached. The six mail events, listed in the order in which they occur, are: IP, HELO, AUTH, MAIL, RCPT, and DATA.

Scope:

Use this option to designate the scope of the script: Global or Domain. When Global is chosen the script will be processed regardless of the domain to which the message is addressed. When Domain is chosen the script will only be tested against messages for the domain that you designate. Domain can only be chosen when the RCPT or DATA Mail Event is selected above, because the recipient's domain isn't known before those phases of the SMTP process.

Domain:

When you select Domain as the Scope of the script, this drop-down list will appear. Use it to choose the specific domain that you wish to associate with this script.

Script Text:

Use this area to enter the actual text of your script, using the Sieve email filtering language. For example scripts and basic information on the Sieve language, see: Creating Sieve Scripts.