[Mimedefang] move SPOOLDIR to tmpfs - how to keep bayes and qdir files at reboot?

Kees Theunissen C.J.Theunissen at differ.nl
Fri Feb 21 04:31:48 EST 2014


On Fri, 21 Feb 2014, Steffen Kaiser wrote:

>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>On Thu, 20 Feb 2014, Marcus Schopen wrote:
>
>> I'm planning to move SPOOLDIR (/var/spool/MIMEDefang) to tmps.
>>
>> My /etc/fstab
>> tmpfs           /var/spool/MIMEDefang  tmpfs
>> defaults,size=128m,mode=750,uid=ofdefanguser,gid=ofdefanggroup   0 0
>>
>> This works fine, but mimedefang stores quarantinedir and spamassassin
>> bayes files in /var/spool/MIMEDefang too. How to handle this.
>> Copy /var/spool/MIMEDefang/.spamassassin at stop/start of mimedefang to
>> another directory outside tmpfs. And what about quarantinedir files.
>> Those fill up the ramdisk. Move them by cronjob?
>
>if you compile MIMEDefang yourself, you can specify another quarantinedir.
>IMHO, you can change the location by setting:
>$Features{'Path:QUARANTINEDIR'}
>anytime. E.g. at the top of your filter or in mimedefang.pl.

I'm running MIMEDefang on a few debian systems. Debian ships a somewhat
modified /usr/bin/mimedefang.pl that 'require's a configuration file
/etc/mail/mimedefang.pl.conf. So I've defined the quarantine dir in that
file with: $Features{'Path:QUARANTINEDIR'} = '/var/spool/MD-Quarantine';

>My .spamassassin is not located in MIMEDefang's spool dir. But I use the
>demon. You can most likly use a symlink, I mean:
>On startup you setup the tmpfs and before starting MIMEDefang, e.g. in its
>init.d script, you create the symlink to the permanent spamassassin
>location.

SpamAssassin uses the home directory of the user it is running as for
the bookkeeping. So I've made the quarantine dir the home directory of
the defang user:

$ getent passwd defang
defang:x:108:110::/var/spool/MD-Quarantine:/bin/false

Unfortunately the $HOME environment varialble is screwed by the init
script (as shipped by debian, but also by the init sript in the redhat
directory of the original MIMEDefang source). The init script has:
  ...
  SPOOLDIR='/var/spool/MIMEDefang'
  ...
  # These lines keep SpamAssassin happy.  Not needed if you
  # aren't using SpamAssassin.
  HOME="$SPOOLDIR"
  export HOME
  ...

The init script sources a configuration file /etc/default/mimedefang
later on. That's the place where I correct the $HOME assignment with:
  ...
  # Redefine the HOME dir.
  # $HOME was set to the spool dir in /etc/init.d/mimedefang, but that
  # dir is a volatile ram disk and we need permanent storage for the
  # spamassassin bayesian scores.
  HOME=/var/spool/MD-Quarantine
  ...

The init script in the redhat directory of the original MIMEDefang
source uses the configuration file /etc/sysconfig/mimedefang but that
file is sourced _before_ the $HOME environment variable is screwed up.
With that init script you need to modify the init script in order to
correct the $HOME assignment.


Regards,

Kees Theunissen.

-- 
Kees Theunissen,  System and network manager,   Tel: +31 (0)30 6096724
Dutch Institute For Fundamental Energy Research (DIFFER)
e-mail address:   C.J.Theunissen at differ.nl
postal address:   PO Box 1207, 3430 BE Nieuwegein, NL
visitors address: Edisonbaan 14, 3439 MN Nieuwegein, NL




More information about the MIMEDefang mailing list