Mercurial > prosody-modules
annotate mod_secure_interfaces/mod_secure_interfaces.lua @ 2394:4c27ebcf4cbd
mod_smacks: added new event "smacks-ack-delayed" used by mod_cloud_notify and extended the readme file accordingly (also mention mod_smacks_offline and mod_smacks_noerror in readme file)
author | tmolitor <thilo@eightysoft.de> |
---|---|
date | Thu, 24 Nov 2016 00:47:32 +0100 |
parents | a464261deba8 |
children | 55f3ab952d06 |
rev | line source |
---|---|
1177
a464261deba8
mod_secure_interfaces: New module to mark c2s sessions on given interfaces as 'secure' without encryption
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1 local secure_interfaces = module:get_option_set("secure_interfaces", { "127.0.0.1" }); |
a464261deba8
mod_secure_interfaces: New module to mark c2s sessions on given interfaces as 'secure' without encryption
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2 |
a464261deba8
mod_secure_interfaces: New module to mark c2s sessions on given interfaces as 'secure' without encryption
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3 module:hook("stream-features", function (event) |
a464261deba8
mod_secure_interfaces: New module to mark c2s sessions on given interfaces as 'secure' without encryption
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
4 local session = event.origin; |
a464261deba8
mod_secure_interfaces: New module to mark c2s sessions on given interfaces as 'secure' without encryption
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
5 if session.type ~= "c2s_unauthed" then return; end |
a464261deba8
mod_secure_interfaces: New module to mark c2s sessions on given interfaces as 'secure' without encryption
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
6 local socket = session.conn:socket(); |
a464261deba8
mod_secure_interfaces: New module to mark c2s sessions on given interfaces as 'secure' without encryption
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
7 if not socket.getsockname then return; end |
a464261deba8
mod_secure_interfaces: New module to mark c2s sessions on given interfaces as 'secure' without encryption
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
8 local localip = socket:getsockname(); |
a464261deba8
mod_secure_interfaces: New module to mark c2s sessions on given interfaces as 'secure' without encryption
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
9 if secure_interfaces:contains(localip) then |
a464261deba8
mod_secure_interfaces: New module to mark c2s sessions on given interfaces as 'secure' without encryption
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
10 module:log("debug", "Marking session from %s as secure", session.ip or "[?]"); |
a464261deba8
mod_secure_interfaces: New module to mark c2s sessions on given interfaces as 'secure' without encryption
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
11 session.secure = true; |
a464261deba8
mod_secure_interfaces: New module to mark c2s sessions on given interfaces as 'secure' without encryption
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
12 end |
a464261deba8
mod_secure_interfaces: New module to mark c2s sessions on given interfaces as 'secure' without encryption
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
13 end, 2500); |