Difference between pages "Main Page" and "MIMEDefang"

From Wikislax
(Difference between pages)
Jump to: navigation, search
 
(Created page with "{{RightTOC}} == What is MIMEDefang ? == [http://www.mimedefang.org MIMEDefang] is a plugin specific to the Sendmail Milter interface and affords scanning modifying f...")
 
Line 1: Line 1:
 
{{RightTOC}}
 
{{RightTOC}}
  
== Linux server ==
+
== What is MIMEDefang ? ==
  
This guide is intended as a set of '''recipes''' installing and configuring '''essential Linux server software'''. The goal is to save your time ... and mine :) (re)installing a truly functional '''home''' server, learning on the way. '''Home''' server means the set of services or software listed below. Professional features such as backups, raid, lvm, clusters, automation, etc... are not covered here.
+
[http://www.mimedefang.org MIMEDefang] is a plugin specific to the [[Sendmail]] [[Milter]] interface and affords scanning modifying filtering or bouncing mails while they are being received by sendmail.
  
The recipes are based on '''slackware''' (64 bits - currently installing '''14.2'''). My reasons for preferring Slackware are simplicity and stability of this distribution. Also, Slackware does not hide what you need to know, and goes straight to the point. Last, Slackware gives good control on package installation. Sometimes we will however prefer to install server software not from packages, but from source.
+
MIMEDefang consist of four major components: mimedefang, mimedefang-multiplexor, mimedefang.pl, and mimedefang-filter. MIMEDefang, written in C, splits incoming messages into parts. Mimedefang-multiplexor creates and manages a pool of perl processes that execute mimedefang.pl, a perl script.
  
'''Installing software from source''' is not more difficult than using a graphical package manager that will hide most of what you '''''need''''' to know – specially regarding compilation options and – to some extent, location and content of configuration files. This guide will instead strive to show you what really happens under the hood. The knowledge in this guide should be reusable on any other Linux distribution appropriate for your needs.
+
== Installing MIMEDefang ==
  
<br/>
+
MIMEDefang requires a few perl modules that can be installed as below :
  
== Installing Linux ==
+
# perl -MCPAN -e shell
 +
. . .
 +
cpan> install Digest::SHA1
 +
cpan> install IO::Stringy
 +
cpan> install MailTool
 +
cpan> install MIME::Tools
 +
cpan> install MIME::Base64
 +
cpan> install Unix::Syslog
 +
cpan> install Net::DNSBL::Client
 +
quit
  
{| {{thead}}
+
[http://www.mimedefang.org/download Download MIMEDefang] untar and install as below. Mickey Hill's [http://www.mickeyhill.com/mimedefang-howto MIMEDefang HOWTO] includes detailed installation information and tips.
|-
 
! {{chead}} width="150" | Topic
 
! {{chead}} | Goal
 
|-
 
| [[Choosing a System]]
 
| reasons for choosing Linux and Slackware for server usage
 
|-
 
| [[Managing partitions]]
 
| manage systems coexistence and get systems to boot
 
|-
 
| [[DVDless install]]
 
| Slackware setup to install from Network
 
|-
 
| [[Installing Slackware]]
 
| brief overview of the installation process
 
|-
 
| [[Maintaining Slackware]]
 
| how to keep Slackware current security-wise
 
|-
 
| [[Linux basics]]
 
| key information using a Linux system
 
|-
 
| [[Configuration files]]
 
| key slackware configuration files locations
 
|-
 
| [[IPTables]]
 
| firewall - filtering Internet communications
 
|-
 
| [[X11 configuration]]
 
| configuration of the X11 graphical system
 
|-
 
| [[X11 over the network]]
 
| using the X11 graphical system over the network
 
|-
 
| [[Compiling the Kernel]]
 
| customizing and optimizing your kernel
 
|-
 
| [[Compiling from Source]]
 
| installing sofware from source
 
|}
 
  
<br clear=all>
+
# tar -C /usr/local -xvf mimedefang-x.y.tar.gz
 +
# cd /usr/local
 +
# chown -R root:root mimedefang-x.y
 +
# cd mimedefang-x.y
 +
# ./configure --help | less
 +
# ./configure --libdir=/usr/local/lib64 \
 +
--mandir=/usr/local/man --with-user=milter
 +
# make
 +
# make install
 +
# make clean
  
== Xen virtualization ==
+
== Configuring MIMEDefang ==
  
{| {{thead}}
+
MIMEDefang uses a single configuration file in '''/etc/mail/sa-mimedefang.cf'''. Add the lines below for DCC Pyzor and Bayes. The '''bayes_path''' seems required for SpamAssassin to find the Bayes database :
|-
 
! {{chead}} width="150" | Topic
 
! {{chead}} | Goal
 
|-
 
| [[Compiling Xen]]
 
| what is Xen and how to compile
 
|-
 
| [[Using Grub2]]
 
| using Grub2 as the bootloader
 
|-
 
| [[Creating VMs]]
 
| creating and using virtual machines
 
|}
 
  
<br clear=all>
+
use_dcc 1
 +
dcc_timeout 10
 +
dcc_path /usr/local/bin/dccproc
 +
 +
use_pyzor 1
 +
pyzor_timeout 10
 +
pyzor_path /usr/local/bin/pyzor
 +
 +
# Set Bayes parameters
 +
#
 +
use_bayes 1
 +
use_learner 1
 +
use_bayes_rules 1
 +
bayes_auto_learn 1
 +
bayes_auto_expire 1
 +
bayes_file_mode 700
 +
bayes_expiry_max_db_size 150000
 +
bayes_path /var/spool/MD-Quarantine/.spamassassin/bayes
 +
 +
#  Set headers which may provide inappropriate cues to the Bayesian classifier
 +
#
 +
bayes_ignore_header X-Scanned-By
 +
bayes_ignore_header X-Spam-Check
 +
bayes_ignore_header X-Spam-Score
 +
bayes_ignore_header X-Probably-Spam-Tag
  
== Internet software ==
+
'''/etc/mail/mimedefang-filter''' is a perl fragment read by mimedefang.pl where customization can take place. Be sure to check '''man mimedefang-filter'''. Global variable $SALocalTestsOnly has a default value of 1 to to disable Receive, RBL and Razor tests. Add line $SALocalTestsOnly = 0; at the beginning of mimedefang-filter to enable these tests. The code snipet below extracted from '''filter_end''' in mimedefang-filter calls for a few interesting comments:
  
Most of the server software can be installed directly from the distribution release to save time and effort. However, Server software must include only these compile options required and be updated quickly in case of security advisory, so we will compile it from source. The installation order below must be respected :
+
* Messages of 100K or more are unlikely to be spam so are not scanned to avoid a waste of resources.
 +
* The number of stars in X-Spam-Score is easy to use in your MUA rules to classify mail as ham or spam.
 +
* We disabled the spamassassin report to collect spam unmodified for the Bayes module initialization.
 +
* We added line action_sm_quarantine("$hits ($score) $names"); to test the Sendmail quarantine feature.
  
{| {{thead}}
+
    # Spam checks if SpamAssassin is installed
|-
+
    if ($Features{"SpamAssassin"}) {
! {{chead}} width="150" | Software
+
        if (-s "./INPUTMSG" < 100*1024) {
! {{chead}} | Usage
+
            # Only scan messages smaller than 100kB. Larger messages
|-
+
            # are extremely unlikely to be spam, and SpamAssassin is
| [[OpenSSL]] || the standard encryption library from OpenSSL.org
+
            # dreadfully slow on very large messages.
|-
+
            my($hits, $req, $names, $report) = spam_assassin_check();
| [[OpenLDAP]] || the standard Lightweight Directory Access Protocol Directory from OpenLDAP.org
+
            my($score);
|-
+
            if ($hits < 40) {
| [[Cyrus-SASL]] || the RFC 2222 Secure Authentication Security Layer software from the Carnegie Mellon University
+
                $score = "*" x int($hits);
|-
+
            } else {
| [[Sendmail]] || the legacy MTA software from Sendmail.org, reknown as complex to configure, but still widely used and released with many Linux distributions
+
                $score = "*" x 40;
|-
+
            }
| [[Cyrus-IMAP]] || the industrial-grade POP/IMAP Server from the Carnegie Mellon University. Store the messages in a DB4 database, includes support for hierarchical folders, shared folders, and mail quotas
+
            # We add a header which looks like this:
|-
+
            # X-Spam-Score: 6.8 (******) NAME_OF_TEST,NAME_OF_TEST
| [[SpamAssassin]] || the well-known heuristic AntiSpam software, and other useful PERL scripts and programs
+
            # The number of asterisks in parens is the integer part
|-
+
            # of the spam score clamped to a maximum of 40.
| [[ClamAV]] || a Mail Antivirus for Sendmail and other MTAs
+
            # MUA filters can easily be written to trigger on a
|-
+
            # minimum number of asterisks...
| [[Milter]] || a Sendmail subsystem to allow mail filtering by third-party software as part of the Sendmail MTA mail processing
+
            if ($hits >= $req) {
|-
+
                action_change_header("X-Spam-Score", "$hits ($score) $names");
| [[MIMEDefang]] || a third-party mail filtering software, affords using SpamAssassin and Clamav to filter mail as part of the Sendmail MTA mail processing
+
                md_graphdefang_log('spam', $hits, $RelayAddr);
|-
+
                # If you find the SA report useful, add it, I guess...
| [[MySQL]] || the traditional companion to Apache and PHP. apr and apr-util, used by apache, refer to mysql so the latter must be installed first
+
                action_add_part($entity, "text/plain", "-suggest",
|-
+
                                "$report\n",
| [[Apache]] || the most widespread and Open Source HTTP server
+
                              "SpamAssassinReport.txt", "inline");
|-
+
                # action_quarantine_entire_message("$hits ($score) $names");
| [[PHP]] || a C-like scripting language well suited for Web development
+
                # action_sm_quarantine("$hits ($score) $names");
|-
+
                # send_quarantine_notifications();
| [[phpMyAdmin]] || a PHP application to administrate MySQL databases
+
                # action_discard();
|-
+
            } else {
| [[MediaWiki]] || a PHP application to manage Wikipedia Wikis
+
                # Delete any existing X-Spam-Score header?
|-
+
                action_delete_header("X-Spam-Score");
| [[RoundCube]] || a PHP Webmail application
+
            }
|-
+
        }
| [[INN]] || Newsgroups server
+
    }
|-
 
| [[Sucknews]] || Sucknews affords getting the newsfeeds over a regular NNTP connection with your Internet Service Provider when you have no agreements with peer Newsgroup servers
 
|-
 
| [[Asterisk]] || VoiP telephony server
 
|}
 
  
<br clear=all>
+
There is nothing special to configure in Sendmail to use the quarantine feature. '''mailq -qQ''' affords viewing the content of the quarantine queue, '''sendmail -qQ -qI<u>substr</u> -Q''' affords unquarantining a specific mail.
  
== [[Desktop software]] ==
+
<u>Note</u> : if anything goes wrong it is possible to get all SpamAssassin debug information in the maillog file by adding a '''debug => 1,''' parameter when creating the SpamAssassin object in function spam_assassin_init of '''/usr/local/bin/mimedefang.pl''' :
  
We use :
+
#***********************************************************************
 +
# %PROCEDURE: spam_assassin_init
 +
# %ARGUMENTS:
 +
#  config -- optional spamassassin config file
 +
# %RETURNS:
 +
#  A Mail::SpamAssassin object.
 +
# %DESCRIPTION:
 +
#  Scans message using SpamAssassin (http://www.spamassassin.org)
 +
#***********************************************************************
 +
sub spam_assassin_init (;$) {
 +
    my($config) = @_;
 +
    my $LOCAL_RULES_DIR = '/etc/mail/spamassassin';
 +
    my $LOCAL_STATE_DIR = '/var/lib';
 +
 +
    . . .
 +
 +
        my $sa_args = {
 +
                '''debug              => 1,'''
 +
                local_tests_only  => $SALocalTestsOnly,
 +
                dont_copy_prefs    => 1,
 +
                userprefs_filename => $config,
 +
                user_dir          => $Features{'Path:QUARANTINEDIR'},
 +
        };
  
{| {{thead}}
+
== Configuring Milter ==
|-
 
! {{chead}} width="150" | Software
 
! {{chead}} | Usage
 
|-
 
| [[Desktop software#Firefox|Firefox]] || web browser
 
|-
 
| [[Desktop software#Flashplayer|Flashplayer]] || animation plugin
 
|-
 
| [[Desktop software#Stellarium|Stellarium]] || planetarium software
 
|-
 
| [[Desktop software#Thunderbird|Thunderbird]] || mail client
 
|-
 
| [[Desktop software#VirtualBox|VirtualBox]] || virtualizer
 
|-
 
| [[Desktop software#Wallpapers|Wallpapers]] || just wallpapers
 
|-
 
| [[Desktop software#Wireshark|Wireshark]] || protocol analyzer
 
|}
 
  
<br clear=all>
+
Add the '''INPUT_MAIL_FILTER''' macro to sendmail.mc to send all mails trough the specified filter :
  
{{ pFoot |||[[Choosing a System]]}}
+
# cd /usr/local/sendmail-*/cf/cf
 +
# vi sendmail.mc
 +
a
 +
INPUT_MAIL_FILTER(`mimedefang', `S=unix:/var/spool/MIMEDefang/mimedefang.sock, F=T, T=S:5m;R:5m')dnl
 +
<esc>
 +
:x
 +
# m4 ../m4/cf.m4 sendmail.mc > sendmail.cf
 +
# cp sendmail.mc /etc/mail
 +
# cp sendmail.cf /etc/mail
 +
 
 +
== Reconfiguring rc.sendmail ==
 +
 
 +
<u>MIMEDefang must be started before and stopped after sendmail</u>. Copy the init-script provided under /etc/rc.d then call it from rc.sendmail.
 +
 
 +
# '''cp examples/init-script /etc/rc.d/rc.mimedefang'''
 +
# '''vi /etc/rc.d/rc.sendmail'''
 +
. . .
 +
# Start sendmail:
 +
sendmail_start() {
 +
  /etc/rc.d/rc.mimedefang start
 +
  sleep 2
 +
  if [ -x /usr/sbin/sendmail ]; then
 +
    echo "Starting sendmail MTA daemon:  /usr/sbin/sendmail -L sm-mta -bd -q25m"
 +
    /usr/sbin/sendmail -L sm-mta -bd -q25m
 +
    echo "Starting sendmail MSP queue runner:  /usr/sbin/sendmail -L sm-msp-queue -Ac -q25m"
 +
    /usr/sbin/sendmail -L sm-msp-queue -Ac -q25m
 +
  fi
 +
}
 +
 +
# Stop sendmail:
 +
sendmail_stop() {
 +
  /etc/rc.d/rc.mimedefang stop
 +
  killall sendmail
 +
  sleep 6
 +
}
 +
. . .
 +
<esc>
 +
:x
 +
 
 +
== Running Sendmail with MIMEDefang ==
 +
 
 +
As we have installed and configured SpamAssassin, ClamAV and MIMEDefang previously, all the pieces are now in place and ready to interlock. Just restart sendmail :
 +
 
 +
# /etc/rc.d/rc.sendmail start
 +
Starting mimedefang-multiplexor:                            [  OK  ]
 +
Starting mimedefang:                                        [  OK  ]
 +
Starting sendmail MTA daemon:  /usr/sbin/sendmail -L sm-mta -bd -q25m
 +
Starting sendmail MSP queue runner:  /usr/sbin/sendmail -L sm-msp-queue -Ac -q25m
 +
root@inner:/etc/rc.d#
 +
 
 +
Check behaviour in file '''/var/log/maillog'''.
 +
 
 +
== A MIMEDefang issue ==
 +
 
 +
Sometimes the message '''Milter (mimedefang): local socket name /var/spool/MIMEDefang/mimedefang.sock unsafe''' can be found in file '''/var/log/maillog''' for each incoming mail, in this case not processed. As the socket is created automatically by MIMEDefang at run time, the error message itself is mistaken. What actually happens is that the socket is not created at all.
 +
 
 +
The root cause is unclear. Buggy perl modules have been mentionned on some websites. A list of the perl modules used by MIMEDefang can be obtained by "'''mimedefang.pl -features'''" and upgraded with the '''upgrade''' command of perl. Another likely cause is that MIMEDefang seems to need some time to properly wrap-up on termination. To work around this, we added as above some '''sleep''' commands in file '''/etc/rc.d/rc.sendmail'''.
 +
 
 +
The presence of the socket can be tested with the command :
 +
 
 +
# '''ls -al /var/spool/MIMEDefang/'''
 +
total 16
 +
drwxr-x---  2 milter root  4096 Oct 10 14:08 ./
 +
drwxr-xr-x 18 root  root  4096 Oct  7 08:22 ../
 +
srw-rw-rw-  1 milter milter    0 Oct  9 12:48 clamd.sock=
 +
-rw-------  1 milter milter    6 Oct 10 14:08 mimedefang-multiplexor.pid
 +
srwx------  1 milter milter    0 Oct 10 14:08 mimedefang-multiplexor.sock=
 +
-rw-------  1 milter milter    6 Oct 10 14:08 mimedefang.pid
 +
srwx------  1 milter milter    0 Oct 10 14:08 mimedefang.sock=
 +
 
 +
<br>
 +
 
 +
{{pFoot|[[Milter]]|[[Main Page]]|[[MySQL]]}}

Latest revision as of 23:32, 6 December 2017

What is MIMEDefang ?

MIMEDefang is a plugin specific to the Sendmail Milter interface and affords scanning modifying filtering or bouncing mails while they are being received by sendmail.

MIMEDefang consist of four major components: mimedefang, mimedefang-multiplexor, mimedefang.pl, and mimedefang-filter. MIMEDefang, written in C, splits incoming messages into parts. Mimedefang-multiplexor creates and manages a pool of perl processes that execute mimedefang.pl, a perl script.

Installing MIMEDefang

MIMEDefang requires a few perl modules that can be installed as below :

# perl -MCPAN -e shell
. . .
cpan> install Digest::SHA1
cpan> install IO::Stringy
cpan> install MailTool
cpan> install MIME::Tools
cpan> install MIME::Base64
cpan> install Unix::Syslog
cpan> install Net::DNSBL::Client
quit

Download MIMEDefang untar and install as below. Mickey Hill's MIMEDefang HOWTO includes detailed installation information and tips.

# tar -C /usr/local -xvf mimedefang-x.y.tar.gz
# cd /usr/local
# chown -R root:root mimedefang-x.y
# cd mimedefang-x.y
# ./configure --help | less
# ./configure --libdir=/usr/local/lib64 \
--mandir=/usr/local/man --with-user=milter
# make
# make install
# make clean

Configuring MIMEDefang

MIMEDefang uses a single configuration file in /etc/mail/sa-mimedefang.cf. Add the lines below for DCC Pyzor and Bayes. The bayes_path seems required for SpamAssassin to find the Bayes database :

use_dcc 1
dcc_timeout 10
dcc_path /usr/local/bin/dccproc

use_pyzor 1
pyzor_timeout 10
pyzor_path /usr/local/bin/pyzor

# Set Bayes parameters
#
use_bayes 1
use_learner 1
use_bayes_rules 1
bayes_auto_learn 1
bayes_auto_expire 1
bayes_file_mode 700
bayes_expiry_max_db_size 150000
bayes_path /var/spool/MD-Quarantine/.spamassassin/bayes

#   Set headers which may provide inappropriate cues to the Bayesian classifier
#
bayes_ignore_header X-Scanned-By
bayes_ignore_header X-Spam-Check
bayes_ignore_header X-Spam-Score
bayes_ignore_header X-Probably-Spam-Tag

/etc/mail/mimedefang-filter is a perl fragment read by mimedefang.pl where customization can take place. Be sure to check man mimedefang-filter. Global variable $SALocalTestsOnly has a default value of 1 to to disable Receive, RBL and Razor tests. Add line $SALocalTestsOnly = 0; at the beginning of mimedefang-filter to enable these tests. The code snipet below extracted from filter_end in mimedefang-filter calls for a few interesting comments:

  • Messages of 100K or more are unlikely to be spam so are not scanned to avoid a waste of resources.
  • The number of stars in X-Spam-Score is easy to use in your MUA rules to classify mail as ham or spam.
  • We disabled the spamassassin report to collect spam unmodified for the Bayes module initialization.
  • We added line action_sm_quarantine("$hits ($score) $names"); to test the Sendmail quarantine feature.
   # Spam checks if SpamAssassin is installed
   if ($Features{"SpamAssassin"}) {
       if (-s "./INPUTMSG" < 100*1024) {
           # Only scan messages smaller than 100kB.  Larger messages
           # are extremely unlikely to be spam, and SpamAssassin is
           # dreadfully slow on very large messages.
           my($hits, $req, $names, $report) = spam_assassin_check();
           my($score);
           if ($hits < 40) {
               $score = "*" x int($hits);
           } else {
               $score = "*" x 40;
           }
           # We add a header which looks like this:
           # X-Spam-Score: 6.8 (******) NAME_OF_TEST,NAME_OF_TEST
           # The number of asterisks in parens is the integer part
           # of the spam score clamped to a maximum of 40.
           # MUA filters can easily be written to trigger on a
           # minimum number of asterisks...
           if ($hits >= $req) {
               action_change_header("X-Spam-Score", "$hits ($score) $names");
               md_graphdefang_log('spam', $hits, $RelayAddr);
               # If you find the SA report useful, add it, I guess...
               action_add_part($entity, "text/plain", "-suggest",
                               "$report\n",
                             "SpamAssassinReport.txt", "inline");
               # action_quarantine_entire_message("$hits ($score) $names");
               # action_sm_quarantine("$hits ($score) $names");
               # send_quarantine_notifications();
               # action_discard();
           } else {
               # Delete any existing X-Spam-Score header?
               action_delete_header("X-Spam-Score");
           }
       }
   }

There is nothing special to configure in Sendmail to use the quarantine feature. mailq -qQ affords viewing the content of the quarantine queue, sendmail -qQ -qIsubstr -Q affords unquarantining a specific mail.

Note : if anything goes wrong it is possible to get all SpamAssassin debug information in the maillog file by adding a debug => 1, parameter when creating the SpamAssassin object in function spam_assassin_init of /usr/local/bin/mimedefang.pl :

#***********************************************************************
# %PROCEDURE: spam_assassin_init
# %ARGUMENTS:
#  config -- optional spamassassin config file
# %RETURNS:
#  A Mail::SpamAssassin object.
# %DESCRIPTION:
#  Scans message using SpamAssassin (http://www.spamassassin.org)
#***********************************************************************
sub spam_assassin_init (;$) {
    my($config) = @_;
    my $LOCAL_RULES_DIR = '/etc/mail/spamassassin';
    my $LOCAL_STATE_DIR = '/var/lib';

    . . .

        my $sa_args = {
                debug              => 1,
                local_tests_only   => $SALocalTestsOnly,
                dont_copy_prefs    => 1,
                userprefs_filename => $config,
                user_dir           => $Features{'Path:QUARANTINEDIR'},
        };

Configuring Milter

Add the INPUT_MAIL_FILTER macro to sendmail.mc to send all mails trough the specified filter :

# cd /usr/local/sendmail-*/cf/cf
# vi sendmail.mc
a
INPUT_MAIL_FILTER(`mimedefang', `S=unix:/var/spool/MIMEDefang/mimedefang.sock, F=T, T=S:5m;R:5m')dnl
<esc>
:x
# m4 ../m4/cf.m4 sendmail.mc > sendmail.cf
# cp sendmail.mc /etc/mail
# cp sendmail.cf /etc/mail

Reconfiguring rc.sendmail

MIMEDefang must be started before and stopped after sendmail. Copy the init-script provided under /etc/rc.d then call it from rc.sendmail.

# cp examples/init-script /etc/rc.d/rc.mimedefang
# vi /etc/rc.d/rc.sendmail
. . .
# Start sendmail:
sendmail_start() {
  /etc/rc.d/rc.mimedefang start
  sleep 2
  if [ -x /usr/sbin/sendmail ]; then
    echo "Starting sendmail MTA daemon:  /usr/sbin/sendmail -L sm-mta -bd -q25m"
    /usr/sbin/sendmail -L sm-mta -bd -q25m
    echo "Starting sendmail MSP queue runner:  /usr/sbin/sendmail -L sm-msp-queue -Ac -q25m"
    /usr/sbin/sendmail -L sm-msp-queue -Ac -q25m
  fi
}

# Stop sendmail:
sendmail_stop() {
  /etc/rc.d/rc.mimedefang stop
  killall sendmail
  sleep 6
}
. . .
<esc>
:x

Running Sendmail with MIMEDefang

As we have installed and configured SpamAssassin, ClamAV and MIMEDefang previously, all the pieces are now in place and ready to interlock. Just restart sendmail :

# /etc/rc.d/rc.sendmail start
Starting mimedefang-multiplexor:                            [  OK  ]
Starting mimedefang:                                        [  OK  ]
Starting sendmail MTA daemon:  /usr/sbin/sendmail -L sm-mta -bd -q25m
Starting sendmail MSP queue runner:  /usr/sbin/sendmail -L sm-msp-queue -Ac -q25m
root@inner:/etc/rc.d#

Check behaviour in file /var/log/maillog.

A MIMEDefang issue

Sometimes the message Milter (mimedefang): local socket name /var/spool/MIMEDefang/mimedefang.sock unsafe can be found in file /var/log/maillog for each incoming mail, in this case not processed. As the socket is created automatically by MIMEDefang at run time, the error message itself is mistaken. What actually happens is that the socket is not created at all.

The root cause is unclear. Buggy perl modules have been mentionned on some websites. A list of the perl modules used by MIMEDefang can be obtained by "mimedefang.pl -features" and upgraded with the upgrade command of perl. Another likely cause is that MIMEDefang seems to need some time to properly wrap-up on termination. To work around this, we added as above some sleep commands in file /etc/rc.d/rc.sendmail.

The presence of the socket can be tested with the command :

# ls -al /var/spool/MIMEDefang/
total 16
drwxr-x---  2 milter root   4096 Oct 10 14:08 ./
drwxr-xr-x 18 root   root   4096 Oct  7 08:22 ../
srw-rw-rw-  1 milter milter    0 Oct  9 12:48 clamd.sock=
-rw-------  1 milter milter    6 Oct 10 14:08 mimedefang-multiplexor.pid
srwx------  1 milter milter    0 Oct 10 14:08 mimedefang-multiplexor.sock=
-rw-------  1 milter milter    6 Oct 10 14:08 mimedefang.pid
srwx------  1 milter milter    0 Oct 10 14:08 mimedefang.sock=


Milter Main Page MySQL