courier-imap-gentoo.readme 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. // This quick guide is for mysql authentication support base on the Gentoo Virtual Mailhosting Guide
  2. // turn ON mysql USE flag for courier-authlib. Need to authenticate against mysql database backend.
  3. localhost ~ # nano -w /etc/portage/package.use
  4. net-libs/courier-authlib mysql
  5. net-mail/courier-imap mysql
  6. localhost ~ # emerge courier-imap
  7. // limit to mysql module only, instead load all of them.
  8. localhost ~ # nano -w /etc/courier/authlib/authdaemonrc
  9. authmodulelist="authmysql"
  10. // set variables to match your setup.
  11. localhost ~ # nano -w /etc/courier/authlib/authmysqlrc
  12. MYSQL_SERVER localhost
  13. MYSQL_USERNAME mailsql_admin_username
  14. MYSQL_PASSWORD password
  15. MYSQL_DATABASE mailsql_database
  16. MYSQL_USER_TABLE users
  17. # MYSQL_CRYPT_PWFIELD crypt (commented this out if you want CRAM-MD5)
  18. MYSQL_CLEAR_PWFIELD clear
  19. MYSQL_LOGIN_FIELD email
  20. MYSQL_HOME_FIELD homedir
  21. MYSQL_MAILDIR_FIELD maildir
  22. // Start authdaemond
  23. localhost ~ # etc/init.d/courier-authlib start
  24. * Starting courier-authlib: authdaemond ... [ ok ]
  25. ### Courier-IMAP' ssl certificate setup
  26. localhost ~ # nano -w /etc/courier-imap/imapd.cnf
  27. localhost ~ # nano -w /etc/courier-imap/pop3.cnf
  28. // change to match your site.
  29. [ req_dn ]
  30. C=US
  31. ST=NY
  32. L=New York
  33. O=Courier Mail Server
  34. OU=Automatically-generated IMAP SSL key
  35. CN=mailhost.example.com
  36. emailAddress=postmaster@example.com
  37. // Generate Certificate
  38. localhost ~ # mkimapdcert
  39. ...
  40. writing new private key to '/etc/courier-imap/imapd.pem'
  41. ...
  42. localhost ~ # mkpop3dcert
  43. ...
  44. writing new private key to '/etc/courier-imap/pop3d.pem'
  45. ...
  46. ### Secure Authentication Setup (CRAM-MD5)
  47. localhost ~ # nano -w /etc/courier-imap/imapd
  48. IMAP_CAPABILITY="IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE AUTH=CRAM-MD5"
  49. ### Start Courier-imap daemons.
  50. localhost ~ # /etc/init.d/courier-pop3d start
  51. localhost ~ # /etc/init.d/courier-pop3d-ssl start
  52. localhost ~ # /etc/init.d/courier-imapd start
  53. localhost ~ # /etc/init.d/courier-imapd-ssl start
  54. ### Checking authentication.
  55. // From your favorite client send an email to user@your_domain.com
  56. // so your mail user's maildir created by your MTA.
  57. // you can not login unless user maildir has been created.
  58. localhost ~ $ telnet mailexample.com 143
  59. Trying xxx.xxx.xxx.xxx...
  60. Connected to mail.example.com (xxx.xxx.xxx.xxx).
  61. Escape character is '^]'.
  62. * OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE AUTH=CRAM-MD5 ACL ACL2=UNION STARTTLS] Courier-IMAP ready. Copyright 1998-2004 Double Precision, Inc. See COPYING for distribution information.
  63. a login user@example.com password
  64. a OK LOGIN Ok.
  65. OK LOGOUT completed
  66. Connection closed by foreign host.
  67. ### That's all folks.