Annotate

core/features.lua @ 13801:a5d5fefb8b68 13.0

mod_tls: Enable Prosody's certificate checking for incoming s2s connections (fixes #1916) (thanks Damian, Zash) Various options in Prosody allow control over the behaviour of the certificate verification process For example, some deployments choose to allow falling back to traditional "dialback" authentication (XEP-0220), while others verify via DANE, hard-coded fingerprints, or other custom plugins. Implementing this flexibility requires us to override OpenSSL's default certificate verification, to allow Prosody to verify the certificate itself, apply custom policies and make decisions based on the outcome. To enable our custom logic, we have to suppress OpenSSL's default behaviour of aborting the connection with a TLS alert message. With LuaSec, this can be achieved by using the verifyext "lsec_continue" flag. We also need to use the lsec_ignore_purpose flag, because XMPP s2s uses server certificates as "client" certificates (for mutual TLS verification in outgoing s2s connections). Commit 99d2100d2918 moved these settings out of the defaults and into mod_s2s, because we only really need these changes for s2s, and they should be opt-in, rather than automatically applied to all TLS services we offer. That commit was incomplete, because it only added the flags for incoming direct TLS connections. StartTLS connections are handled by mod_tls, which was not applying the lsec_* flags. It previously worked because they were already in the defaults. This resulted in incoming s2s connections with "invalid" certificates being aborted early by OpenSSL, even if settings such as `s2s_secure_auth = false` or DANE were present in the config. Outgoing s2s connections inherit verify "none" from the defaults, which means OpenSSL will receive the cert but will not terminate the connection when it is deemed invalid. This means we don't need lsec_continue there, and we also don't need lsec_ignore_purpose (because the remote peer is a "server"). Wondering why we can't just use verify "none" for incoming s2s? It's because in that mode, OpenSSL won't request a certificate from the peer for incoming connections. Setting verify "peer" is how you ask OpenSSL to request a certificate from the client, but also what triggers its built-in verification.
author Matthew Wild <mwild1@gmail.com>
date Tue, 01 Apr 2025 17:26:56 +0100
parent 13718:569fae28a2f3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12972
ead41e25ebc0 core: Prefix module imports with prosody namespace
Kim Alvefur <zash@zash.se>
parents: 12957
diff changeset
1 local set = require "prosody.util.set";
12252
4bfe658415a0 core.features: New module to track and expose the features supported by Prosody
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
2
4bfe658415a0 core.features: New module to track and expose the features supported by Prosody
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
3 return {
4bfe658415a0 core.features: New module to track and expose the features supported by Prosody
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
4 available = set.new{
4bfe658415a0 core.features: New module to track and expose the features supported by Prosody
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
5 -- mod_bookmarks bundled
4bfe658415a0 core.features: New module to track and expose the features supported by Prosody
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
6 "mod_bookmarks";
13438
0a0dd2505baa features: Add mod_server_info
Matthew Wild <mwild1@gmail.com>
parents: 13425
diff changeset
7 -- mod_server_info bundled
0a0dd2505baa features: Add mod_server_info
Matthew Wild <mwild1@gmail.com>
parents: 13425
diff changeset
8 "mod_server_info";
13583
e77ef9a4604f mod_flags: New module to view and manage flags on user accounts via shell/API
Matthew Wild <mwild1@gmail.com>
parents: 13455
diff changeset
9 -- mod_flags bundled
e77ef9a4604f mod_flags: New module to view and manage flags on user accounts via shell/API
Matthew Wild <mwild1@gmail.com>
parents: 13455
diff changeset
10 "mod_flags";
13622
4e908958660e features: Add feature for bundled mod_cloud_notify
Matthew Wild <mwild1@gmail.com>
parents: 13583
diff changeset
11 -- mod_cloud_notify bundled
4e908958660e features: Add feature for bundled mod_cloud_notify
Matthew Wild <mwild1@gmail.com>
parents: 13583
diff changeset
12 "mod_cloud_notify";
13657
404d3644ac4a mod_muc: Integrate support for vcards/avatars on MUC rooms
Matthew Wild <mwild1@gmail.com>
parents: 13622
diff changeset
13 -- mod_muc has built-in vcard support
404d3644ac4a mod_muc: Integrate support for vcards/avatars on MUC rooms
Matthew Wild <mwild1@gmail.com>
parents: 13622
diff changeset
14 "muc_vcard";
13718
569fae28a2f3 mod_http_altconnect: Imported from prosody-modules 6d5a19bdd718 w/changes
Matthew Wild <mwild1@gmail.com>
parents: 13657
diff changeset
15 -- mod_http_altconnect bundled
569fae28a2f3 mod_http_altconnect: Imported from prosody-modules 6d5a19bdd718 w/changes
Matthew Wild <mwild1@gmail.com>
parents: 13657
diff changeset
16 "http_altconnect";
12655
a5a0783e9241 features: Add "permissions" feature for role-auth
Matthew Wild <mwild1@gmail.com>
parents: 12252
diff changeset
17 -- Roles, module.may and per-session authz
a5a0783e9241 features: Add "permissions" feature for role-auth
Matthew Wild <mwild1@gmail.com>
parents: 12252
diff changeset
18 "permissions";
12955
d32926897ca4 core.features: Add feature for prosody.loader
Kim Alvefur <zash@zash.se>
parents: 12655
diff changeset
19 -- prosody.* namespace
d32926897ca4 core.features: Add feature for prosody.loader
Kim Alvefur <zash@zash.se>
parents: 12655
diff changeset
20 "loader";
12957
e625ad5a9889 features: Add "keyval+"
Matthew Wild <mwild1@gmail.com>
parents: 12955
diff changeset
21 -- "keyval+" store
e625ad5a9889 features: Add "keyval+"
Matthew Wild <mwild1@gmail.com>
parents: 12955
diff changeset
22 "keyval+";
13110
d5f322dd424b mod_s2s: Add event where resolver for s2sout can be tweaked
Kim Alvefur <zash@zash.se>
parents: 12252
diff changeset
23
d5f322dd424b mod_s2s: Add event where resolver for s2sout can be tweaked
Kim Alvefur <zash@zash.se>
parents: 12252
diff changeset
24 "s2sout-pre-connect-event";
13170
082c7d856e61 core, plugins: Split prosody:user role into prosody:{guest,registered,member}
Matthew Wild <mwild1@gmail.com>
parents: 13111
diff changeset
25
082c7d856e61 core, plugins: Split prosody:user role into prosody:{guest,registered,member}
Matthew Wild <mwild1@gmail.com>
parents: 13111
diff changeset
26 -- prosody:guest, prosody:registered, prosody:member
082c7d856e61 core, plugins: Split prosody:user role into prosody:{guest,registered,member}
Matthew Wild <mwild1@gmail.com>
parents: 13111
diff changeset
27 "split-user-roles";
13201
65fb0d7a2312 moduleapi: Add enum config option method
Kim Alvefur <zash@zash.se>
parents: 13170
diff changeset
28
65fb0d7a2312 moduleapi: Add enum config option method
Kim Alvefur <zash@zash.se>
parents: 13170
diff changeset
29 -- new moduleapi methods
65fb0d7a2312 moduleapi: Add enum config option method
Kim Alvefur <zash@zash.se>
parents: 13170
diff changeset
30 "getopt-enum";
13203
aa6c2692a4be core.moduleapi: Allow specifying an acceptable range for number options
Kim Alvefur <zash@zash.se>
parents: 13201
diff changeset
31 "getopt-interval";
13204
c9ef35fab0b1 core.moduleapi: Add :get_option_period for parsing time intervals
Kim Alvefur <zash@zash.se>
parents: 13203
diff changeset
32 "getopt-period";
13211
4d4f9e42bcf8 moduleapi: Add :get_option_integer()
Kim Alvefur <zash@zash.se>
parents: 13204
diff changeset
33 "getopt-integer";
13425
3cebb30e7503 features: Add module-ready (for commit e20949a10118)
Matthew Wild <mwild1@gmail.com>
parents: 13211
diff changeset
34
3cebb30e7503 features: Add module-ready (for commit e20949a10118)
Matthew Wild <mwild1@gmail.com>
parents: 13211
diff changeset
35 -- new module.ready()
3cebb30e7503 features: Add module-ready (for commit e20949a10118)
Matthew Wild <mwild1@gmail.com>
parents: 13211
diff changeset
36 "module-ready";
13455
2a001cd7f99a core.features: Advertise that events are fired for SIGUSR1/2
Kim Alvefur <zash@zash.se>
parents: 13438
diff changeset
37
2a001cd7f99a core.features: Advertise that events are fired for SIGUSR1/2
Kim Alvefur <zash@zash.se>
parents: 13438
diff changeset
38 -- SIGUSR1 and 2 events
2a001cd7f99a core.features: Advertise that events are fired for SIGUSR1/2
Kim Alvefur <zash@zash.se>
parents: 13438
diff changeset
39 "signal-events";
12252
4bfe658415a0 core.features: New module to track and expose the features supported by Prosody
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
40 };
4bfe658415a0 core.features: New module to track and expose the features supported by Prosody
Matthew Wild <mwild1@gmail.com>
parents:
diff changeset
41 };