The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Procmail & cPanel

Discussion in 'E-mail Discussions' started by TomA, Apr 14, 2003.

  1. TomA

    TomA Well-Known Member

    Joined:
    Apr 14, 2003
    Messages:
    55
    Likes Received:
    0
    Trophy Points:
    6
    Does anyone know if one can use procmail recipes with cPanel? We have been trying without success. Procmail simply isn't reading the procmailrc files in the home folder.

    Basically, we want to have procmail redirect SpamAssassin tagged spam from username@domain.com to spam@domain.com.

    Thanks.
     
  2. sej7278

    sej7278 Member

    Joined:
    Jan 12, 2003
    Messages:
    20
    Likes Received:
    0
    Trophy Points:
    1
    I'd like this too, but the problem seems to be that SA is the last part of the delivery process - you can't run exim/procmail afterwards to filter subjects matching **** SPAM **** to another INBOX or /dev/null

    This is just what SA needs, otherwise it;s pointless.
     
  3. Juanra

    Juanra Well-Known Member

    Joined:
    Sep 22, 2001
    Messages:
    777
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Spain
    Exim does local deliveries too, you can filter the messages with Exim.
     
  4. sej7278

    sej7278 Member

    Joined:
    Jan 12, 2003
    Messages:
    20
    Likes Received:
    0
    Trophy Points:
    1
    Yup, that's what I said, but you can't filter anything past the SA stage, as it's too late.

    My crude representation of the delivery process may help:

    mail gets to server -> exim -> SA -> INBOX

    We need:

    server -> SA -> exim -> /dev/null
     
  5. TomA

    TomA Well-Known Member

    Joined:
    Apr 14, 2003
    Messages:
    55
    Likes Received:
    0
    Trophy Points:
    6
    Thanks

    So with the current configuration of cpanel, NEITHER exim NOR procmail can sort anything after SA runs--is that correct?

    I noticed that the filter built into cpanel works that way, too. You can't set it to delete tagged spam--it doesn't see it.

    I KNOW that some people have procmail set up to filter after SA, but evidently that's NOT the way cpanel works. I hope the developers of cpanel are listening!!!!

    In the meantime, if anyone has an idea for mail sorting AFTER spamassassin checking, I'd like to hear it!
     
  6. sej7278

    sej7278 Member

    Joined:
    Jan 12, 2003
    Messages:
    20
    Likes Received:
    0
    Trophy Points:
    1
    Re: Thanks

    Yup, the filters built into CPanel, are Exim filters, and get processed after SA is run.

    Yes I've heard some people have got it working with Procmail by making procmail run SA as it goes through the .procmailrc file , rather than processing the filters, then passing to SA for delivery to INBOX.

    I think redirecting/deleting could be done by manually editting the SA config without needing to do anything with exim/procmail, but I don't know how/what, and it sure ain't built into CPanel :(
     
  7. TomA

    TomA Well-Known Member

    Joined:
    Apr 14, 2003
    Messages:
    55
    Likes Received:
    0
    Trophy Points:
    6
    You mean "before SA" right? If you do mean "before" I understand what you are saying--if you don't--I am totally confused!
     
  8. sej7278

    sej7278 Member

    Joined:
    Jan 12, 2003
    Messages:
    20
    Likes Received:
    0
    Trophy Points:
    1
    yeah sorry, filters before sa
     
  9. andethen

    andethen Member

    Joined:
    Feb 20, 2002
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    I've been using procmail for a while, put this in your vfilter for the domain:
    Code:
    if
    $local_part is "matt"
    then
    pipe "/usr/bin/procmail -a ${extract{5}{:}{${lookup{${lookup{$domain}lsearch*{/etc/userdomains}{$value}}}lsearch{/etc/passwd}{$value}}}}/mail/${domain}/${local_part}/inbox"
    endif
    
    (There shouldn't be any line breaks on the pipe line.) This is obviously for a matt@ email address. Then you use procmail as you normally would, I use this to pass to SpamAssassin and put mail into a special folder.

    Code:
    :0 fw: spamassassin.lock
    * < 256000
    | /usr/bin/spamassassin -a
    
    :0:
    * ^X-Spam-Flag: YES
    Spam
    
    That puts it into my "Spam" IMAP folder. Enjoy!
     
  10. TomA

    TomA Well-Known Member

    Joined:
    Apr 14, 2003
    Messages:
    55
    Likes Received:
    0
    Trophy Points:
    6
    vfilter? Is that something that is user accessable? I can't find a "vfilter" that already exists in my domain.

    And we substitute substitute something in for what appear to be variables in the string:

    domain
    userdomains
    value
    passwd
    local_part
     
    #10 TomA, May 3, 2003
    Last edited: Jun 19, 2003
  11. svedo

    svedo Active Member

    Joined:
    Oct 24, 2002
    Messages:
    37
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Sydney, Australia.
    Has anyone been able to get andethen's way working?

    I'm using 6.4.2-75 on RH 7.3... I've tried it but keep getting error msgs when sending to the address.

    eg:

    matt@falsedomain.com D=central_filter defer (-11): error in forward file: missing or malformed local
    part (expected word or "<") in "pipe "/usr/bin/procmail -a ${extract{5}{:}{${lookup{${lookup{$domain}lsearch*{/etc/userdomains}{$value}}}ls
    earch{/etc/passwd}{$value}}}}/mail/${domain}/${local_part}/inbox""

    anyone able to assist?

    cheers,
    sc

    cPanel.net Support Ticket Number:
     
  12. TomA

    TomA Well-Known Member

    Joined:
    Apr 14, 2003
    Messages:
    55
    Likes Received:
    0
    Trophy Points:
    6
    Not me. I don't know enough, and never got a response on my last question. If anyone does get this working, I'd like to hear about it, too!

    cPanel.net Support Ticket Number:
     
  13. svedo

    svedo Active Member

    Joined:
    Oct 24, 2002
    Messages:
    37
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Sydney, Australia.
    i'm still playing around with it and now i have this message, which i think i may be one step closer:

    Neither the central_filter director nor the address_file transport set a uid for local delivery of /usr/
    bin/procmail -a ${extract{5}{:}{${lookup{${lookup{$domain}|search{/etc/userdomains}{$value}}}|search{/etc/passwd}{$value}}}}/mail/${domain}/$
    {local_part}/inbox

    any ideas?

    cPanel.net Support Ticket Number:
     
  14. howard

    howard Well-Known Member

    Joined:
    Apr 20, 2003
    Messages:
    233
    Likes Received:
    0
    Trophy Points:
    16
    In /etc/exim.conf try adding something like this to the central_filter: section

    Code:
    user = "${lookup{$domain}lsearch* {/etc/userdomains}{$value}}"
    group = mail
    
    then restart exim

    cPanel.net Support Ticket Number:
     
  15. svedo

    svedo Active Member

    Joined:
    Oct 24, 2002
    Messages:
    37
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Sydney, Australia.
    Thanks for that, Did that in exim, but now i get permission errors. :(

    Here is the error now:

    == /usr/bin/procmail -a ${extract{5}{:}{${lookup{${lookup{$domain}lsearch* {/etc/userdomains}{$value}}}
    lsearch {/etc/passwd}{$value}}}}/mail/${domain}/${local_part}/inbox <matt@falsedomain.com> T=address_file defer (13): Permission denied: failed to create directories for /usr/bin/procmail -a ${extract{5}{:}{${lookup{${lookup{$domain}lsearch* {/etc/userdomains}{$value}}}lsearch*
    {/etc/passwd}{$value}}}}/mail/${domain}/${local_part}: Permission denied


    Could someone just verify what they put in /etc/vfilters/falsedomain.com + in exim.conf? As the one below if i just cut and paste and put the pipe on one line does not work.

    Any other ideas?

    Cheers,

    cPanel.net Support Ticket Number:
     
  16. svedo

    svedo Active Member

    Joined:
    Oct 24, 2002
    Messages:
    37
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Sydney, Australia.
    Just a quick update, i *think* i have it passing it onto procmail but because i am trying to set this up for a whole domain name rather than a user, it tries to deliver the mail to the username that is admin for that domain (ie. the one used to access cpanel). Which isn't going to work for us, as there are 15 users under the one domain.

    Any ideas on how else to go about this?

    Cheers,

    cPanel.net Support Ticket Number:
     
  17. sej7278

    sej7278 Member

    Joined:
    Jan 12, 2003
    Messages:
    20
    Likes Received:
    0
    Trophy Points:
    1
    Procmail is very fussy about permissions.

    The mail directories have to be readable/writable only by the owner.

    cPanel.net Support Ticket Number:
     
  18. svedo

    svedo Active Member

    Joined:
    Oct 24, 2002
    Messages:
    37
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Sydney, Australia.
    well i have fixed the permissions part, and its forwarding to procmail, but procmail isn't working properly. ie. after processing, it doesn't carry on by putting the mail in each users folder.

    So i dunno what else i can do to get it working for a domain w/ heaps of users, not just the default one.

    -sc

    cPanel.net Support Ticket Number:
     
  19. TomA

    TomA Well-Known Member

    Joined:
    Apr 14, 2003
    Messages:
    55
    Likes Received:
    0
    Trophy Points:
    6
  20. svedo

    svedo Active Member

    Joined:
    Oct 24, 2002
    Messages:
    37
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Sydney, Australia.
    well to be honest, i think i got all i could out of procmail. Unless someone knows how to get procmail to pass the good emails back to exim for local delivery? that is the only thing i can think of that will work..

    Or if u can get spamassassin to pass all emails onto exim and then exim processes the filters and then delivers...

    If you only have the one user for the one domain, then procmail works fine. But as soon as you have emails setup, then it doesn't.


    -sc

    cPanel.net Support Ticket Number:
     
Loading...

Share This Page