Mercurial > prosody-modules
comparison mod_auth_imap/auth_imap/mod_auth_imap.lua @ 1200:34216cdffda6
mod_auth_imap: unfortunately large commit which adds support for SSL (including cert verification), appending the realm to usernames, and various IMAP protocol fixes
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 26 Sep 2013 18:14:45 +0100 |
parents | b21bd39c8a12 |
children | 744af76b7324 |
comparison
equal
deleted
inserted
replaced
1199:5d46281a5d23 | 1200:34216cdffda6 |
---|---|
9 local imap_port = module:get_option_number("imap_auth_port"); | 9 local imap_port = module:get_option_number("imap_auth_port"); |
10 | 10 |
11 | 11 |
12 local imap_service_realm = module:get_option("imap_service_realm"); | 12 local imap_service_realm = module:get_option("imap_service_realm"); |
13 local imap_service_name = module:get_option("imap_service_name"); | 13 local imap_service_name = module:get_option("imap_service_name"); |
14 local append_host = module:get_option_boolean("auth_append_host"); | |
14 | 15 |
16 local verify_certificate = module:get_option_boolean("auth_imap_verify_certificate", true); | |
17 local ssl_params = module:get_option("auth_imap_ssl", { | |
18 mode = "client", protocol = "sslv23"; | |
19 capath = "/etc/ssl/certs"; | |
20 options = { "no_sslv2", "no_sslv3" }; | |
21 verify = verify_certificate and { "peer", "fail_if_no_peer_cert" } or nil; | |
22 ciphers = "HIGH:!DSS:!aNULL@STRENGTH"; | |
23 }); | |
15 | 24 |
16 local new_imap_sasl = module:require "sasl_imap".new; | 25 local new_imap_sasl = module:require "sasl_imap".new; |
17 | 26 |
18 local new_sasl = function(realm) | 27 local new_sasl = function(realm) |
19 return new_imap_sasl( | 28 return new_imap_sasl( |
20 imap_service_realm or realm, | 29 imap_service_realm or realm, |
21 imap_service_name or "xmpp", | 30 imap_service_name or "xmpp", |
22 imap_host, imap_port | 31 imap_host, imap_port, |
32 ssl_params, append_host | |
23 ); | 33 ); |
24 end | 34 end |
25 | 35 |
26 do | 36 do |
27 local s = new_sasl(module.host) | 37 local s = new_sasl(module.host) |