# We use Cyrus IMAP, so we are not limited by any system username # restrictions, and so that users are completely independent of any system # users. # # This is not a shell script, it just looks like one. # # If you have trouble with installing Cyrus IMAP then look at the # the documentation that comes with it. Don't bother me about it, it has # nothing to do with me! # # Gavin Stewart. #Build imap tar zxvf cyrus-imapd-2.1.5.tar.gz cd cyrus-imapd-2.1.5 # It looks like --enable-fulldirhash breaks stuff in a big way at the moment. # so we aren't using it. ./configure --disable-gssapi --with-auth=unix --with-sasl vi imap/Makefile #append to CPPFLAGS: -I../et vi timsieved/Makefile #append to CPPFLAGS: -I../et vi notifyd/Makefile #append to CPPFLAGS: -I../et make #As root make install /usr/sbin/adduser cyrus #Make cyrus default to "mail" group, which is "12" under RedHat 7.x vi /etc/passwd #like: #cyrus:x:602:12::/home/cyrus:/bin/bash vi /etc/syslog.conf #Add the following: (minus the leading "# " - duh) # #Ldap # local4.* /var/log/ldap.log # # #Cyrus IMAP # local6.* /var/log/imapd.log # # #Debug auth # auth.debug /var/log/auth.log # # These can be tweaked to remove debugging logs after it all works! touch /var/log/ldap.log /var/log/imapd.log /var/log/auth.log # Setup any logrotation you might need. # # copy in our imapd.conf # (from the openbottle-core source tree, still as root): cp cyrus/imapd.conf /etc/ # Setup the imap directories (defined in imapd.conf) mkdir /var/imap chown cyrus.mail /var/imap chmod 750 /var/imap mkdir /var/spool/imap chown cyrus.mail /var/spool/imap chmod 750 /var/spool/imap # as the cyrus user now: # (from the cyrus-imapd source tree): su cyrus tools/mkimap exit # back as root chattr +S /var/imap/user /var/imap/quota /var/imap/user/* /var/imap/quota/* chattr +S /var/spool/imap /var/spool/imap/* #build our ssl cert: openssl req -new -x509 -nodes -out /var/imap/server.pem -keyout /var/imap/server.pem -days 365 #Fill in data: # # Country Name (2 letter code) [AU]:AU # State or Province Name (full name) [Some-State]:openbottle # Locality Name (eg, city) []:openbottle # Organization Name (eg, company) [Internet Widgits Pty Ltd]:OpenBottle # Organizational Unit Name (eg, section) []: # Common Name (eg, your name or your server's hostname) []: # Email Address []: # Ensure no pop/pops/imap/imaps are running in (x)inetd # # Copy in the master config file. # (from the openbottle-core source tree, still as root): cp cyrus/cyrus.conf /etc/ # Can now start process by hand: /usr/cyrus/bin/master & #Use the provided init file to start sasl and cyrus at boot up. # sasl_cyrus.init under the cyrus directory # (make sure ldap is starting automatically too, and make sasl starts before # it) # if you have S39ldap, use S38sasl_cyrus # # Check they start and stop ok. # Setup sendmail to deliver to the imap system. # copy the provided cyrusv2.mc into /etc/mail # make sure it looks ok, the in /etc/mail: m4 cyrusv2.mc > /etc/sendmail.cf # restart sendmail /etc/rc.d/init.d/sendmail restart # Fix up the perl modules installed with the Cyrus imap package, they # are installed into the wrong directory: cd /usr/lib/perl5/site_perl/5.6.1/i386-linux cp -a /usr/local/lib/perl5/site_perl/5.6.1/i386-linux/* . # Setup a mailbox # # with a valid user (with password) in ldap, and specified as an admin in # /etc/imapd.conf, we can (as a normal user) setup a mailbox # # If the docs/configure_ldap.txt instructions were followed, we have an # admin by the name of "imapadmin@opebottle". # # as non-root user: cyradm --server localhost --user imapadmin@openbottle # enter password # you should then see a "localhost.localdomain>" prompt. # # create our test user mailbox # (Note the prefix of "user/" before the username) # cm user/test@example.com exit # Hand send an email to the mailbox # Please note the three backslashes in "test\\\@example.com@backend.openbottle" telnet localhost 3535 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. 220 mail.openbottle ESMTP Sendmail 8.11.6/8.11.6; Mon, 5 Aug 2002 22:52:44 +1000 helo me.here 250 mail.openbottle Hello localhost [127.0.0.1], pleased to meet you mail from: test@example.com 250 2.1.0 test@example.com... Sender ok rcpt to: test\\\@example.com@backend.openbottle 250 2.1.5 test\\\@example.com@backend.openbottle... Recipient ok data 354 Enter mail, end with "." on a line by itself test 1 done. . 250 2.0.0 g75Cqqc29221 Message accepted for delivery quit 221 2.0.0 mail.openbottle closing connection Connection closed by foreign host. #tail /var/log/maillog should have something like: Aug 5 22:53:03 mail01 sendmail[29221]: g75Cqqc29221: from=test@test.com.au, size=13, class=0, nrcpts=1, msgid=<200208051252.g75Cqqc29221@backend.openbottle>, proto=SMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1] Aug 5 22:53:03 mail01 sendmail[29227]: g75Cqqc29221: to=test\\\@example.com@backend.openbottle, delay=00:00:06, xdelay=00:00:00, mailer=cyrus, pri=30013, relay=localhost, dsn=2.0.0, stat=Sent # Hand test pop3 to see if email is there. telnet localhost pop3 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. +OK mail.openbottle Cyrus POP3 v2.1.5 server ready <3151879767.1028552052@mail.openbottle> user test@example.com +OK Name is a valid mailbox pass secret +OK Maildrop locked and ready list +OK scan listing follows 1 540 . quit +OK Connection closed by foreign host. #It's all good!