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

2014-02-21 Thread Kees Theunissen
On Fri, 21 Feb 2014, Marcus Schopen wrote:

>Hi Kees,
>
>I put $Features{'Path:QUARANTINEDIR'} to mimedefang.pl.conf and in my
>case (Ubuntu 12.04 LTS) .spamassassin is automatically located
>under /var/spool/MD-Quarantine without changing home in passwd or
>changing HOME=/var/spool/MD-Quarantine in /etc/init.d/mimedefang. Kind
>of strange, but it seems to work.

This is done in /usr/bin/mimedefang.pl in the spam_assassin_init
subroutine:

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



I added the HOME=... declaration to my config back in 2006 on a
Fedora system. At that time $HOME was not defined in the init script.
I guess -but I'm not sure- that I had defined the quarantine dir
as the home dir of the defang user in /etc/passwd.

Without the $HOME definition spamassassin created the .spamassassin
directory in the proper location but sometimes failed to access
files in that directory.
See the archives of this mailinglist for more details:
http://lists.roaringpenguin.com/pipermail/mimedefang/2006-June/030383.html

I don't know if it is still needed, but I do know that the $HOME
definition currently _is_ included in the init script with the wrong
value if you separate the quarantine dir from the spool dir.
I just want to be sure that the value assigned to $HOME is correct,
whether that value is used or not.



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.theunis...@differ.nl
postal address:   PO Box 1207, 3430 BE Nieuwegein, NL
visitors address: Edisonbaan 14, 3439 MN Nieuwegein, NL

___
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list MIMEDefang@lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang


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

2014-02-21 Thread Marcus Schopen
Hi Kees,

I put $Features{'Path:QUARANTINEDIR'} to mimedefang.pl.conf and in my
case (Ubuntu 12.04 LTS) .spamassassin is automatically located
under /var/spool/MD-Quarantine without changing home in passwd or
changing HOME=/var/spool/MD-Quarantine in /etc/init.d/mimedefang. Kind
of strange, but it seems to work. Socket and pid files are still in
the tmpfs under /var/spool/MIMEDefang so I think clamav uses the tmpfs
to write and check Mails because I see this in clamav.log

/var/spool/MIMEDefang/mdefang-s1LIHX6s005741/Work/msg-5718-2.txt:
Eicar-Test-Signature(02e592f7b2929ea31bdd2564a2f19810:75) FOUND

Ciao!

-- 
   I think we dream so we don't have to be apart so long. If we're in each
other's dreams, we can play together all night.   -- Calvin

___
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list MIMEDefang@lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang


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

2014-02-21 Thread Kees Theunissen
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.theunis...@differ.nl
postal address:   PO Box 1207, 3430 BE Nieuwegein, NL
visitors address: Edisonbaan 14, 3439 MN Nieuwegein, NL

___
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list MIMEDefang@lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang