Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Sieve scripting on OS X Server 10.4.3 using avelsieve

All,

As noted elsewhere on the forums (and AFP548), the latest Tiger updater has fixed the problems many were having with Sieve scripts, particularly using the SquirrelMail plug-in avelsieve. Below is guide to getting this working if you're starting from scratch, something I see a number of people are asking for...

Prerequisites
===============
I have used the following setup on a fresh install of Mac OS X 10.4 Server, with the 10.4.3 Combo Update installed. I then added a user to the local netinfo domain as a test case, and along with the default admin account have enabled mail for these users - Note: Open Directory is not currently running.

Web, DNS, SMTP and IMAP/POP are all running, and SquirrelMail has been enabled in Web Services. SquirrelMail has been tested for the two users mentioned above, and both accounts log in correctly, displaying empty mail boxes.

To enable sieve scripts via Squirrelmail
========================================

1) If it doesn't already exist, create the following directory as root or using sudo from the Terminal;

% sudo mkdir -p /usr/sieve
% sudo chown cyrusimap /usr/sieve
% sudo chgrp wheel /usr/sieve

Directory permissions should then look like;

drwxr-xr-x 3 cyrusimap wheel 102 Nov 3 21:31 sieve

2) Add (or un-comment if it exists) the following line to the /etc/services file. To do this you either need to su to root (or use sudo) to edit the file using the Terminal.

sieve 2000/tcp # Sieve mail filtering

3) Stop the mail services from Server Admin.

4) On the Mail -> Settings -> Advanced tab, ensure you have IMAP set to allow 'PLAIN' as well as 'Clear' Authentication.

5) Start the mail services from Server Admin.

6) Run the following command using the Terminal, as any user;
% telnet localhost 2000

You should see the following output;

Trying ::1...
Connected to localhost.
Escape character is '^]'.
"IMPLEMENTATION" "Cyrus timsieved v2.2.12-OS X 10.4.0"
"SASL" "PLAIN"
"SIEVE" "fileinto reject envelope vacation imapflags notify subaddress relational comparator-i;ascii-numeric regex"
"STARTTLS"
OK

7)If you see this, your timsieved is working correctly. Use the escape character to leave the daemon, and quit telnet.

8) Download the most recent avelsieve distribution from the web page at http://email.uoa.gr/projects/squirrelmail/avelsieve_download.php. I used the more recent Dev Branch version: avelsieve-1.9.3.tar.gz, and haven't tested the earlier 1.0.1 version. If anyone has this working also, let me know.

9) Un-tar this in the squirrelmail plugins directory ( /usr/share/squirrelmail/plugins ), again as root or using sudo via the Terminal and cd into ( avelsieve/config/ ). Copy the example config 'config_sample.php' to 'config.php' IN THE SAME DIRECTORY (this is different from the V1.0.1 setup I believe). I didn't need to edit anything in the config.

10) Run the SquirrelMail config perl script, using sudo like so;
% sudo /etc/squirrelmail/config/conf.pl

Choose Option 8, "Plugins" from the menu, and enable "avelsieve" by selecting it from the resultant list. Save your changes and quit the utility.

11) Login in to one of the mail accounts using SquirrelMail, and the "Filters" menu should now be an option - choosing this allows you to create your sieve scripts, including a vacation mail 'auto-reply'.

12) Looking in the /usr/sieve/a/admin directory (for example) should show the following files;

lrwx------ 1 cyrusima wheel 12 Nov 4 11:41 defaultbc -> phpscript.bc
-rw------- 1 cyrusima wheel 232 Nov 4 11:42 phpscript.bc
-rw------- 1 cyrusima wheel 1056 Nov 4 11:42 phpscript.script

Please let me know comments and/or corrections, especially if you have achieved this differently.

Regards,

Ian Butler

Posted on Nov 4, 2005 7:09 AM

Reply
45 replies

Jun 8, 2006 7:22 AM in response to Paul Bailey4

Paul, those are some very basic questions - I strongly suggest you practice on some unimportant things before tackling your mail configuration. Do a google search for some basic unix tutorials to get started, try a couple of sites to find a good one.

But here's the immediate answers to your questions:

1. To check the directory permissions, use the "ls" command with the "-l" option (those are the letter "ell", not "i" or one). The exact command is
ls -l /usr/
or
ls -ld /usr/sieve
The first one will list all the folders in the /usr directory which might be too much, the second one will only list the sieve directory, but you need the extra "d" so that it shows the permissions of the directory itself instead of the contents of the directory.

2. Use any text editor to comment or uncomment lines in a script. To turn something into a comment, put a "#" at the beginning of the line, to uncomment something just remove the #. "nano" is a simple text editor built into 10.4, so you could type "nano /etc/services" (you'll actually have to preface that with "sudo" ("sudo nano /etc/services") so that you get root permissions to edit the file).

3. Use the "tar" command to un-tar things. Something like
tar -vzxf avelsieve.tgz /usr/share/squirrelmail/plugins/
but you have to change "avelsieve.tgz" to whatever the name of your downloaded file is, and you may need to specify the directory that it is in. You can also double-click a .tar or .tgz file (a "tarball") and the Finder will untar it, but then you need to use "mv" or "cp" to move or copy it to the right place.

Again, look for a good basic unix tutorial. Also, for more detailed information on how to use any unix command, you can use the "whatis", "apropos" and "man" commands.

"whatis" tells you (briefly) what a command does.
whatis ls
whatis tar

"man" shows you the detailed instructions for the command (the manual), including the syntax and what all the options do (hit the space bar to scroll the text)
man ls
man tar

And "apropos" is a method to search for commands that do something, so typing "apropos directory" would have shown you everything that can affect directories, including the "ls" command. You can use that when you don't know what command to use.

iMac flat panel, 15 Mac OS X (10.4.2)

Jun 8, 2006 7:50 PM in response to Joseph Delaney

Joseph,

I appreciate everything you have done so far. It has really helped me.

I have come across a couple more questions that I hope you can answer.

1. When I checked the directory permissions on /usr/sieve mine says: drwxr-xr-x 2 cyrusimap wheel ... Ian said that it should look like: drwxr-xr-x 3 cyrusimap wheel ... What is the difference between the 2 and 3.

2. I get an error when I try to use tar on avelsieve-1.9.6.tar that says /usr/share/squirrelmail/plugins is not available in the archive. Here is the syntex that I used.

sudo tar -vzxf avelsieve-1.9.6.tar /usr/share/squirrelmail/plugins

so then I moved the file to the desktop and tried.

sudo tar -vzxf /desktop/avelsieve-1.9.6.tar /usr/share/squirrelmail/plugins

I've tried many difference source locations but always seem to get the error listed above.

Jun 9, 2006 7:29 AM in response to Paul Bailey4

Sorry, I messed up the "tar" command. I forgot a "-C". You should have used

sudo tar -vzxf avelsieve-1.9.6.tar -C /usr/share/squirrelmail/plugins

But usually what I do is "cd" into the directory where I want the files to end up, then use tar without the destination, so it would look something like

cd /usr/share/squirrelmail/plugins/
sudo tar -vzxf ~/Desktop/avelsieve-1.9.6.tar


This is part of the information you'll see if you type "man ls" (you might want to try http://www.versiontracker.com/dyn/moreinfo/macosx/2734 )
"If the -l option is given, the following information is displayed for
each file: file mode, number of links, owner name, group name, number of
bytes in the file, abbreviated month, day-of-month file was last modi-
fied, hour file last modified, minute file last modified, and the path-
name."

So, according to that, the "2" and the "3" refer to the number of links, which translates roughly to the number of files inside that folder (some are hidden, "ls -a" shows them all). The "file mode" is the permissions, that's the first column "drwxr-xr-x"

Jun 23, 2006 3:29 PM in response to tknospdr

I answered my own question by finally taking the time to read the config.php file myself.

If you want your webmail to be a bit more secure and don't want to enable plain or clear...

Change line 48 in config.php from:

$sieve preferred_saslmech = 'PLAIN';

to

$sieve preferred_saslmech = 'PLAIN CRAM-MD5';

That's it, now you can sleep better at night, well at least I can anyway.

Thanks,
David

Jul 22, 2006 11:37 AM in response to Dale Walsh

To make your life easier after running
" mailbfr", stop mail, edit /etc/imapd.conf
(with a suitable editor like BBEdit) and make the
following changes/additions.

annotation_db: skiplist
duplicate_db: skiplist
mboxlist_db: skiplist
ptscache_db: skiplist
seenstate_db: skiplist
subscription_db: flat
restart mail then restart the server.



Why, what will this do?

Thanks,
David


Aug 10, 2006 9:22 PM in response to Ian Butler

These directions are fantastic. I can't possibly thank you enough for them. But even after following each direction, I get to the end to where I click on the Filters link and get:

Could not log on to timsieved daemon on your IMAP server localhost.

I know there are supposed to be files/folders in the /usr/sieve directory, but there's nothing there. At what point are those files supposed to be created?

Thanks,

k

Aug 17, 2006 10:07 AM in response to Ian Butler

On squirrelmail 'Filter' access, I get the message

Could not log on to timsieved daemon on your IMAP server localhost:2000.
Error Encountered: 61 Connection refused
Please contact your administrator.

I think this relates to the telnet login to port 2000 also failing (see an earlier reply on telnet localhost 2000 failing with "Connection refused" message. Is the only way to get this to work is enabling telnet?

Mac OS X (10.4.7)

Dec 19, 2006 12:31 PM in response to Ian Butler

Could not log on to timsieved daemon on your IMAP server localhost:2000

When any of my users click on the filters area they get the above message.

I have an xserve g5 running 10.4.8 and avelsieve 1.9.7

I have read though all the posts I could find but none specifically outline what the cause and remedy is to this problem.

Please Help

xserve Mac OS X (10.4.8) 25 Mac Network

Dec 19, 2006 2:59 PM in response to governali

This thread os over a year old and as you said, it doesn't include a cause or remedy to your problem.... It would be best if you start a new thread with relevent config information and the troubleshooting you have performed (for example, did you try to telnet to port 2000?)
From Terminal:
telnet localhost 2000


Post in a new thread, it will be easier to look at your issue with a clean slate.

jeff

Sieve scripting on OS X Server 10.4.3 using avelsieve

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.