Mercurial > prosody-modules
annotate mod_portcheck/mod_portcheck.lua @ 5255:001c8fdc91a4
mod_http_oauth2: Add support for the "openid" scope
This "openid" scope is there to signal access to the userinfo endpoint,
which is needed for OIDC support.
We don't actually check this later because the userinfo endpoint only
returns info embedded in the token itself, but in the future we may want
to check this more carefully.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 16 Mar 2023 17:06:35 +0100 |
parents | 3abbcb8584d2 |
children |
rev | line source |
---|---|
4897
42a362a2bf51
mod_portcheck: Shell command to check if ports are open
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
1 module:set_global(); |
42a362a2bf51
mod_portcheck: Shell command to check if ports are open
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
2 local portmanager = require "core.portmanager"; |
42a362a2bf51
mod_portcheck: Shell command to check if ports are open
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
3 |
42a362a2bf51
mod_portcheck: Shell command to check if ports are open
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
4 local commands = module:shared("admin_shell/commands") |
42a362a2bf51
mod_portcheck: Shell command to check if ports are open
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
5 |
42a362a2bf51
mod_portcheck: Shell command to check if ports are open
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
6 function commands.portcheck(session, line) |
4899
adecfb36349e
mod_portcheck: Include '*' in allowed characters so '*:port' works
Kim Alvefur <zash@zash.se>
parents:
4897
diff
changeset
|
7 for desc, interface, port in line:gmatch("%s(%[?([%x:.*]+)%]?:(%d+))") do |
4897
42a362a2bf51
mod_portcheck: Shell command to check if ports are open
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
8 assert(portmanager.get_service_at(interface, tonumber(port)), desc); |
42a362a2bf51
mod_portcheck: Shell command to check if ports are open
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
9 end |
42a362a2bf51
mod_portcheck: Shell command to check if ports are open
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
10 session.print "OK"; |
42a362a2bf51
mod_portcheck: Shell command to check if ports are open
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
11 end |
42a362a2bf51
mod_portcheck: Shell command to check if ports are open
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
12 |
42a362a2bf51
mod_portcheck: Shell command to check if ports are open
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
13 function module.unload() |
42a362a2bf51
mod_portcheck: Shell command to check if ports are open
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
14 commands.portcheck = nil; |
42a362a2bf51
mod_portcheck: Shell command to check if ports are open
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
15 end |