Koozali.org: home of the SME Server

QMAIL - PROCMAIL - CYRUS-IMAP .. Help appreciated

Offline jonroberts

  • ***
  • 111
  • +0/-0
    • http://www.westcountrybusiness.com
QMAIL - PROCMAIL - CYRUS-IMAP .. Help appreciated
« on: August 14, 2004, 10:56:14 AM »
I'm a little out of my depth here & struggling ...

I am running cyrus-imap on my e-smith.  I produced the How-to & contrib some while ago (it can be downloaded from www.westcountrybusiness.com if you want it) and it all works fine.

I an now trying to use Procmail with it.  I installed the User-Manager contrib, which works fine but not with cyrus.

The cyrus-imap development for SME was done by someone else & passed to me, & I'm not so great in this area, so bear with me.

Qmail delivers mail to cyrus by calling the following command in the users .qmail file:

preline -f /usr/libexec/cyrus/deliver -m "$USER" "$USER"

all fine & dandy.  So what I need to do is replicate that in the procmailrc file, but I can't.

If I call it direct from procmail (| /usr/libexec/cyrus/deliver -m "jon" "jon") I initially get a "Cannot execute binary file".  So I chmod'ed 777 the cyrus folder (its not a live system!) and then the error became "couldn't connect to lmtpd: Permission denied".

I assume its a permissions problem as QMAIL can deliver OK.  I can also call the cyrus deliver from command line (logged in as root) and it delivers OK.

So any ideas how I can either:

a. Get procmail to deliver to cyrus directly

or

b: Use procmail as a filter only & pass back to qmail so that qmail can then deliver (as this seems to work).

I'm still working on that last one, but if anyone has any tips or advice, I'm ready to try anything.

Cheers

Jon
......

Offline smeghead

  • *
  • 557
  • +0/-0
QMAIL - PROCMAIL - CYRUS-IMAP .. Help appreciated
« Reply #1 on: August 14, 2004, 10:11:30 PM »
.. a hint only ...

When playing around with Jesper Knudsens install of clamav and the Dungog A/V app I found that I had to change Jespers standard install by putting back the default qmail-queue (which is replaced).  In doing this I omitted to apply the SETUID (sticky) bit to the qmail-queue and the whole mail system ground to a halt.

After a bit of research I found that this sticky bit is used to allow a called process to inherit/assume the user credentials of the calling process.

You may be able to use this on the deliver binary to make some progress.

Don't forget to note the default credentials before changing anything so it can be put back to default if it stuffs something up.

HTH
..................

Offline jonroberts

  • ***
  • 111
  • +0/-0
    • http://www.westcountrybusiness.com
QMAIL - PROCMAIL - CYRUS-IMAP .. Help appreciated
« Reply #2 on: August 15, 2004, 10:21:48 PM »
Thanks for the tip - that's what it was.

I needed to chmod 4755 both 'deliver' and 'lmtpd' & now I can forward mail to Cyrus via procmail.

[| /usr/libexec/cyrus/deliver -m "jon" "jon"]

Of course the usual procmail server-manager panel doesn't use this in creating its rules, but I can work on that.

I'll finish testing & then update the 'How To'.

Help was much appreciated.
......

Offline networks

  • 7
  • +0/-0
    • http://www.networks.fr
QMAIL - PROCMAIL - CYRUS-IMAP .. Help appreciated
« Reply #3 on: June 16, 2006, 10:04:40 AM »
Hello Jon,

Where do you put the (/usr/libexec/cyrus/deliver -m "$USER" "$USER") line in the procmailrc file

Thanks

Jerome

Offline jonroberts

  • ***
  • 111
  • +0/-0
    • http://www.westcountrybusiness.com
QMAIL - PROCMAIL - CYRUS-IMAP .. Help appreciated
« Reply #4 on: June 16, 2006, 10:22:22 AM »
Hi Jerome,

It's a long while back now & shortly after this I got the sieve filter for Cyrus working (using WebSieve as the user interface), which allowed for rule setting.  Also as recent versions of SpamAssassin don't require Procmail & I had no more reason to use Procmail & so didn't pursue this.

From memory, the line in question is the last line in the procmailrc file - it should replace whatever the existing Deliver line is.  You may also find problems with SME trying to rebuild the procmailrc file, especially if you make any changes via user-manager or server-manager.  You would need to create a custom template to work around this.

I must confess that I haven't done much development with Cyrus on SME for quite a while.  There were problems with it not surviving SME upgrades, which I never resolved.  This meant to upgrade I effectively needed build a new server & transfer / re-create data & user settings - OK for small installations (like pretty much all my clients) but would be a pain for larger setups.

Good luck.

Jon
......

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: QMAIL - PROCMAIL - CYRUS-IMAP .. Help appreciated
« Reply #5 on: June 20, 2006, 05:13:14 PM »
Quote from: "jonroberts"

I am running cyrus-imap on my e-smith.


I'm curious to know why. What advantages do you think cyrus had/has?

Offline jonroberts

  • ***
  • 111
  • +0/-0
    • http://www.westcountrybusiness.com
QMAIL - PROCMAIL - CYRUS-IMAP .. Help appreciated
« Reply #6 on: June 20, 2006, 05:35:56 PM »
Hi Charly,

Well, to be precise, I don't actually run cyrus-imap on my main e-smith server as I run Lotus Domino (due both to history & the fact we use it as a development tool).  However, we do run cyrus-imap on SME for a number of our clients.  

We are an IT services company in an area where most of our clients are small businesses (I mean 5 - 10 PCs max).  So when these companies need a server from any other supplier, it pretty much means Microsoft Small Business Server (& we also support a number of clients with SBS).

