Koozali.org: home of the SME Server

Legacy Forums => Experienced User Forum => Topic started by: lucv on May 10, 2005, 05:28:50 PM

Title: Spamassassin - procmail - Mail-forwarding
Post by: lucv on May 10, 2005, 05:28:50 PM
Hi,

I'm using the latest spamassassin from swerts-knudsen. Some of my users have to forward their mails to an external address. When this is done through the server-manager, procmail-filter stops for that user and no spam is filtered anymore.
This has been discussed before but I haven't seen a more or less workable solution. (We have about 1500 users)
What I am trying to do is take the forwardaddress from the "accounts-db" and via a new template (98forward - /etc/e-smith/templates-users/.procmailrc) build a new .procmailrc file. Whenever a new user is being added with a forward address, I only have to activate his procmail again. When spamassassin is restarted, the mail forwards will also be correct again (I hope ;-) )
Something is wrong but I cannot seem to find it.
Any help is welcome!
The content of 98forward  is:

{
    use esmith::config;
    use esmith::db;

    my %accounts;
    tie %accounts, 'esmith::config', '/home/e-smith/accounts';

    # get $USERNAME from esmith::config - put there by the
    # email-update-user action as a temporary variable
    die "Username criterion missing." unless defined ($USERNAME);

    my $type = db_get_type(\%accounts, $USERNAME);

    die
        "Account $USERNAME is not a user account; "
        . "update email forwarding failed.\n"
            unless $type eq 'user';
    my $ForwardAddress = db_get_prop(\%accounts, $USERNAME, "ForwardAddress");
   
    if ($ForwardAddress eq '')
    {
    $OUT = "./"$MAILDIR"/\n";
    }
    else
    {
    $OUT = "#-------------------\n";
    $OUT = "#Forward a copy\n";
    $OUT = "#-------------------\n";
    $OUT = ":0c\n":
    $OUT = "!".$ForwardAddress."\n";
    $OUT = "./"$MAILDIR"/\n";
    $OUT = "\n";
    }
}
Title: Spamassassin - procmail - Mail-forwarding
Post by: kruhm on May 11, 2005, 04:54:24 AM
I think you're going in the wrong direction. Here's why. First, if you are using the contrib, procmail should always be turned on (don't change the settings in the USER PANEL). If not then you will have to redo your work everytime SA updates itself.

Second, make a custom template in the /etc/e-smith/templates-user-custom/.procmailrc directory instead. Like this: http://forums.contribs.org/index.php?topic=25568.msg112440#msg112440 . If you don't, your work will be overwritten by the update.
Title: Spamassassin - procmail - Mail-forwarding
Post by: lucv on May 11, 2005, 09:33:04 AM
Quote
Second, make a custom template in the /etc/e-smith/templates-user-custom/.procmailrc directory instead. Like this: http://forums.contribs.org/index.php?topic=25568.msg112440#msg112440 . If you don't, your work will be overwritten by the update.


I intend to make a template. (see first post) But I get an error trying to expand it. The changes you suggested to the "25_-template" do not work for me.

Tnx for your interest BTW

Luc
Title: Spamassassin - procmail - Mail-forwarding
Post by: d6hq on May 11, 2005, 10:25:48 AM
Why don't you just backup "accounts" before doing the update. Let the script do its worst and then restore the original "accounts" file. Its in /home/e-smith/
Title: Spamassassin - procmail - Mail-forwarding
Post by: kruhm on May 13, 2005, 02:59:24 PM
@d6hq
It takes 3 hours to update my users. Alot of mail goes through in 3 hours.

@lucv
You're right. After double-testing, it doesn't work for me either. But I think we are on the right track. I did find 2 notes.

First- /etc/.procmailrc is a global file for the entire system. We might be able to create a template that generates that file instead.

Second- if I delete a user's .procmailrc file and try to recreate it with a /sbin/e-smith/signal-event spamfilter-init-procmail , it recreates it but doesn't pick up the changes made in /etc/e-smith/templates-user or /etc/e-smith/templates-user-custom

I'll keep testing.
Title: Spamassassin - procmail - Mail-forwarding
Post by: d6hq on May 13, 2005, 03:07:18 PM
I think you misunderstand - all of your user settings are stored in "accounts". When you intend to update spamassassin make a copy of accounts, then do the spamassassin update - if you run Jespers script it will enable procmail on all accounts which neither you or I want. To restore back to what you want copy the old accounts file back, reboot to force a config update and all your original settings will be restored.
Title: Spamassassin - procmail - Mail-forwarding
Post by: kmccarn on May 13, 2005, 03:26:07 PM
Just to let you know - I'm in the same boat.
I haven't done any research yet - but I had to redo all my forwardings last weekend after the SA update.

I used Dungog's email rpm to globally turn off procmail - then had to re-enter all the forwardings via the gui.

As I only have 380 users - it only took about 5 hours.

I have turned off updates for Spamassassin until I figure out how to handle this.

 :-o
Title: Spamassassin - procmail - Mail-forwarding
Post by: d6hq on May 13, 2005, 03:40:18 PM
Accounts entry for user post SA update

tony=user|City|Ottawa|Company|XYZ Corporation|Dept|Main|EmailForward|procmail|FirstName|tony|ForwardAddress||LastName|byrne|PasswordSet|no|Phone|555-5555|Street|123 Main Street|Uid|5000|VPNClientAccess|no

Accounts entry for user pre SA update

tony=user|City|Ottawa|Company|XYZ Corporation|Dept|Main|EmailForward|local|FirstName|tony|ForwardAddress||LastName|byrne|PasswordSet|no|Phone|555-5555|Street|123 Main Street|Uid|5000|VPNClientAccess|no
Title: Spamassassin - procmail - Mail-forwarding
Post by: kruhm on May 16, 2005, 03:14:43 PM
@lucv
Hey lucv, info updated, try this
http://forums.contribs.org/index.php?topic=25568.msg112815#msg112815