BSD DevCenter

oreilly.comSafari Books Online.Conferences.

We've expanded our LAMP news coverage and improved our search! Search for all things LAMP across O'Reilly!

Search
Search Tips

advertisement

Listen Print Discuss Subscribe to BSD Subscribe to Newsletters

Running Cyrus IMAP
Pages: 1, 2, 3, 4



Now restart Postfix to make it read the new configuration files:

# postfix reload

In addition to having users listed in SASL and Cyrus, Postfix needs to know about them. Add each user to /usr/local/etc/postfix/virtual in the format:

user@domain     user@domain

You may also want to have a single address to receive all mail not designated to a valid address. Add the line:

@domain1 valid_user@domain1

Be aware that doing this will cause all the spam to that domain to go to that user. On the bright side, doing this will make your setup more compliant with the Internet standards that require the existence of addresses such as postmaster.

Finally, run postmap /usr/local/etc/postfix/virtual. Remember to run postmap every time you change that file.

Testing Your Setup

If you already have an IMAP client, you can connect to your newly configured Cyrus server using the test user. Remember to append the domain name when you log in.

If you don't have an IMAP client, you can use a text-based mail client, called Cone, in the ports system for your test. You can install Cone in the same server in which you have installed Cyrus, or on a different machine as long as it can connect to the Cyrus IMAP server.

# cd /usr/ports/mail/cone
# make install clean

For the rest of the test, you do not need to be the root superuser.

  • Start the Cone program by typing cone at the command prompt.
  • Click on M for the main menu.
  • Click on N for a new account.
  • Click on I for IMAP.
  • Type a descriptive name for the account name.
  • Type the IP or DNS name of the machine in the Server field.
  • Enter the username, including the domain, in the Login field.
  • Enter the password in the Password field.
  • Select the Inbox folder.

Once you are able to connect to the IMAP server with your own client or with Cone, try sending an email. If the machine is the one responsible for handling email for the given domain (that is, if your DNS MX records point to it), you can send an email to your test user from any machine.

If the IMAP server doesn't yet have MX records pointing to it, you can still test your setup by setting the machine you configured as your Cyrus server as the SMTP server. If you're using Cone from the same machine, you don't need to do anything extra. Just write an email and send it to your test user. By default, Cone will use the current machine as the delivery SMTP server.

Links

  • Cyrus
  • Postfix
  • Cone

Francisco Reyes is an independent consultant in New York.


Return to the BSD DevCenter.


What else do you configure in your mail server?
You must be logged in to the O'Reilly Network to post a talkback.
Post Comment
Full Threads Oldest First

