10 |
10 |
11 local xmlns_stream = 'http://etherx.jabber.org/streams'; |
11 local xmlns_stream = 'http://etherx.jabber.org/streams'; |
12 local xmlns_starttls = 'urn:ietf:params:xml:ns:xmpp-tls'; |
12 local xmlns_starttls = 'urn:ietf:params:xml:ns:xmpp-tls'; |
13 |
13 |
14 local secure_auth_only = module:get_option("c2s_require_encryption") or module:get_option("require_encryption"); |
14 local secure_auth_only = module:get_option("c2s_require_encryption") or module:get_option("require_encryption"); |
15 local secure_s2s_only = module:get_option("require_s2s_encryption"); |
15 local secure_s2s_only = module:get_option("s2s_require_encryption"); |
16 |
16 |
17 module:add_handler("c2s_unauthed", "starttls", xmlns_starttls, |
17 module:add_handler("c2s_unauthed", "starttls", xmlns_starttls, |
18 function (session, stanza) |
18 function (session, stanza) |
19 if session.conn.starttls then |
19 if session.conn.starttls then |
20 session.send(st.stanza("proceed", { xmlns = xmlns_starttls })); |
20 session.send(st.stanza("proceed", { xmlns = xmlns_starttls })); |