30_exim4-config_examples 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. ### auth/30_exim4-config_examples
  2. #################################
  3. # The examples below are for server side authentication, when the
  4. # local exim is SMTP server and clients authenticate to the local exim.
  5. # They allow two styles of plain-text authentication against an
  6. # CONFDIR/passwd file whose syntax is described in exim4_passwd(5).
  7. # Hosts that are allowed to use AUTH are defined by the
  8. # auth_advertise_hosts option in the main configuration. The default is
  9. # "*", which allows authentication to all hosts over all kinds of
  10. # connections if there is at least one authenticator defined here.
  11. # Authenticators which rely on unencrypted clear text passwords don't
  12. # advertise on unencrypted connections by default. Thus, it might be
  13. # wise to set up TLS to allow encrypted connections. If TLS cannot be
  14. # used for some reason, you can set AUTH_SERVER_ALLOW_NOTLS_PASSWORDS to
  15. # advertise unencrypted clear text password based authenticators on all
  16. # connections. As this is severely reducing security, using TLS is
  17. # preferred over allowing clear text password based authenticators on
  18. # unencrypted connections.
  19. # PLAIN authentication has no server prompts. The client sends its
  20. # credentials in one lump, containing an authorization ID (which we do not
  21. # use), an authentication ID, and a password. The latter two appear as
  22. # $auth2 and $auth3 in the configuration and should be checked against a
  23. # valid username and password. In a real configuration you would typically
  24. # use $auth2 as a lookup key, and compare $auth3 against the result of the
  25. # lookup, perhaps using the crypteq{}{} condition.
  26. # plain_server:
  27. # driver = plaintext
  28. # public_name = PLAIN
  29. # server_condition = "${if crypteq{$auth3}{${extract{1}{:}{${lookup{$auth2}lsearch{CONFDIR/passwd}{$value}{*:*}}}}}{1}{0}}"
  30. # server_set_id = $auth2
  31. # server_prompts = :
  32. # .ifndef AUTH_SERVER_ALLOW_NOTLS_PASSWORDS
  33. # server_advertise_condition = ${if eq{$tls_in_cipher}{}{}{*}}
  34. # .endif
  35. # LOGIN authentication has traditional prompts and responses. There is no
  36. # authorization ID in this mechanism, so unlike PLAIN the username and
  37. # password are $auth1 and $auth2. Apart from that you can use the same
  38. # server_condition setting for both authenticators.
  39. # login_server:
  40. # driver = plaintext
  41. # public_name = LOGIN
  42. # server_prompts = "Username:: : Password::"
  43. # server_condition = "${if crypteq{$auth2}{${extract{1}{:}{${lookup{$auth1}lsearch{CONFDIR/passwd}{$value}{*:*}}}}}{1}{0}}"
  44. # server_set_id = $auth1
  45. # .ifndef AUTH_SERVER_ALLOW_NOTLS_PASSWORDS
  46. # server_advertise_condition = ${if eq{$tls_in_cipher}{}{}{*}}
  47. # .endif
  48. #
  49. # cram_md5_server:
  50. # driver = cram_md5
  51. # public_name = CRAM-MD5
  52. # server_secret = ${extract{2}{:}{${lookup{$auth1}lsearch{CONFDIR/passwd}{$value}fail}}}
  53. # server_set_id = $auth1
  54. # Here is an example of CRAM-MD5 authentication against PostgreSQL:
  55. #
  56. # psqldb_auth_server:
  57. # driver = cram_md5
  58. # public_name = CRAM-MD5
  59. # server_secret = ${lookup pgsql{SELECT pw FROM users WHERE username = '${quote_pgsql:$auth1}'}{$value}fail}
  60. # server_set_id = $auth1
  61. # Authenticate against local passwords using sasl2-bin
  62. # Requires exim_uid to be a member of sasl group, see README.Debian.gz
  63. # plain_saslauthd_server:
  64. # driver = plaintext
  65. # public_name = PLAIN
  66. # server_condition = ${if saslauthd{{$auth2}{$auth3}}{1}{0}}
  67. # server_set_id = $auth2
  68. # server_prompts = :
  69. # .ifndef AUTH_SERVER_ALLOW_NOTLS_PASSWORDS
  70. # server_advertise_condition = ${if eq{$tls_in_cipher}{}{}{*}}
  71. # .endif
  72. #
  73. # login_saslauthd_server:
  74. # driver = plaintext
  75. # public_name = LOGIN
  76. # server_prompts = "Username:: : Password::"
  77. # # don't send system passwords over unencrypted connections
  78. # server_condition = ${if saslauthd{{$auth1}{$auth2}}{1}{0}}
  79. # server_set_id = $auth1
  80. # .ifndef AUTH_SERVER_ALLOW_NOTLS_PASSWORDS
  81. # server_advertise_condition = ${if eq{$tls_in_cipher}{}{}{*}}
  82. # .endif
  83. #
  84. # ntlm_sasl_server:
  85. # driver = cyrus_sasl
  86. # public_name = NTLM
  87. # server_realm = <short main hostname>
  88. # server_set_id = $auth1
  89. # .ifndef AUTH_SERVER_ALLOW_NOTLS_PASSWORDS
  90. # server_advertise_condition = ${if eq{$tls_in_cipher}{}{}{*}}
  91. # .endif
  92. #
  93. # digest_md5_sasl_server:
  94. # driver = cyrus_sasl
  95. # public_name = DIGEST-MD5
  96. # server_realm = <short main hostname>
  97. # server_set_id = $auth1
  98. # .ifndef AUTH_SERVER_ALLOW_NOTLS_PASSWORDS
  99. # server_advertise_condition = ${if eq{$tls_in_cipher}{}{}{*}}
  100. # .endif
  101. # Authentcate against cyrus-sasl
  102. # This is mainly untested, please report any problems to
  103. # pkg-exim4-users@lists.alioth.debian.org.
  104. # cram_md5_sasl_server:
  105. # driver = cyrus_sasl
  106. # public_name = CRAM-MD5
  107. # server_realm = <short main hostname>
  108. # server_set_id = $auth1
  109. #
  110. # plain_sasl_server:
  111. # driver = cyrus_sasl
  112. # public_name = PLAIN
  113. # server_realm = <short main hostname>
  114. # server_set_id = $auth1
  115. # .ifndef AUTH_SERVER_ALLOW_NOTLS_PASSWORDS
  116. # server_advertise_condition = ${if eq{$tls_in_cipher}{}{}{*}}
  117. # .endif
  118. #
  119. # login_sasl_server:
  120. # driver = cyrus_sasl
  121. # public_name = LOGIN
  122. # server_realm = <short main hostname>
  123. # server_set_id = $auth1
  124. # .ifndef AUTH_SERVER_ALLOW_NOTLS_PASSWORDS
  125. # server_advertise_condition = ${if eq{$tls_in_cipher}{}{}{*}}
  126. # .endif
  127. # Authenticate against courier authdaemon
  128. # This is now the (working!) example from
  129. # http://www.exim.org/eximwiki/FAQ/Policy_controls/Q0730
  130. # Possible pitfall: access rights on /var/run/courier/authdaemon/socket.
  131. # plain_courier_authdaemon:
  132. # driver = plaintext
  133. # public_name = PLAIN
  134. # server_condition = \
  135. # ${extract {ADDRESS} \
  136. # {${readsocket{/var/run/courier/authdaemon/socket} \
  137. # {AUTH ${strlen:exim\nlogin\n$auth2\n$auth3\n}\nexim\nlogin\n$auth2\n$auth3\n} }} \
  138. # {yes} \
  139. # fail}
  140. # server_set_id = $auth2
  141. # .ifndef AUTH_SERVER_ALLOW_NOTLS_PASSWORDS
  142. # server_advertise_condition = ${if eq{$tls_in_cipher}{}{}{*}}
  143. # .endif
  144. # login_courier_authdaemon:
  145. # driver = plaintext
  146. # public_name = LOGIN
  147. # server_prompts = Username:: : Password::
  148. # server_condition = \
  149. # ${extract {ADDRESS} \
  150. # {${readsocket{/var/run/courier/authdaemon/socket} \
  151. # {AUTH ${strlen:exim\nlogin\n$auth1\n$auth2\n}\nexim\nlogin\n$auth1\n$auth2\n} }} \
  152. # {yes} \
  153. # fail}
  154. # server_set_id = $auth1
  155. # .ifndef AUTH_SERVER_ALLOW_NOTLS_PASSWORDS
  156. # server_advertise_condition = ${if eq{$tls_in_cipher}{}{}{*}}
  157. # .endif
  158. # This one is a bad hack to support the broken version 4.xx of
  159. # Microsoft Outlook Express which violates the RFCs by demanding
  160. # "250-AUTH=" instead of "250-AUTH ".
  161. # If your list of offered authenticators is other than PLAIN and LOGIN,
  162. # you need to adapt the public_name line manually.
  163. # It has to be the last authenticator to work and has not been tested
  164. # well. Use at your own risk.
  165. # See the thread entry point from
  166. # http://www.exim.org/mail-archives/exim-users/Week-of-Mon-20050214/msg00213.html
  167. # for the related discussion on the exim-users mailing list.
  168. # Thanks to Fred Viles for this great work.
  169. # support_broken_outlook_express_4_server:
  170. # driver = plaintext
  171. # public_name = "\r\n250-AUTH=PLAIN LOGIN"
  172. # server_prompts = User Name : Password
  173. # server_condition = no
  174. # .ifndef AUTH_SERVER_ALLOW_NOTLS_PASSWORDS
  175. # server_advertise_condition = ${if eq{$tls_in_cipher}{}{}{*}}
  176. # .endif
  177. ##############
  178. # See /usr/share/doc/exim4-base/README.Debian.gz
  179. ##############
  180. # These examples below are the equivalent for client side authentication.
  181. # They get the passwords from CONFDIR/passwd.client, whose format is
  182. # defined in exim4_passwd_client(5)
  183. # Because AUTH PLAIN and AUTH LOGIN send the password in clear, we
  184. # only allow these mechanisms over encrypted connections by default.
  185. # You can set AUTH_CLIENT_ALLOW_NOTLS_PASSWORDS to allow unencrypted
  186. # clear text password authentication on all connections.
  187. cram_md5:
  188. driver = cram_md5
  189. public_name = CRAM-MD5
  190. client_name = ${extract{1}{:}{${lookup{$host}nwildlsearch{CONFDIR/passwd.client}{$value}fail}}}
  191. client_secret = ${extract{2}{:}{${lookup{$host}nwildlsearch{CONFDIR/passwd.client}{$value}fail}}}
  192. # this returns the matching line from passwd.client and doubles all ^
  193. PASSWDLINE=${sg{\
  194. ${lookup{$host}nwildlsearch{CONFDIR/passwd.client}{$value}fail}\
  195. }\
  196. {\\N[\\^]\\N}\
  197. {^^}\
  198. }
  199. plain:
  200. driver = plaintext
  201. public_name = PLAIN
  202. .ifndef AUTH_CLIENT_ALLOW_NOTLS_PASSWORDS
  203. client_send = "<; ${if !eq{$tls_out_cipher}{}\
  204. {^${extract{1}{:}{PASSWDLINE}}\
  205. ^${sg{PASSWDLINE}{\\N([^:]+:)(.*)\\N}{\\$2}}\
  206. }fail}"
  207. .else
  208. client_send = "<; ^${extract{1}{:}{PASSWDLINE}}\
  209. ^${sg{PASSWDLINE}{\\N([^:]+:)(.*)\\N}{\\$2}}"
  210. .endif
  211. login:
  212. driver = plaintext
  213. public_name = LOGIN
  214. .ifndef AUTH_CLIENT_ALLOW_NOTLS_PASSWORDS
  215. # Return empty string if not non-TLS AND looking up $host in passwd-file
  216. # yields a non-empty string; fail otherwise.
  217. client_send = "<; ${if and{\
  218. {!eq{$tls_out_cipher}{}}\
  219. {!eq{PASSWDLINE}{}}\
  220. }\
  221. {}fail}\
  222. ; ${extract{1}{::}{PASSWDLINE}}\
  223. ; ${sg{PASSWDLINE}{\\N([^:]+:)(.*)\\N}{\\$2}}"
  224. .else
  225. # Return empty string if looking up $host in passwd-file yields a
  226. # non-empty string; fail otherwise.
  227. client_send = "<; ${if !eq{PASSWDLINE}{}\
  228. {}fail}\
  229. ; ${extract{1}{::}{PASSWDLINE}}\
  230. ; ${sg{PASSWDLINE}{\\N([^:]+:)(.*)\\N}{\\$2}}"
  231. .endif