Re: SA-learn on remote host
On 17:22 Fri 14 Sep , Andrew Sackville-West wrote:
> On Fri, Sep 14, 2007 at 09:23:16PM +0100, John K Masters wrote:
> > I am gradually implementing a mail system where I have a mail-server on
> > host1 running Postfix/Courier/Procmail/spamc which passes all except
> > whitelisted mail to spamd on another server - host2. host2 simply runs
> > the mail through SA and passes it back to host1 from which I read on my
> > local box via Mutt.
> >
> I see a couple possibilities.
>
> 1) if its a seceure network, just mount nfs the spam folder from host1
> on host2 and run it locally on host2.
>
> 2) pipe the mail through ssh. something like
>
> find /path/to/spam | cat | ssh someuser@host2 sa-learn --spam -u
> appropriate-user-name -
>
> might work, but would require some mucking aorund with permissions and
> pubkey authentication.
>
> Those are my guesses.
>
> A
OK got it working roughly thus:-
1] Generate a passphraseless ssh key on the local machine.
2] Copy the .pub key to all the servers you wish to connect to.
3] Anacron job on local machine run daily -
ssh-add /path/to/passphraseless/key
ssh -A me@host1.net /path/to/host1-script.sh
ssh-add -d /path/to/passphraseless/key
4] host1-script.sh is -
#!/bin/bash
SPAMSERV="spamd@host2.net" #FQDN of host running spamd
LEARNDIR="/home/spamd/learnspam" #dir to hold spam
TARGETDIR=$SPAMSERV:$LEARNDIR
SPAMDIR="/path/to/spam-mailbox/*" #Where my spam is on host1
scp $SPAMDIR $TARGETDIR
ssh $SPAMSERV sa-learn --spam $LEARNDIR
rm $SPAMDIR
exit
Needs some (a lot of) tidying up but works for now and allows me to
filter out false positives before they get assessed by sa-learn.
Regards, John
--
War is God's way of teaching Americans geography
Ambrose Bierce (1842 - 1914)
Reply to: