installing IMAP

dfbills

Senior Member
I'm trying to figure out how to install IMAP. So far, I've:

- downloaded the UW-IMAP from http://www.washington.edu/imap/ and built it
- moved the imapd to /usr/local/libexec
- made changes to /etc/inetd.conf

I've sent a -HUP to to inetd, rebooted, and tried to start it manally (./usr/local/libexec/imapd). All this and I've not been able to access the imap daemon. A port scan confirms that it isn't working.

I see a decent startup when I launch manually:

* PREAUTH [CAPABILITY IMAP4REV1 IDLE NAMESPACE MAILBOX-REFERRALS SCAN SORT THREAD=REFERENCES THREAD=ORDEREDSUBJECT MULTIAPPEND] Pre-authenticated user dfbills localhost.nyc.rr.com IMAP4rev1 2001.315 at Sat, 2 Mar 2002 20:18:58 -0500 (EST)

What am I doing wrong?
 
hmm, strange, I just grabbed the source, built it, threw the binary in /usr/local/libbexec, edited /etc/inetd.conf, sent inetd a -HUP, and boom, working imap server...

can you telnet to port 143 on your machine?

telnet localhost 143

The only thing I see that looks strange is that on your start up message, the machine is identified as localhost.nyc.rr.com, rather than ip-add-rr-e-ss.nyc.rr.com (which is how mine looks). Is it possible your hostname is not configured in netinfo?

How did you test to see if it was working?

If you can telnet to port 143, I would try creating a directory named "mail" without the quotes in your home directory, it's possible that's what's tripping it up.

Also, is there any useful info in /var/log/mail.log ? Does it at least show imap services starting (or failing to start). Keep in mind that you won't see an actual "imapd" process; inetd will handle the service.

I'm not sure what else to check...

but the logs at least are a good place to start. A good quick and dirty trick is to cd to /var/log and grep for imap (or whatever you're looking for) is all the files:

cd /var/log
grep imap *

you'll get back all the lines that contained the search term, prefaced by the name of the file in which it was found:

filename: <a line of text with "imap" in it>

Anyway, keep us posted on anyting that turns up.

Excuse me, I have to go turn off an imap server...

-alex.
 
Oh, one more thing, is imap defined in both /etc/services and netinfo? That could also be a problem...

-alex.
 
Ok, I've got it running now.. it seems that I didn't have a /private/etc/hosts.allow file. I added:


imapd: 127.0.0.1 10.0.1.1 65.212.125.244 :ALLOW
ALL: ALL: DENY

and it just works! (with one problem, see below)

I wonder why yours worked plug and play and mine did not? Any ideas?

Also, I'm seeing all subdirs of my home folder, not just mail. How can I limit the scope?
 
Did you make clean first, then apply the patch, then make osx again? If you don't make clean first, there's a good chance the changes won't be reflected in the binaries.

I have done this exact thing (allbeit with a different directory) on a NetBSD box, so it should work. I'm not sure why stepwise has you jump through all those PERL hoops... it seems like it would just be easier to edit the source code directly, but whatever....

Sounds like you're making progress, though.

-alex.
 
No dice! I cleaned copied restarted inetd. No change...

So I'm guessing the config files are not being properly modified..

are these the correct lines to modify in src/osdep/unix/env_unix.c ?

static char *myUserName = NIL; /* user name */
static char *myHomeDir = NIL; /* home directory name */
static char *myMailboxDir = NIL;/* mailbox directory name */
static char *myLocalHost = NIL; /* local host name */

I really can't decode that perl script too well:


/myHomeDir\s*=\s*cpystr\s*\(home\s*\?\s*home\s*:/ and do
{
print qw( sprintf(tmp, "%s/Library/Mail/Mailboxes", home););
print "\n";
s/\?\s*home\s*:/\? tmp :/;
};


Thanks in advance-
 
Alright, I think I may have an answer for you:

After playing around with the source on OSX, it seems that the stepwise PERL hack tries to hard code your home directory. For whatever reason, this doesn't seem to work. Rather, you should hard code your mail directory. I can't give you funky PERL to do this, but all you need to do is cd into the imap source directory, then:
cd src/osdep/unix (note the lack of a leading "/" indicating this is a relative path)

In there is a file called "env_unix.c" Open it with your favorite text editor and find the line that looks like this:

static char *myMailboxDir = NIL ; /* mailbox directory name */

and
change it to:

static char *myMailboxDir = "Library/Mail/Mailboxes" ; /* mailbox directory name */

That should do it. Make sure you get a fresh copy of the source or fix the myHomeDir line by hand (make it NIL again) since that is what the stepwise method tries to change. Then make clean, make osx, and see how it goes...

-alex.
 
Alex:

You got it! It is now working! The mailboxes are a bit messy inside, but I now know how to change them to any place I want.

Now, it's on to SSL support after I take a much needed break!
 
Great! Glad it's working for you!

About getting SSL... I can't find the openSSL libraries or headers anywhere, does OSX not have them? If not, you can use fink to install openSSL (find fink at versiontracker.com) then just do a:

make osx SSLTYPE=unix

though you may have to add an Include to the makefile or an EXRTACFLAGS to the make command if your openSSL libraries are in a strange place (fink puts them in /sw by default)

New Yorker, huh? Just curious, where do you live? (Feel free not to answer, I'm up on 105th and Columbus in manhattan).

-alex.
 
It looks like ssl is in /usr/bin/openssl. I hope this is all I need..

After spending more time reading the tutorial on http://www.stepwise.com/Articles/Workbench/eart.index.html, I'm thinking of tunnelling with stunnel.

UW imap server release notes mention bad side effects of compiling imapd with OpenSSL. Plus, there could be some overhead with the tcpwrapper on top of the ssl.

Any thoughts on which way to go?

Oh, and it is a small world after all because I'm at Columbus circle!
 
Back
Top