External Message Scanners

Top  Previous  Next

Alligate provides support for external command line message scanners. We do offer a AntiSpam add-in that does deeper message scanning, however many users may want to create their own and we also want to encourage third party development.


Third party programmers and developers can create their own message scanning/filtering programs that can performed specialized functions to check for spam, viruses, or almost anything they like.


How it works:


We provide a special service executable that will launch and manage your message scanning executable. It is multi-threaded so it can handle many messages at one time. This service is called AGFILTSVC.EXE. It is installed into the Alligate root folder upon installation, however we do not actually install the service. It is installed simply for those that may want to use it later.


The Alligate filter service, when running, will monitor a special directory called ..\Alligate\Drop. Normally, the SMTP gateway will send all received messages that pass the initial gateway tests to the ..\Alligate\Spool directory where they are processed for delivery to your destination mail server. If you plan on using additional message scanning, either from a third party or something you create yourself, you can tell the gateway to put received messages into the \Drop directory instead of the \Spool directory. You can think of the \Drop directory as a special "limbo zone" where a message awaits custom processing.


When the Alligate filter service detects messages waiting in this folder, it will automatically invoke your third party or custom scanner in a special process thread. The custom scanner will then do whatever processing it is intended to do and then if the message is to be forwarded on to your destination mail server, it will place the message into the \Spool directory and Alligate will take care of things from there.


Creating a command line message scanner:


The command line message scanner can be as simple or as complex as you want it to be. There are a few rules and guidelines that must be followed when creating a custom message scanner.


The command line scanner must be a command line, console type EXE application.
It can not do any screen display whatsoever. It must run silently.
It must reside in the ..\Alligate (root) directory.
The Alligate filter service will launch the command line scanner and pass the name of the xxxxxxxx.DTA file as an argument.
The command line scanner MUST rename this file to a temporary file name (i.e.  xxxxxxxx.DT$) while it is processing the file so that the service does not try to load it again.
There will always be a matching .CTL file for every .DTA file that contains the envelope and other useful information.
When processing is completed, the custom scanner MUST dispose of the message pair in some way. If the message is to be delivered to your mail server, the temporary .DT$ file will need to be moved to the \Spool directory and renamed to .DTA in the process, and the related .CTL file must also be moved at the same time. The message file can be deleted if desired or moved to some other directory as necessary. This is all under the control of the custom scanner.



Installing the Alligate Filter Service:


The Alligate filter service is located in the ..\Alligate folder, however it is not installed by default. It can be controlled by command line operations as follows:


AGFILTSVC.EXE /install Installs the service into the Windows Service Control Manager (SCM).

AGFILTSVC.EXE /start Starts the service. Will also call install if not installed into the SCM.

AGFILTSVC.EXE /stop Stops the service.

AGFILTSVC.EXE /uninstall Uninstalls the service and removes from the SCM.


The Alligate filter service installs as a local system account and has SYSTEM permissions. If your custom filter accesses any other machines for any reason, you must manually change the "Log on as" account to an administrator account that exists on the remote computer.


There are 2 registry settings that must be changed or added to accommodate an external message scanner:




FilterEXE String specifies the name of the external executable scanner. No path info is allowed.

FilterThreads DWORD specifies the maximum number of concurrent threads to run (Defaults to 20)