Companies of this size are ideal candidates for Linux, especially SME, as they have no internal IT expertise & just want a 'black box' that works - shares files, e-mails etc - all fine until you get to 'and of course we'd like to be able to share our calendars in Outlook'.

The client will always already have MS Office installed on their PCs and won't move - so we either need to provide this functionality or they just buy SBS from a competitor.  Cyrus-IMAP offers ACL security, which means that we can use commercial add-on connector software, such as Toltec or Bynari to provide calendar / folder sharing in Outlook using SME.  (We became a UK reseller for Toltec for this reason).

Having said all that, the main reason I haven't done much development with Cyrus recently is (a) you can't upgrade SME running Cyrus without breaking it, which I've not solved and more importantly (b) I'm really hoping that OpenExchange on SME 7 will offer an alternative.  I hope to get around to evaluating it over the summer & if all tests OK, start to migrate clients from SME 6 with Cyrus to SME 7 with OX.

Hope that answers your question - keep up the good work on SME, it's much appreciated.
......

stb

QMAIL - PROCMAIL - CYRUS-IMAP .. Help appreciated
« Reply #7 on: June 22, 2006, 12:12:02 AM »
Hi Charlie,

we are also running Cyrus on our SME.

We don't use Outlook. The main point for our company is Cyrus' ability to share mailboxes. It is extremely useful to be able to grant different users or groups access rights to specific mail folders.

Example 1: Access to our company inbox is shared. Incoming mails can be grabbed by different users and put into their own inbox or even dropped into another user's inbox for which they have the right to insert messages (without being able to view the other user's mailbox contents, of course).

Example 2: All our incoming and outgoing faxes go through Hylafax on our SME server. As soon as a fax comes in it gets converted into an email attachment and delivered to the mailbox "Faxes.incoming". This mailbox is shared with read-only access for our office personnel. Respectively, outgoing faxes are stored in "Faxes.outgoing", read-only. In this way all office personnel immediately have access to our whole fax history without being able to accidently delete a fax.

Example 3: SME also acts as our company's answering machine. Incoming calls get converted into an email attachment (wav) and routed to the mailbox "Answering Machine". Selected personnel have access to that mailbox and can handle the calls.

In short, Cyrus adds an "i-bays for mail" feature to SME.

Regards,

Stephan

Offline soprom

  • *
  • 589
  • +0/-0
    • www.logiciel-libre.org
QMAIL - PROCMAIL - CYRUS-IMAP .. Help appreciated
« Reply #8 on: July 31, 2006, 08:05:20 PM »
Great ! I'm very excited with this work from Jon!
Many thanks!

Tested it on an unmodified SME7. Works fine.
Manager interface is a lot better than the previous one.

Horde sees the shared folder correctly.

Again, Thanks to Jon for an excellent contribution!

At last, a real mail server for a workgroup.
Sophie from Montréal

Offline jonroberts

  • ***
  • 111
  • +0/-0
    • http://www.westcountrybusiness.com
QMAIL - PROCMAIL - CYRUS-IMAP .. Help appreciated
« Reply #9 on: August 04, 2006, 12:48:40 PM »
In case anyone is watching this post & hasn't seen the forums lately (& assuming the e-mail notification is working  ;-) )

There's a new version of Cyrus-Imap contrib available for SME 7.  See link below:

http://forums.contribs.org/index.php?topic=33072.0
......

Offline soprom

  • *
  • 589
  • +0/-0
    • www.logiciel-libre.org
QMAIL - PROCMAIL - CYRUS-IMAP .. Help appreciated
« Reply #10 on: November 26, 2006, 06:11:58 PM »
junkmails are still redirected to the standard folder
Maildir/.junkmail/new

I guess that switching spam check on/off in the server-manager causes the .qmail-junkmail file to:
Code: [Select]
| [ -d ./Maildir/.junkmail/ ] || /var/qmail/bin/maildirmake ./Maildir/.junkmail/
./Maildir/.junkmail/

This comes from templates-user/qmail-junkmail.

In the cyrus package, there's a file "90local" with
Code: [Select]
'| preline -f /usr/lib/cyrus-imapd/deliver -m "$USER" "$USER"';


Shouldn't it be in the Maildir?

Also, in the file "install", this line needs attention:
Code: [Select]
system("cp ./90local  /etc/e-smith/templates-user-custom/.qmail/");


Any ideas about what should be in .qmail-junkmail ?
Maybe I should replace with
Code: [Select]
'| preline -f /usr/lib/cyrus-imapd/deliver -m "$USER" "$USER"';


Thanks
Sophie from Montréal

Offline jonroberts

  • ***
  • 111
  • +0/-0
    • http://www.westcountrybusiness.com
QMAIL - PROCMAIL - CYRUS-IMAP .. Help appreciated
« Reply #11 on: November 26, 2006, 07:21:18 PM »
Hi Sophie,

I haven't come across this as I use SpamAssassin to tag email & deliver to the Inbox.  This is because I use Outlook as the client & use a Mail Rule in Outlook to move the spam to the JunkMail folder.

Having said that, the command:

| preline -f /usr/lib/cyrus-imapd/deliver -m "$USER" "$USER"';

is the code that delivers the email to Cyrus.  I'm pretty sure if you change the Second "$USER" to the name of the Junkmail folder, it will deliver the email into that folder.
......

Offline soprom

  • *
  • 589
  • +0/-0
    • www.logiciel-libre.org
QMAIL - PROCMAIL - CYRUS-IMAP .. Help appreciated
« Reply #12 on: December 01, 2006, 06:03:03 AM »
I think that 91local should replace 10deliver_to_junkmail
/etc/e-smith/templates-user/.qmail-junkmail/ or in
/etc/e-smith/templates-user-custom/.qmail-junkmail/
Sophie from Montréal