authentication.txt 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. **********************************************
  2. IMAP AND SMTP AUTHENTICATION WITH SQUIRRELMAIL
  3. $Id$
  4. Chris Hilts tassium@squirrelmail.org
  5. **********************************************
  6. Prior to SquirrelMail 1.4.0, only plaintext logins for IMAP and SMTP were
  7. supported. With the release of SquirrelMail 1.4.0, support for the
  8. CRAM-MD5 and DIGEST-MD5 auth mechanisms has been added. TLS support has
  9. also been added. It is possible to use different methods for both IMAP and
  10. SMTP. TLS is able to be enabled on a per-service basis as well.
  11. Unless the administrator changes the authentication methods, SquirrelMail
  12. will default to the "classic" plaintext methods, without TLS.
  13. Note: There is no point in using TLS if your IMAP server is localhost. You need
  14. root to sniff the loopback interface, and if you don't trust root, or an attacker
  15. already has root, the game is over. You've got a lot more to worry about beyond
  16. having the loopback interface sniffed.
  17. REQUIREMENTS
  18. ------------
  19. CRAM/DIGEST-MD5
  20. * SquirrelMail 1.4.0 or higher
  21. * If you have the mhash extension to PHP, it will automatically
  22. be used, which may help performance on heavily loaded servers.
  23. ** NOTE: mhash is optional and no longer a requirement **
  24. * Digest-MD5 authentication needs PHP XML extension.
  25. TLS
  26. * SquirrelMail 1.4.0 or higher
  27. * PHP 4.3.0 or higher (Check Release Notes for PHP 4.3.x information)
  28. * The server you wish to use TLS on must have a dedicated port listening for
  29. TLS connections. (ie. port 993 for IMAP, 465 for SMTP). See STARTTLS
  30. requirements, if you want to use IMAP or SMTP STARTTLS extension.
  31. * If you use PHP 4.3.x, OpenSSL support must be compiled staticly. See
  32. PHP bug #29934 (http://bugs.php.net/bug.php?id=29934)
  33. STARTTLS
  34. * SquirrelMail 1.5.1 or higher
  35. * PHP 5.1.0rc1 or higher (stream_socket_enable_crypto() function)
  36. * Server with STARTTLS extension support
  37. CONFIGURATION
  38. -------------
  39. All configuration is done using conf.pl, under main menu option #2.
  40. conf.pl can now attempt to detect which mechanisms your servers support.
  41. You must have set the host and port before attempting to detect, or you
  42. may get inaccurate results, or a long wait while the connection times out.
  43. If you get results that you know are wrong when you use auto-detection, send
  44. information about it to SquirrelMail developers. Provide the results you got,
  45. the results you expected, and server type, name, and version (eg. "imap,
  46. Cyrus, v2.1.9").
  47. KNOWN ISSUES
  48. ------------
  49. DIGEST-MD5 has three different methods of operation. (qop options "auth",
  50. "auth-int" and "auth-conf"). This implementation currently supports "auth"
  51. only. Work is being done to add the other two modes.
  52. DIGEST-MD5 _may_ fail when authenticating with servers that supply more
  53. than one "realm". I have no servers of this type to test on, so if you do
  54. and it fails, let me know! (A big help would be for you to telnet to your
  55. server, start a DIGEST-MD5 auth session, and include the challenge from the
  56. server in your bug report.)
  57. To get the challenge with IMAP:
  58. telnet <your server> imap
  59. [server says hello]
  60. A01 AUTHENTICATE DIGEST-MD5
  61. <copy the gobbledygook that the server sends - this is what I need>
  62. *
  63. [server says auth aborted]
  64. A02 LOGOUT
  65. [server says goodbye, closes connection]
  66. To get the challenge with SMTP:
  67. telnet <your server> smtp
  68. [server sends some sort of "hello" banner]
  69. EHLO myhostname
  70. [server will probably list a bunch of capabilities]
  71. AUTH DIGEST-MD5
  72. <copy the gobbledygook that the server sends - this is what I need>
  73. *
  74. [server says auth aborted]
  75. QUIT
  76. [server says bye, closes connection]
  77. OPTIONAL SMTP AUTH CONFIGURATION
  78. --------------------------------
  79. In SMTP authentication SquirrelMail uses user's login name and password. If you
  80. need all users to send mail via an upstream SMTP provider (your ISP, for
  81. example), and that ISP requires authentication, you can configure custom
  82. username and password. $smtp_sitewide_user configuration variable stores custom
  83. username used during SMTP authentication. $smtp_sitewide_pass stores custom
  84. password that is used during SMTP authentication, if $smtp_sitewide_user
  85. variable is not empty.
  86. SquirrelMail 1.5.0 and 1.5.1 stored these configuration variables in
  87. config_local.php. Newer SquirrelMail versions allow to configure them in conf.pl
  88. configuration utility.
  89. These configuration variables will be used to connect to the SMTP server as long
  90. as the authentication mechanism is something besides 'none', i.e. 'login',
  91. 'plain', 'cram-md5', or 'digest-md5'.
  92. DEBUGGING SSL ERROR MESSAGES
  93. ----------------------------
  94. SquirrelMail disables display of PHP errors in fsockopen() and
  95. stream_socket_enable_crypto() function calls. These functions use PHP error
  96. handler to display connection errors and SquirrelMail tries to handle
  97. errors without displaying debugging information to end user. If you use TLS or
  98. STARTTLS and get connection errors, try reproducing them in configtest.php
  99. script or remove @ symbol from fsockopen() and stream_socket_enable_crypto()
  100. calls in SquirrelMail scripts.
  101. Possible error messages:
  102. * SSL: Connection reset by peer in some script.
  103. Error happened in IMAP server and server dropped connection. It is possible
  104. that error is logged in system or imap logs.
  105. * SSL operation failed with code 1. OpenSSL Error messages: error:14094410:SSL
  106. routines:func(148):reason(1040) in some script.
  107. Error generated by SSL library. Locate numbers listed in 'SSL
  108. routines:func(###):reason(####)' string, find ssl.h file in your OpenSSL
  109. sources and locate same numbers listed in '/* Error codes for the SSL
  110. functions. */' section. Error define can be self explanatory. If you don't
  111. understand it, search for error or that define in your favorite search
  112. engine.
  113. [End]