Frequently Asked Questions - Troubleshooting
Common problems and how to fix them.
Symptom: When you build MIMEDefang, it detects SpamAssassin just fine. But when you run it, it doesn't seem to find the SpamAssassin Perl modules.
Probable Cause: This is often caused by a permissions problem. Make sure all of the SpamAssassin Perl modules and data files are world-readable.
Underlying Cause: What made the file permissions wrong in the first place? Some installation scripts will explicitly change the permissions on all files they install. Others will just create the files, meaning they get created with whatever are the default permissions for the user. Since most installs are done by root, you need to look at root's umask setting to see what the default permissions are.
Symptom: Network-related SpamAssassin tests don't seem to have any effect.
Probable Cause: These tests must be specially enabled when SpamAssassin is used in conjunction with MIMEDefang. To enable them, you must do two things:
- Enable them in the file /etc/mail/spamassassin/sa-mimedefang.cf. MIMEDefang uses this file for its global SpamAssassin configuration.
- In your filter, add the line: $SALocalTestsOnly = 0;
You may also need to add these lines to /etc/mail/spamassassin/sa-mimedefang.cf:
use_dcc 1 dcc_timeout 10 dcc_path /usr/local/bin/dccproc
(Substitute appropriate paths for your system.)
Symptom: I used action_add_header to add a new "To:" (or "Cc:" or "Bcc:") field to a message, or used action_change_header to change the "To:" field, but the message didn't go where I thought it should.
Cause: Changing headers does not change the destination of the email message. That is controlled by the envelope recipient(s) in the SMTP dialog. You will have to use add_recipient and/or delete_recipient to change the destination for a message.
Symptom: I configured SpamAssassin to add the spam score to the subject, but it won't do it.
Cause: When you run SpamAssassin under MIMEDefang, SpamAssassin cannot change the message in any way. If you want to add any spam-related headers, you will have to do this in your rules file (mimedefang-filter). Most people seem to do this in filter_end (after all parts have been checked for viruses). The sample filter has code to call SA and add an X-Spam-Score: header to messages SA tags as spam.
If you want to change the subject, use something like this in filter_end:
action_change_header('Subject', "***SPAM*** $Subject");
Symptom: I am running MIMEDefang, but now I am getting a lot of messages in my syslog that look like this:
Milter change: header MIME-Version: from 1.0 to 1.0
Cause: It is actually the Milter engine of sendmail that is logging all those. To reduce the amount of logging, try putting this line:
in your sendmail.mc file and then re-generate your sendmail.cf.
MIMEDefang runs as the configured defang user, hence, SpamAssassin's integration into MIMEDefang runs as this user, too.
In order to test the configuration use this command (as root):
su defang -s /bin/bash -c 'spamassassin -x -p /etc/mail/sa-mimedefang.cf -D --lint'
- use the correct name for defang you have configured to run MIMEDefang under,
- use the correct path for the MIMEDefang-SpamAssassin configuration file /etc/mail/sa-mimedefang.cf
- -s /bin/bash ensures that su uses a valid shell, because normally the defang user does not need one
- instead of --lint you can pipe or redirect any message to check into this call, e.g.:
su defang -s /bin/bash -c 'spamassassin -x -p /etc/mail/sa-mimedefang.cf -D' < message