How do I use External Commands?


This article applies to:

  • Trustwave MailMarshal (SEG)
  • Trustwave ECM/MailMarshal Exchange

Question:

  • How do I use External Commands?

Procedure:

MailMarshal can call on external commands when processing email. There are two ways in which MailMarshal can use external commands.
  • As a basic trigger (rule condition), to initiate an external command when a rule is triggered.
  • MailMarshal activates a command and, depending on the error code returned, a rule is triggered (rule action).
For details of the procedures, see Help for your product version.

Why would I need External Commands?

You may want to write your own custom scripts that can perform processing on the email as it passes through MailMarshal. This would generally be done if the functionality you require is not included in MailMarshal.

Using MailMarshal to trigger an external command

First decide what external command you want to run. This could require you to write a custom DOS batch file, VBS or Java Script. The external command could also be a program file supplied by Trustwave and specifically designed to supplement the capabilities of MailMarshal (such as the Message Release command).

Create a new external command

Expand the menu tree Policy Elements | External Commands, and add a new External Command.  Enter the path to the command. This path must be available on all processing servers.  If you want to pass parameters to the external program the enter them in the Parameter field. 

Now set up a new rule to trigger the external command. For example, a rule could look like this:

When a message arrives

Where message size is greater than 3000KB

Run the External Command MyExternalCmd

And pass the message to next rule for processing.

In this instance, whenever a message larger that 3000KB is received, the external command that you have set up (called MyExternalCmd) is run.

MailMarshal can make a decision based on the result of an External Command

The external command executable should have the capability to return an error code when run. Create your External Command as above. Edit the properties of the External Command to trigger on whatever error level is required e.g. "Command is triggered if error code is greater than zero"

Now set up a new rule which is to be triggered by the external command. For example, a rule could look like this:

When a message arrives

Where Addressed to IT_Group

And where the external command MYExternalCmd is triggered

Move the message to Quarantine.

 

In this instance, whenever a message arrives for IT_Group, the external command that you have set up (called MyExternalCmd) is run. If it returns an error code greater than zero (or whatever you have set the trigger level to), the rule is triggered.

This article was previously published as:
NETIQKB29136
Marshal KB86

Last Modified 3/1/2020.
https://support.trustwave.com/kb/KnowledgebaseArticle10519.aspx