Showing messages 1 through 12 of 12.

  • Error in mailbox
    2007-01-24 07:20:21  Osmar_Leao [Reply | View]

    I am getting this error with any mailbox:

    relay=/var/lib/imap/socket/lmtp[/var/lib/imap/socket/lmtp], delay=0, status=bounced (host /var/lib/imap/socket/lmtp[/var/lib/imap/socket/lmtp] said: 550-Mailbox unknown. Either there is no mailbox associated with this 550-name or you do not have authorization to see it. 550 5.1.1 User unknown (in reply to RCPT TO command))

    Thanx
    • Error in mailbox
      2007-02-03 20:43:59  simplicato [Reply | View]

      That sounds like you do not have the account in the Cyrus DB. In particular notice how the error was generated by lmtp and not postfix.
  • open relay
    2005-12-28 21:44:00  bucketshop [Reply | View]

    Even worse... it appears to be a prime example on how to build an open relay.

    I can't seem to get it make me authenticate when sending mail... no matter what I do.

    Any thoughts?
  • Nice howto
    2005-12-28 19:35:22  bucketshop [Reply | View]

    Hi,

    Is there anyway to have folders outside of the Inbox like the following?

    Inbox
    subfolder1
    subfolder2
    Trash
    Mailing Lists
    Postfix
    Dovecot
    FreeBSD
  • Timely article...
    2005-11-02 20:31:47  fak3r [Reply | View]

    I was rebuilding my server tonight, and looked out on bsdforums for advice on an IMAP server and came here. Great HOWTO, however I'm stuck at:

      # su cyrus

      %/usr/local/cyrus/bin/mkimap

      reading configure file...

      i will configure directory /var/imap .

      i saw partition /var/imap/spool.

      done

      configuring /var/imap ...

      couldn't change to /var/imap at (eval 1) line 67.

      %ls -l /var/imap/

      total 2

      drwxr-x--- 2 cyrus mail 512 Nov 2 22:18 spool

      %ls -l /var/imap/spool/

      total 0

      %


      The directory is there, perms are ok, what's up?
    • Timely article...
      2006-07-11 05:10:08  jlbrown [Reply | View]

      Simply use sudo before the command - worked for me!

      Ie:

      sudo tools/mkimap

      James.
    • Timely article...
      2005-11-17 08:21:12  Chemi [Reply | View]

      The problem may be that you copied and pasted the imapd.conf from the article, then you deleted the part "[1]", but forgot to remove the blank space at the end of the line (at least this was what I did and had the same problem). That makes the perl script crazy.
      I removed the blank space at the end of the line and everything went OK.

      Best wishes.
    • Timely article...
      2005-11-02 20:49:02  fak3r [Reply | View]

      Not sure if it's me or the Fbsd 6.0 I'm running, but the fix is:



      su - cyrus

      mkdir /var/imap/proc
      • Timely article...
        2005-11-02 21:19:33  fak3r [Reply | View]

        Hmm...and then I had to do:

        su - cyrus
        mkdir /var/imap/db

        but now I'm failing at:
        Nov 2 23:18:48 pepe postfix/lmtp[98941]: 9983C21D: to=<xxxxxxxxx>, relay=none, delay=2, status=deferred (connect to /var/imap/socket/lmtp[/var/imap/socket/lmtp]: Socket operation on non-socket)

        Google isn't helping yet...
  • Instructions are *close*...
    2005-10-28 13:22:24  HThomp [Reply | View]

    This took me a few days to get up and running, however there were really a few errors that took time to track down, so I figured I'd post my resolutions here...maybe it saves someone else the time! My overall opinion is that your instructions were easy to follow, yet it would have been easier if you left file contents in order as generally 90% were already there and 10% needed to be added. Also it would be helpful if "domain" and "user" had more specific examples and if you differentiated between domain (e.g. example.com) and fully qualified hostname (e.g. mail.example.com).


    Errors:

    Error:
    postfix/lmtp[563]: …status=deferred (connect to /var/imap/socket/lmtp[/var/imap/socket/lmtp]: Permission denied
    <br/>
    Resolution:
    ensure /var/imap permissions are cyrus:mail 750 (not cyrus:cyrus)


    Error:
    Couldn’t connect to mailbox after being created.
    <br/>
    Resolution:
    createmailbox user.jdoe

    setaclmailbox user.jdoe jdoe all

    quit


    Error:
    postfix/trivial-rewrite[502]: warning: do not list domain example.com in BOTH mydestination and virtual_mailbox_domains
    <br/>
    Resolution:
    In /usr/local/etc/postfix/main.cf set mydestination = (leave blank)


    Error:
    Postfix/smtpd[557]: warning: unknown smtpd restriction: “reject_unkown_sender_domain”
    <br/>
    Resolution:
    remove, appears to be a smtpd_recipient_restriction



    Hints:

    • Define all e-mail addresses, user ids, etc in lowercase

    • NTLM required in SASL2 for Outlook support

    • Defining SASL users seemed to require the full hostname jdoe@mail.example.com as jdoe@example.com did not work.

    • Defining Postfix virtual users:
      john.doe@example.com jdoe@example.com

    • Testing IMAP: /usr/local/bin/imtest -m login -a jdoe




    Useful Links:

    • http://www.postfix.org/basic.html

    • http://asg.web.cmu.edu/cyrus/download/imapd/install.html

    • http://www.doorbot.com/guides/sendmail/securemail/

    • http://www.bsdforums.org/forums/showthread.php?t=10424

    • http://www.lnxsys.ca/docs/postfix-cyrus-FC2/


    Next up, securing the whole thing with OpenSSL and adding the spam filter.

  • Catch All Mailboxes.
    2005-10-24 15:48:32  jasontaylor1 [Reply | View]

    You may also want to have a single address to receive all mail not designated to a valid address. Add the line:

    @domain1 valid_user@domain1


    That's a really bad idea. Just add hostmaster@ webmaster@ abuse@ postmaster@

    Catch all mailboxes are SPAM magnets as many spammers cycle through common and some really really odd usernames to find mailboxes to spam. You'll have many thousands of SPAMs in your mailbox if you permit that and have no SPAM checking place.

    I've seen a catch all mailbox get 10,000 SPAMs a day.

    Thanks

    Jason
    • Catch All Mailboxes.
      2005-10-24 16:17:03  FranciscoReyes [Reply | View]

      Dear jason,
      I agree with you that listing the individual required accounts is better than having a catch all, however those 4 are also heavily targetted by spammers

      I am working on a follow up article that deals with spam and presents some actions a user can take to fight back spam.

      Thanks for your feedback!


Sponsored Resources

  • Inside Lightroom
Advertisement

Sponsored by:

O'Reilly Media

©2009, O'Reilly Media, Inc.
(707) 827-7000 / (800) 998-9938
All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners.
About O'Reilly
Academic Solutions
Authors
Contacts
Customer Service
Jobs
Newsletters
O'Reilly Labs
Press Room
Privacy Policy
RSS Feeds
Terms of Service
User Groups
Writing for O'Reilly
Content Archive
Business Technology
Computer Technology
Google
Microsoft
Mobile
Network
Operating System
Digital Photography
Programming
Software
Web
Web Design
More O'Reilly Sites
O'Reilly Radar
Ignite
Tools of Change for Publishing
Digital Media
Inside iPhone
O'Reilly FYI
makezine.com
craftzine.com
hackszine.com
perl.com
xml.com

Partner Sites
InsideRIA
java.net
O'Reilly Insights on Forbes.com