Commit graph

12604 commits

Author SHA1 Message Date
Kim Alvefur
93830ecf40 various: Update IETF RFC URLs for tools.ietf.org transition
See https://www.ietf.org/blog/finalizing-ietf-tools-transition/

Already done in various other places.
2022-08-05 16:54:15 +02:00
Kim Alvefur
0e7e43f62f mod_admin_shell: Remove obsolete module:load() argument from 0.8 time
This 'config' argument was removed without explanation in d8dbf569766c
2022-08-05 14:41:13 +02:00
Kim Alvefur
a2f8218a63 mod_tls: Record STARTTLS state so it can be shown in Shell
This field can be viewed using s2s:show(nil, "... starttls") even
without any special support in mod_admin_shell, which can be added later
to make it nicer. One can then assume that a TLS connection with an
empty / nil starttls field means Direct TLS.
2022-08-02 19:26:26 +02:00
Kim Alvefur
79f4868b63 net.resolvers.basic: Add opt-out argument for DNSSEC security status
This makes explicit which lookups can accept an unsigned response.

Insecure (unsigned, as before DNSSEC) A and AAAA records can be used as
security would come from TLS, but an insecure TLSA record is worthless.
2022-08-02 16:08:43 +02:00
Kim Alvefur
9a375e4444 Merge 0.12->trunk 2022-07-29 17:10:31 +02:00
Kim Alvefur
c1a166daa7 util.sasl.scram: Add 'tls-exporter' as recognised channel binding method
The last missing piece of #1760, otherwise SCRAM-SHA-*-PLUS is not
actually advertised.
2022-07-27 00:32:04 +02:00
Kim Alvefur
7c8dd7ee42 Merge 0.12->trunk 2022-07-27 00:10:08 +02:00
Kim Alvefur
96301b2229 mod_bookmarks: Reduce error about not having bookmarks to debug (thanks tom)
This is happens if the account is new and doesn't have any bookmarks
yet, which is not a problem.

Rarely seen since most clients currently use the older version of
XEP-0084 stored in XEP-0049 rather than in PEP, but at least one
(Converse.js )does.

One scenario in which this would show up often is with Converse.js as a
guest chat using anonymous authentication, where all "accounts" would
always be new and not have any bookmarks. This scenario probably does
not need to have mod_bookmarks at all, but if enabled globally it would
likely become loaded onto the VirtualHost unless explicitly disabled.
2022-07-26 23:44:33 +02:00
Kim Alvefur
9f51add3a8 mod_storage_sql: Fix bypass of load procedure under prosodyctl
There's no 'prosody.prosodyctl' property other than this one, introduced
in 6216743c188c in 2015.

Guessing that the intent was to skip this when running as a prosodyctl
command. The module.command code does its own version of this
initialization, so this seems likely.

