Software /
code /
prosody-modules
Annotate
mod_tlsfail/mod_tlsfail.lua @ 4434:f10ab82be166
mod_tlsfail: Test how servers react to starttls failure
Lines copypasted from mod_tls
Intended for use in the badxmpp.eu test suite
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 10 Feb 2021 16:02:28 +0100 |
child | 4702:7009e16192fa |
rev | line source |
---|---|
4434
f10ab82be166
mod_tlsfail: Test how servers react to starttls failure
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
1 local st = require "util.stanza"; |
f10ab82be166
mod_tlsfail: Test how servers react to starttls failure
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
2 |
f10ab82be166
mod_tlsfail: Test how servers react to starttls failure
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
3 local xmlns_starttls = 'urn:ietf:params:xml:ns:xmpp-tls'; |
f10ab82be166
mod_tlsfail: Test how servers react to starttls failure
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
4 local starttls_attr = { xmlns = xmlns_starttls }; |
f10ab82be166
mod_tlsfail: Test how servers react to starttls failure
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
5 local s2s_feature = st.stanza("starttls", starttls_attr); |
f10ab82be166
mod_tlsfail: Test how servers react to starttls failure
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
6 local starttls_failure = st.stanza("failure", starttls_attr); |
f10ab82be166
mod_tlsfail: Test how servers react to starttls failure
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
7 |
f10ab82be166
mod_tlsfail: Test how servers react to starttls failure
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
8 module:hook("s2s-stream-features", function(event) |
f10ab82be166
mod_tlsfail: Test how servers react to starttls failure
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
9 local features = event.features; |
f10ab82be166
mod_tlsfail: Test how servers react to starttls failure
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
10 features:add_child(s2s_feature); |
f10ab82be166
mod_tlsfail: Test how servers react to starttls failure
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
11 end); |
f10ab82be166
mod_tlsfail: Test how servers react to starttls failure
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
12 |
f10ab82be166
mod_tlsfail: Test how servers react to starttls failure
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
13 -- Hook <starttls/> |
f10ab82be166
mod_tlsfail: Test how servers react to starttls failure
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
14 module:hook("stanza/urn:ietf:params:xml:ns:xmpp-tls:starttls", function(event) |
f10ab82be166
mod_tlsfail: Test how servers react to starttls failure
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
15 local origin = event.origin; |
f10ab82be166
mod_tlsfail: Test how servers react to starttls failure
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
16 origin.sends2s(starttls_failure); |
f10ab82be166
mod_tlsfail: Test how servers react to starttls failure
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
17 origin:close(); |
f10ab82be166
mod_tlsfail: Test how servers react to starttls failure
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
18 return true; |
f10ab82be166
mod_tlsfail: Test how servers react to starttls failure
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
19 end); |