Page 1 of 2 12 LastLast
Results 1 to 10 of 27

Thread: Hooking in another process or content_filter?

Hybrid View

  1. #1
    Join Date
    Sep 2005
    Posts
    6
    Rep Power
    10

    Default Hooking in another process or content_filter?

    I currently use Postfix with SpamAssassin, Anomy, and a custom content filter that associates emails with certain records in a contact database based on certain criteria in the Subject.

    With Zimbra the only thing that I would need to add is my own custom piece, but I can't seem to get it to work.

    In the existing system I set :content_filter=spamfilter:

    spamfilter unix - n n - - pipe
    flags=Rq user=filter argv=/usr/local/bin/filter.sh -f ${sender} -- ${recipient}


    I can get the Postfix in Zimbra to execute but it always fails with an error message generated by my script. Basically the execution back into the smtp process fails.

    I believe that it is failing at the $SENDMAIL command, Probably because of the pipe(?):

    SENDMAIL="/usr/sbin/sendmail -i"
    ANOMY=/opt/zimbra/anomy
    ANOMY_CONF=/opt/zimbra/anomy/sanitizer.cfg
    ANOMY_LOG=/dev/null
    SPAMC=/usr/bin/spamc
    DOC=/opt/zimbra/anomy/mail.pl

    export ANOMY

    # Exit codes from <sysexits.h>
    EX_TEMPFAIL=75
    EX_UNAVAILABLE=69

    cat | $DOC \
    | $ANOMY/bin/sanitizer.pl $ANOMY_CONF 2>>$ANOMY_LOG \
    | $SENDMAIL "$@" || \
    { echo Message content rejected; exit $EX_UNAVAILABLE; }

    exit $?


    fyi this script works via the command line by executing it outside of the MTA:

    cat spool/test.txt | /opt/zimbra/anomy/filter.sh -f root@theinsitegroup.com -- jmcknight@theinsitegroup.com

    Ideas?

  2. #2
    Join Date
    Sep 2005
    Posts
    2,103
    Rep Power
    14

    Default permissions?

    When you ran the test, did you run it as the postfix user? Make sure it works that way - postfix may not have the permissions to write to the sendmail queue dir.

  3. #3
    Join Date
    Sep 2005
    Posts
    6
    Rep Power
    10

    Default

    I ran the test as root. I'll check running as postfix.

    Thanks for the tip.

  4. #4
    Join Date
    Jan 2006
    Location
    Seattle, WA
    Posts
    53
    Rep Power
    9

    Default

    OK I'll bite how does one make this work?
    /opt/zimbra/postfix/spool is owned by postfix
    /var/spool/postfix is owned by root ... but it's not being used correct?
    Regardless of which user I set in master.cf for the script (add_disclaimer in my case) I get the error (zimbra, filter, postfix even tried root once)... I get that postfix doesn't have the correct permissions to reinject the mail... how do I give it permission or which user should this be run as?

    Thanks for any help

    If it makes any difference I am also using zimbras sendmail in my script:
    SENDMAIL=/opt/zimbra/postfix/sbin/sendmail
    Last edited by Dux T; 02-02-2006 at 10:10 AM. Reason: Update

  5. #5
    Join Date
    Jan 2006
    Location
    Seattle, WA
    Posts
    53
    Rep Power
    9

    Question

    Just to recap my efforts and remaining question:

    Global Footer
    http://www.zimbra.com/forums/showthread.php?t=1566

    Wanted Global Disclaimer
    http://www.zimbra.com/forums/showthread.php?t=736

    Postfix Chapter 12 (Currently using Postfix as the user)
    http://www.nostarch.com/download/postfix_ch12.pdf

    Custom Message Filter
    http://www.zimbra.com/forums/showthr...message+filter

    I tried using zmlmtpinject but it failed unless run on the command line also ... I'm not sure if this will be reprocessed if it does work.

    If anyone can help me I sure would appreciate it.
    Last edited by Dux T; 02-14-2006 at 11:25 AM.

  6. #6
    Join Date
    Sep 2005
    Posts
    2,103
    Rep Power
    14

    Default

    Quote Originally Posted by Dux T
    Just to recap my efforts and remaining question:

    Global Footer
    http://www.zimbra.com/forums/showthread.php?t=1566

    Wanted Global Disclaimer
    http://www.zimbra.com/forums/showthread.php?t=736

    Postfix Chapter 12 (Currently using Postfix as the user)
    http://www.nostarch.com/download/postfix_ch12.pdf

    Custom Message Filter
    http://www.zimbra.com/forums/showthr...message+filter

    I tried using zmlmtpinject but it failed unless run on the command line also ... I'm not sure if this will be reprocessed if it does work.

    If anyone can help me I sure would appreciate it.
    Bugs are opened on the first two, what do you want to know for #3, and #4 is a repeat of your previous post, no?

  7. #7
    Join Date
    Sep 2005
    Posts
    2,103
    Rep Power
    14

    Default not enough info

    Quote Originally Posted by Dux T
    OK I'll bite how does one make this work?
    /opt/zimbra/postfix/spool is owned by postfix
    /var/spool/postfix is owned by root ... but it's not being used correct?
    Regardless of which user I set in master.cf for the script (add_disclaimer in my case) I get the error (zimbra, filter, postfix even tried root once)... I get that postfix doesn't have the correct permissions to reinject the mail... how do I give it permission or which user should this be run as?

    Thanks for any help

    If it makes any difference I am also using zimbras sendmail in my script:
    SENDMAIL=/opt/zimbra/postfix/sbin/sendmail
    Not enough information. WHat's your change to master.cf, and what's in your script, and what do you expect it to do?

  8. #8
    Join Date
    Sep 2005
    Posts
    2,103
    Rep Power
    14

    Default mail loop

    here's the problem.

    Message path looks like this in zimbra:
    source -> postfix:25 -> amavis:10024 -> postfix:10025 -> zcs:7025 (lmtp).

    Your script adds this:
    source -> postfix:25 -> amavis:10024 -> postfix:10025 -> yourscriptipe -> postfix:25 -> and back to amavis, etc, etc.

    So you'll need to have your script submit back to postfix on another port (10026 is next in the progression) and postfix (in master.cf) will have to have that port set up with no content filter, no alias expansion, etc, etc, to forward on to lmtp.

  9. #9
    Join Date
    Jan 2006
    Location
    Seattle, WA
    Posts
    53
    Rep Power
    9

    Talking Much Thanks

    Thanks again.

    Here's the whole shabang for anyone else interested (need I say it? "Try at your own risk"):
    First Get altermime and install it on your Zimbra box
    http://www.pldaniels.com/altermime/
    The original putmail.py is located at (no need to download it)
    http://putmail.sourceforge.net/home.html
    Optionally Joe's Own Editor is at
    http://sourceforge.net/projects/joe-editor/
    You might be able to use
    Code:
    yum install joe
    I use joe to edit text files, you can use vi, nano, joe or whatever you like to edit yours

    SSH into your zimbra box As root and download this posts attachment
    Code:
    ssh root@my.zimbrabox.com
    wget http://www.zimbra.com/forums/attachment.php?attachmentid=187&stc=1
    tar -xzvf add_disclaimer_files.tgz
    cp /opt/zimbra/postfix/conf/master.cf /opt/zimbra/postfix/conf/master.cf.bak
    mv master.cf /opt/zimbra/postfix/conf/master.cf
    chown zimbra:zimbra /opt/zimbra/postfix/conf/master.cf
    mv putmail.py /usr/local/bin
    chmod +x /usr/local/bin/putmail.py
    mkdir /opt/zimbra/.putmail
    mv putmailrc /opt/zimbra/.putmail
    joe /opt/zimbra/.putmail/putmailrc
    Change the email address to one of your own email addresses
    /opt/zimbra/.putmail/putmailrc
    Code:
    [config]
    server = localhost
    email = admin@myzimbradomain.com
    port = 10026
    save and exit

    as root
    Code:
    cd ..
    chown zimbra:zimbra /opt/zimbra/.putmail -R
    mkdir /opt/zimbra/filter
    mkdir /opt/zimbra/filter/scratch
    mv add_disclaimer /opt/zimbra/filter
    chmod +x /opt/zimbra/filter/add_disclaimer
    joe /opt/zimbra/filter/add_disclaimer
    Find and Change copyright URL to one of your own

    /opt/zimbra/filter/add_disclaimer
    Code:
    --xheader="X-Copyrighted-Material: Please visit http://www.yourdomain.com/disclaimer.html" \
    Save text and exit

    Now create the global footer files
    as root
    Code:
    joe /opt/zimbra/filter/disclaimer.txt

    /opt/zimbra/filter/disclaimer.txt

    Code:
    Whatever text you want to appear at the bottom of each email
    Save the text and exit

    as root
    Code:
    joe /opt/zimbra/filter/disclaimer.html
    /opt/zimbra/filter/disclaimer.html
    Code:
    Whatever <b>HTML</b> text you want to appear at the bottom of each email
    Save the text and exit

    as root
    Code:
    chown zimbra:zimbra /opt/zimbra/filter -R
    mv zmrestart /opt/zimbra/bin
    chmod +x /opt/zimbra/bin/zmrestart
    chown zimbra:zimbra /opt/zimbra/bin/zmrestart
    su - zimbra
    zmrestart
    If all went well you now have global footers on each email

    Do what you can to support this excellent product. ZCS is too cool!!!
    Attached Files Attached Files

  10. #10
    Join Date
    Mar 2006
    Posts
    1
    Rep Power
    9

    Default Injecting directly to LMTP

    From my content filter, can I directly inject the message into LMTP, instead of submitting it back to postfix on the 10026 port?

Similar Threads

  1. Zimbra .pids / service monitoring
    By bin2hex in forum Administrators
    Replies: 24
    Last Post: 04-03-2010, 10:12 PM
  2. Admin login stuck on "Loading..."
    By danfluidmind in forum Installation
    Replies: 9
    Last Post: 07-12-2007, 10:04 AM
  3. 4.53: tomcat is not running
    By michaeln in forum Administrators
    Replies: 41
    Last Post: 06-13-2007, 07:42 PM
  4. tomcat not running / postfix/postqueue errors
    By seravitae in forum Installation
    Replies: 7
    Last Post: 03-10-2007, 08:18 PM
  5. Why is Tomcat shuting down ever nights?
    By trapanator in forum Administrators
    Replies: 2
    Last Post: 11-30-2006, 11:57 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •