Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Administrators

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-03-2011, 12:12 AM
Junior Member
 
Posts: 7
Default Zimbra and procmail

Hi All,

Have any one been able to setup zimbra with procmail? Procmail as the filter for zimbra I mean. If yes, how was that achieved? Please help.
Reply With Quote
  #2 (permalink)  
Old 04-08-2011, 01:06 AM
New Member
 
Posts: 3
Default

Got it to work yesterday for 1 email adres, dunno how it scales up.

I adapted the piping instructions I found here:
Configuring Postfix to work with piped scripts - Zimbra :: Wiki

So, these cut-and-paste instructions work for me:
Code:
su - zimbra							// Make sure you're the 'zimbra' user
mkdir /opt/zimbra/procmail                            // this will hold the filter file and the logfile
cat /opt/zimbra/postfix/conf/main.cf               // check out what transports you have now, adapt the next command for your result
	proxy:ldap:/opt/zimbra/conf/ldap-transport.cf
zmlocalconfig -e transport_maps=' hash:/opt/zimbra/postfix/conf/transport,proxy:ldap:/opt/zimbra/conf/ldap-transport.cf'		// add a postfix transport
vi /opt/zimbra/postfix/conf/transport
	# Pipe transports for RT queues
	# YOU HAVE TO ADD THE PIPES TO /opt/zimbra/postfix/conf/master.cf if you want them to work!!!
	test@yourdomain.com     procmail-pipe                    // fill-in the correct email address
postmap /opt/zimbra/postfix/conf/transport			// update the transport db
vi /opt/zimbra/postfix/conf/master.cf.in			// define the pipe
	procmail-pipe         unix    -       n               n               -               -       pipe
    flags= user=zimbra argv=/usr/bin/procmail /opt/zimbra/procmail/procmailrc			
This is the header of my procmail file (/opt/zimbra/procmail/procmailrc)
	SHELL = /bin/sh
	PATH=$HOME/bin:/usr/bin:/bin:.
	MAILDIR=/opt/zimbra/procmail/  # You better make sure it exists
	DEFAULT=$MAILDIR
	LOGFILE=.procmaillog
	LOCKFILE=.procmaillock
	VERBOSE=no

Turning VERBOSE to yes will enable logging.
Everything after // is comment.
Remove beginning tabs, make sure NO line starts with a space or tab. They are only here for clarity.
Good luck !
Reply With Quote
  #3 (permalink)  
Old 10-14-2011, 03:47 AM
aks aks is offline
New Member
 
Posts: 4
Unhappy Procmail integration not working

Hi FrederikD,

I tried your solution, but it does not seem to work for me. I might be wrong with my configurations. My configurations are as below:

The configured transport in /opt/zimbra/postfix/conf/main.cf is:
Code:
transport_maps = proxy:ldap:/opt/zimbra/conf/ldap-transport.cf
In /opt/zimbra/postfix/conf/transport:
Code:
admin@iras-aks.com	procmail-pipe
In /opt/zimbra/postfix/conf/master.cf:
Code:
procmail-pipe	unix	-	n	n	-	-	pipe
    flags= user=zimbra argv=/usr/bin/procmail /opt/zimbra/procmail/procmailrc
I executed:
Code:
zmlocalconfig -e transport_maps=' hash:/opt/zimbra/postfix/conf/transport,proxy:ldap:/opt/zimbra/conf/ldap-transport.cf'
The content of the /opt/zimbra/procmail/procmailrc file are as below:
Code:
SHELL = /bin/sh
PATH=$HOME/bin:/usr/bin:/bin:.
DEFAULT=$MAILDIR
LOGFILE=.procmaillog
LOCKFILE=.procmaillock
VERBOSE=yes

:0
* From:.*admin.*
* To:.*roshan.*
* ! ^Content-Type:.*text/plain.*
{
        :0B
		        * ^(Content-(Type|Disposition):.*|[     ]*(file)?)name=("[^"]*|[^]*)\..*
				        /dev/null
}
I just want to block mail attachments from admin user to the user named roshan. The attachment blocking is not working.
Reply With Quote
  #4 (permalink)  
Old 10-14-2011, 04:19 AM
New Member
 
Posts: 3
Default

Hi aks

Unfortunately did my Zimbra proposal never got approved officially which is why my test-setup is not available anymore.

Nevertheless, can you confirm there was no /opt/zimbra/procmail/.procmaillog file created?
If not you might try changing the owner and group of /opt/zimbra/procmail/procmailrc to 'zimbra'

Frederik
Reply With Quote
  #5 (permalink)  
Old 10-16-2011, 09:05 PM
aks aks is offline
New Member
 
Posts: 4
Default

Quote:
Originally Posted by FrederikD View Post
Hi aks

Unfortunately did my Zimbra proposal never got approved officially which is why my test-setup is not available anymore.

Nevertheless, can you confirm there was no /opt/zimbra/procmail/.procmaillog file created?
If not you might try changing the owner and group of /opt/zimbra/procmail/procmailrc to 'zimbra'

Frederik
Hi FrederikD,
I could not see the file /opt/zimbra/procmail/.procmaillog file, so it's not created. The /opt/zimbra/procmail/procmailrc file is already chown-ed to zimbra:zimbra. The permission on the file is -rw-r-----. Do I need to change anything?

Thanks.
Reply With Quote
  #6 (permalink)  
Old 10-16-2011, 10:33 PM
aks aks is offline
New Member
 
Posts: 4
Default

Also that in the transport file, admin@iras-aks.com is mentioned, and it is not a system account, rather it is an account created by zimbra. Can this be the source of the problem? I was not clear about test@yourdomain.com directive in your instructions. Should I replace it with root@iras-aks.com or with zimbra@iras-aks.com

Note: iras-aks.com is the test domain that i've configured zimbra for.
Reply With Quote
  #7 (permalink)  
Old 10-18-2011, 12:51 AM
New Member
 
Posts: 3
Default

Yes, I believe I created a new email adres and used that one.

But what I could not find was a way for procmail to re-inject the mail into zimbra.
I only used that email account to filter and then forward to another email account.

Come to think of it, I don't think I ever got any logging out either. Forgive me, this is coming back to me in pieces

So I would try creating 2 new email accounts, 1 for procmail and 1 for procmail to send the mail to, and add a forward at the end of your procmailrc:
Code:
:0
    ! root@iras-aks.com
(if that is the email account you wish to read your mail in)
Reply With Quote
  #8 (permalink)  
Old 10-18-2011, 02:27 AM
aks aks is offline
New Member
 
Posts: 4
Thumbs up [SOLVED] Procmail Integration

Hi FrederikD,
I repeated all of the steps, and finally made it to work. I'm not sure of what went wrong in the previous attempt. Now that I've jotted down the configuration at How to use Procmail with ZCS.

Thanks for you help.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.