Random musings from my awakening dementia...
07.21.2004  
Building Courier Mail System
 

I've been a computer geek since a boy, and thoughts related to computers and software engineering get dropped here for the benefit of humanity and my own hubris.

© 2004-2005, Howard Abrams



Except where otherwise noted, all original content is licensed under a Creative Commons License.
See details.

I favor Courier as my mail processing system on my Linux servers. I really don’t know enough to defend it against the other solutions available, but I know it the most. That isn’t to say that I don’t swear at it…

Actually, once it is running (and you remember to run the appropriate make* command after editing a /etc/courier/ configuration file), I don’t have much complaints. My biggest problem is just building the bloody thing on any new Linux system I need. So I thought I would document my notes on getting it running on a SuSE 9.1

Every time I build it, it gets better, so this list gets shorter and shorter. But you always start by downloading the source code (yes, you have to download the source as it isn’t distributed any other way).

Once you’ve download the tarball and if all is well in your world, you should be able to simply type the following magical incantation:

rpmbuild -ta courier*.tar.bz2

However, in the installation instructions, it claims that you need a lot of dependent packages installed, and while you do need a lot, you don’t have to have them all. So now you just need to create a ~/.rpmmacros file (in your home directory) that contains the following:

%_without_fax 0
%_without_mysql 0
%_without_pgsql 0
%_without_ldap 0

I [just found out] that instead of an rpmmacros file, you can do them on the command line via:

rpmbuild -tb --without_fax --without_ldap courier*tar.bz2

But this doesn’t seem to work. Besides, with the amount that I rerun this command, it might do well to have the rpmmacros file.

In my case, I’m trying to get this to work on a SuSE server, and it isn’t finding the openssh-perl package (which doesn’t exist for SuSE as it is a Red Hat thing). So, for this, we need to break open the tar package, edit the spec file, re-tar it, and then continue as if nothing happened. So, pull out your Alchemy 101 book, and we’ll proceed.

  1. tar xjf courier-*.tar.bz2
  2. cd courier-*
  3. You need to edit the spec file, if all you need to change is the openssl-perl thing, then the following should work: perl -pi -e 's|^.*openssl-perl|#$&|' courier.spec
  4. cd ..
  5. tar cjf courier-*.tar.bz2 courier-*/

Now try your rpmbuild command again and cross your fingers (and all six of your toes if you can) and let’s see if it works.

SuSE Woes

And, of course, in my case the gods conspire against me, and version 45.6 on SuSE 9.1 fails with the following error:

RPM build errors:
Installed (but unpackaged) file(s) found:
  /etc/openldap/schema/courier.schema
  /usr/lib/courier/share/courierwebadmin/admin-15ldap.html
  /usr/lib/courier/share/courierwebadmin/admin-15ldap.pl
  /usr/lib/courier/share/courierwebadmin/admin-15ldapa.html
   …

I found this explanation of the error, and feebly attempted to fix it by (once again) editing the courier.spec file and changing the following lines, replacing the 1 with a :

%define _missing_doc_files_terminate_build 0
%define _unpackaged_files_terminate_build 0

Re-tar up the directory and re-run the magic command, and … it doesn’t work. This whole thing is just a bug in Courier’s spec file, as it really should list out all of the files it wants to install, so in this case, I went through (after the %files section) and listed all of the files that showed up in the error.

Icky poo.

Who is PAM and Why does Courier Want Her?

Now that I finally have the bloody thing built and running on my SuSE box, I actually try to log in and it fails. Looking through the logs, I came across this cryptic reference:

PAM unable to dlopen(/lib/security/pam_pwdb.so)
PAM [dlerror: /lib/security/pam_pwdb.so: cannot open
        shared object file: No such file or directory]

And sure enough, that files doesn’t exist. Yeah, I would have thought that the automated configuration process when building would have picked up what PAM modules it should use. What you need to do, is edit the files in /etc/pam.d

  • /etc/pam.d/imap
  • /etc/pam.d/pop3
  • /etc/pam.d/esmtp
  • /etc/pam.d/webmail

And change the pam_pwdb.so reference to pam_unix.so. Restart Courier via the rccourier restart command (you did create the symlink— ln -s /etc/init.d/courier /usr/sbin/rccourier ?)

A comment to this from Dennis Skinner

—without_fax fails due to the underscore. Try it with just —without fax.

You don’t need to repack the archive with the new spec file. Just put the spec file in the SPEC dir in your rpm tree and use -ba instead of -ta. You may need to copy the tar to the SOURCE dir too, I don’t recall off the top of my head.

You should be doing all these builds as a non-root user, so the rpm tree should be in your homedir.

Comment posted on Wednesday, 25 August 2004
A comment to this from vishwesh

Dear Friend, I tried to install Courier-IMAP 0.48.2 on Redhat Enterprise AS 3.0. I downloaded the Courier authlib tar file and created RPMS and installed it. But its asking for two more dependencies…OpenSSL-Perl and mgetty+sendfax. I have mgetty already installed on my system but still asks for it..so i used your valuable docs on site and every thing started fine… after minutes of compilation …i got some Warning sand then error saying OpenSSL c_rehash.c file not found. and really there is not file in /usr/share/ssl or /usr/include/openssl directories. I am missing some thing ….or i need to recompile with some more parameters… How can i overcome this … Please sujjest me ..

I appreciate your genius and Many Thanks for the documentation you placed on website..

Best Regards Rao

Comment posted on Sunday, 30 January 2005