MDaemon’s use of batch files

I’ve recently become aware that not everyone knows what midnight.bat is, so I thought I’d discuss MDaemon’s batch files a little.

MDaemon can act upon a number of batch files in the \MDaemon\App\ directory.

learn.bat — MDaemon creates this one each time a spamlearn session is about to run. Do not edit this file, your changes will simply be overwritten. Feel free to run this batch file yourself or through a scheduler if you wanted to schedule learning manually.

mylearn.bat — Each time MDaemon is about to run learn.bat, MDaemon will first look for the existance of mylearn.bat. If mylearn.bat exists, it will be run instead of learn.bat. If you want to modify learn.bat’s behaviour, copy it to mylearn.bat and edit to your heart’s content, just be warned that if you change any options in MDaemon’s spam learning dialog, you need to update mylearn.bat manually.

cleanup.bat — This is similar to learn.bat, but is used by MDaemon to launch the accountpruner and listpruner. Like learn.bat, you shouldn’t edit this file, your changes will be eaten.

mycleanup.bat — This is similar to mylearn.bat, but applies to cleanup.bat’s functionality. All the same rules and caviets apply.

midnight.bat — This batch file is executed by MDaemon at midnight each night. The purpose is as a simple scheduler, to allow you to run your own mycleanup.bat type tasks, but without disabling cleanup.bat in the process.

startup.bat — This batch file is executed as part of MDaemon’s startup process. This allows you to do some scheduled/scripted cleanup when MDaemon starts. You can also start or stop other services here.

In all cases, if the batch file you want doesn’t exist, you can create it.

ORDB.org blacklisting all IP addresses

Since yesterday, March 25 ORDB.org – one of the old SPAM blacklist databases – started to blacklist all IP addresses. As a result, all mail servers using a spam filtering solution that still references ORDB (relays.ordb.org) started to immediately block all incoming e-mails. I got some reports into my personal e-mail yesterday, that finally got fixed by my provider today.

If you’re running MDaemon 9.60 or newer (released June 12, 2007) then MDaemon’s installer automatically removed relays.ordb.org from your spam blocker configuration, but if you’re on an earlier version you might want to double check your configuration.

To check to see whether or not you’re using ORDB, open the MDaemon GUI, go to the Security menu, look for either “DNS Blacklist” (in newer versions) or “Spam Blocker” (older versions), and see if you see any mention of “ordb.org” in your list — If you find it, select and remove that entry and you should be good to go.

Although ORDB.org was shut down on December 18, 2006, yesterday they changed their behaviour, and instead of timing out, they are blocking all IP addresses, that is, every e-mail server queried is being reported as an open relay — Depending on your configuration, this may result in all mail being blocked, or it may simply increase the chances that legitimate mail is treated as spam.

Relying on upstream ISP spamassassin

In a default configuration, MDaemon automatically removes the existing X-Spam-Flag header on inbound mail so that pre-inserted headers don’t interfere with your local SpamAssassin configuration.

In certain cases, such as where your ISP inserts a trusted X-Spam-Flag header of their own, you may want to change this behaviour.

Changing this is pretty simple; Go to Setup –> Misc Options –> [Headers] tab, uncheck the “Strip ‘X-Spam-Flag’ option” and MDaemon will stop stripping the header.

Now, be aware you can’t use this header as input to SpamAssassin if it’s the same header that your SpamAssassin outputs, but you could use the content filter if you wanted to set this to yes if the ISP *or* local MDaemon say “Yes”

So, if you’re running a local copy of SpamAssassin too, you’ll need to make some changes.

First, edit the 10_misc.cf file and comment or change the “add_header spam Flag _YESNOCAPS_” line.

If you changed it to “add_header spam FlagX _YESNOCAPS_” then you’ll get a header called X-Spam-FlagX instead and you can use this internally.

NOTE: Normally I would not recommend editing the built-in files, normally we suggest you use local.cf or your own CF file. This is an exception as there is no way to “undo” this command, you need to remove it entirely. Also be aware that whenever you upgrade MDaemon, these changes will need to be re-done.

Once the appropriate “add_header” entry is changed, you can either use the content filter or your local SpamAssassin itself to filter on the X-Spam-Flag header.