Thanks raja for noticing
2022-07-26 00:39:16 +02:00
Kim Alvefur
2dbbce2382 mod_storage_sql: Fix summary API with Postgres (fixes #1766)
The ORDER BY and LIMIT clauses are not needed and don't even make much
sense. This part was most likely a leftover from the :find method.

Tested with sqlite and postgres 14
2022-07-22 19:09:50 +02:00
Kim Alvefur
3ee6df83b0 storage tests: Add test for the archive:summary API
Passes with memory, internal, sqlite
Fails with postgres as in #1766
2022-07-22 18:32:45 +02:00
Kim Alvefur
78e7707791 mod_http_files: Log warning about legacy modules using mod_http_files
It is time. Most community modules should have been adjusted to work
with the new (net.http.files) way.

At some point this usage should be prevented.

Related to #1765
2022-07-17 17:05:28 +02:00
Kim Alvefur
814817ebf2 core.s2smanager: Don't remove unrelated session on close of bidi session
Normally with bidi, any outgoing connection should be the same as the
incoming, hence when closing a bidi connection it should be removed as a
route to the remote server. However it is not guaranteed, a remote bidi-capable server
might have decided to open a new connection for some reason. This can
lead to a situation where there are two bidi connections, and the s2sout
route is a locally initiated s2sout connection. In this case, such a
s2sout connection should be kept.

Noticed in a rare case where bidi has just been enabled on a running
server, and something establishes new connections immediately when a
connection is closed.
2022-06-27 01:22:36 +02:00
Kim Alvefur
8db7cdc713 mod_saslauth: Implement RFC 9266 'tls-exporter' channel binding (#1760)
Brings back SCRAM-SHA-*-PLUS from its hiatus brought on by the earlier
channel binding method being undefined for TLS 1.3, and the increasing
deployment of TLS 1.3.

See 1bfd238e05ad and #1542

Requires future version of LuaSec, once support for this key material
export method is merged.

See https://github.com/brunoos/luasec/pull/187
2022-06-01 15:06:59 +02:00
Kim Alvefur
dabdfc91be util.table: Fix inaccurate comment
Probably a duplicate of the comment next to Lmove, recorded by mistake

Lpack can probably be removed at some point in the near future once we
are confident it is not used anywhere.
2022-07-11 20:02:10 +02:00
Kim Alvefur
f8e73eba98 compat: Use table.pack (there since Lua 5.2) over our util.table
Added in d278a770eddc avoid having to deal with its absence in Lua 5.1.
No longer needed when Lua 5.1 support is dropped.
2022-07-11 19:15:24 +02:00
Kim Alvefur
5251c9b686 compat: Remove handling of Lua 5.1 location of 'unpack' function 2022-07-11 19:07:38 +02:00
Kim Alvefur
d055a704d8 Merge 0.12->trunk 2022-07-11 17:32:13 +02:00
Kim Alvefur
561c588fd5 luacheck: Set expected globals to Lua 5.4 + compat
Requires luacheck 0.25.0
2022-07-10 16:10:29 +02:00
Kim Alvefur
906ff5a166 Merge 0.12->trunk 2022-07-08 19:56:29 +02:00
Kim Alvefur
1b1c4f5554 Merge 0.12->trunk 2022-07-08 19:43:47 +02:00
Kim Alvefur
7f2a660158 Backport 875f73ead4e8 8e4033213c62 to deal with luacheck 0.26 2022-07-08 19:42:48 +02:00
Kim Alvefur
82135131e7 Merge 0.12->trunk 2022-07-08 19:36:07 +02:00
Kim Alvefur
89359b70dc util.datamapper: Improve handling of schemas with non-obvious "type"
The JSON Schema specification says that schemas are objects or booleans,
and that the 'type' property is optional and can be an array.

This module previously allowed bare type names as schemas and did not
really handle booleans.

It now handles missing 'type' properties and boolean 'true' as a schema.
Objects and arrays are guessed based on the presence of 'properties' or
'items' field.
2022-07-08 17:32:48 +02:00
Kim Alvefur
e700edc50f util.jsonschema: Fix validation to not assume presence of "type" field
MattJ reported a curious issue where validation did not work as
expected. Primarily that the "type" field was expected to be mandatory,
and thus leaving it out would result in no checks being performed.
This was likely caused by misreading during initial development.

Spent some time testing against
https://github.com/json-schema-org/JSON-Schema-Test-Suite.git and
discovered a multitude of issues, far too many to bother splitting into
separate commits.

More than half of them fail. Many because of features not implemented,
which have been marked NYI. For example, some require deep comparisons
e.g. when objects or arrays are present in enums fields.

Some because of quirks with how Lua differs from JavaScript, e.g. no
distinct array or object types. Tests involving fractional floating
point numbers. We're definitely not going to follow references to remote
resources. Or deal with UTF-16 sillyness. One test asserted that 1.0 is
an integer, where Lua 5.3+ will disagree.
2022-07-08 14:38:23 +02:00
Kim Alvefur
8ee6441fc5 executables: Reject Lua 5.1 early
Prevents attempting to load libraries that may no longer be found and
crashing with a traceback.

Platforms like Debian where multiple Lua versions can be installed at
the same time and 'lua' pointing to one of the installed interpreters
via symlinks, there's the possibility that prosody/prosodyctl may be
invoked with Lua 5.1, which will no longer have any of the rest of
Prosody libraries available to be require(), and thus would immediately
fail with an unfriendly traceback.

Checking and aborting early with a friendlier message and reference to
more information is better.

Part of #1600
2022-07-02 17:27:39 +02:00
Kim Alvefur
c8a49ad144 CHANGES: Lua 5.1 support removed (closes #1600) 2022-07-05 14:59:47 +02:00
Kim Alvefur
bcc6efb2aa util.envload: Remove Lua 5.1 method
Part of #1600

Is this module even needed anymore?
2022-07-05 14:18:32 +02:00
Kim Alvefur
dff4beae02 util-src: Remove Lua 5.1 compat macros
Part of #1600
2022-07-01 21:21:21 +02:00
Kim Alvefur
2ec8fbe7e5 mod_storage_sql: Remove Lua 5.1 compatibility hack
Part of #1600
2022-07-02 17:30:06 +02:00
Kim Alvefur
49a9a1e76a util: Remove various Lua 5.1 compatibility hacks
Part of #1600
2022-07-02 17:31:14 +02:00
Kim Alvefur
ada68efcc9 util.dependencies: Reject Lua 5.1, Lua 5.2 or later is now required (see #1600) 2022-07-02 17:30:34 +02:00
Kim Alvefur
14fceee089 tests: Remove special-casing of Lua 5.1
Part of #1600
2022-07-02 17:29:03 +02:00
Kim Alvefur
084b949eca configure: No longer accept Lua 5.1 2022-06-30 17:00:35 +02:00
Kim Alvefur
5393bff075 util.dependencies: Deprecate support for Lua 5.1, this is your final warning 2022-06-30 17:03:50 +02:00
Kim Alvefur
b1c7b93139 util.hashes: Revert to HMAC() convenience function
Reverts some of 1e41dd0f8353

Seems HMAC() isn't deprecated after all? Must have been at some point
according to #1589

Twice as fast for some reason.
2022-06-24 16:59:54 +02:00
Kim Alvefur
8f3d837cd2 util.hashes: Remove unused constants 2022-06-24 16:49:03 +02:00
Kim Alvefur
452f9e4e2b util.hashes: Remove unused struct
Unused since 9f1c5ae8d70b
2022-06-24 16:12:11 +02:00
Kim Alvefur
9a96021706 util.hashes: Return OpenSSL error messages on failure
With luck, might contain more details than just "failed"
2022-06-24 15:33:04 +02:00
Kim Alvefur
4f3ba05b4d net.unbound: Merge luaunbound and prosody defaults in absence of user config (fixes #1763) (thanks rgd)
add_defaults() is supposed to merge 3 tables, the defaults in
luaunbound, the defaults from prosody and any config from the prosody
config file.  In the case where no `unbound={}` has been in the config,
it skips over the merge and returns only the prosody built-in defaults.

This results in libunbound skipping reading resolv.conf and uses its
default behavior of full recursive resolution.

Prior to #1737 there were only two tables, the luaunbound defaults and
the prosody config, where bypassing the merge and returning the former
did the right thing.
2022-06-19 19:49:32 +02:00
Kim Alvefur
d5e749bc8a util.startup: Fix async waiting for last shutdown steps
Observed problem: When shutting down prosody would immediately exit
after waiting for s2s connections to close, skipping the last cleanup
events and reporting the exit reason and code.

This happens because prosody.main_thread is in a waiting state and
queuing startup.shutdown is dispatched trough the main loop via
nexttick, but since the main loop was no longer running at that point it
proceeded to the end of the prosody script and exited there.
2022-06-14 16:28:49 +02:00
Kim Alvefur
bfe2a924f8 mod_smacks: Fix #1761 by setting a flag earlier
This ensures that the flag is set even if the pre-drain callback is
called from send(), as would be the case if opportunistic writes are
enabled.
2022-06-12 01:50:33 +02:00
Matthew Wild
92874f8eb0 Added tag 0.12.1 for changeset 252ed01896dd 2022-06-09 12:42:57 +01:00
Kim Alvefur
1261dfba9f luacheck: Shut up (backports 3caff1f93520, ignores module deleted in trunk) 2022-05-30 17:34:58 +02:00
Kim Alvefur
d7e7558bae mod_smacks: Bounce unhandled stanzas from local origin (fix #1759)
Sending stanzas with a remote session as origin when the stanzas have a
local JID in the from attribute trips validation in core.stanza_router,
leading to warnings:
> Received a stanza claiming to be from remote.example, over a stream authed for localhost.example

Using module:send() uses the local host as origin, which is fine here.
2022-05-27 14:45:35 +02:00
Kim Alvefur
568aa79441 mod_smacks: Fix bounce of stanzas directed to full JID on unclean disconnect
Fixes #1758

Introduced in 1ea01660c79a

In e62025f949f9 to and from was inverted since it changed from acting on
a reply to acting on the original stanza (or a clone thereof)

Unsure of the purpose of this check, you don't usually send stanzas to
your own full JID. Perhaps guarding against routing loops?

The check was present in the original commit of mod_smacks,
prosody-modules rev 9a7671720dec
2022-05-27 12:05:47 +02:00
Kim Alvefur
8027b67f19 mod_smacks: Fix to use current method of counting acked stanzas
Fixes #1757

These places seem to have been left since e62025f949f9

The logic around expected_h in should_ack() misbehaved, always comparing
with 0 + unacked instead of acked + unacked.
2022-05-26 17:38:55 +02:00
Kim Alvefur
d545540ae0 util.prosodyctl.check: Remove now redundant unbound config tweak
This is now done in net.unbound itself

Turning it back on in the config may still cause the problem of entries
there masking the DNS values.
2022-05-26 13:03:58 +02:00
Kim Alvefur
24288146ae net.unbound: Adjust log level of error to error to error
This error is an error, therefore it should be at the error level
2022-05-16 14:51:01 +02:00
Kim Alvefur
5e95ed633a net.unbound: Disable use of hosts file by default (fixes #1737)
This mirrors the behaviour with net.dns and avoids the initialization
issue in #1737
2022-05-16 12:45:51 +02:00