Commit graph

13803 commits

Author SHA1 Message Date
Kim Alvefur
c900aab69e mod_pubsub: Limit node listing based on new ACL-aware metadata method
Ensures that nodes that one does not have metadata access to are hidden
from view.

This follows from the new ACL-aware method added in 3b357ab6b6eb.
2025-01-07 22:57:39 +01:00
Matthew Wild
fbb3a116db prosodyctl: deluser: Use user:delete() shell command for implementation 2025-01-07 19:28:06 +00:00
Matthew Wild
8e73190353 prosodyctl: passwd: Use user:password() shell command for implementation 2025-01-07 19:25:35 +00:00
Matthew Wild
6ff135c812 mod_admin_shell: user:password(): Support prompting for password if none given 2025-01-07 19:25:12 +00:00
Matthew Wild
54de66e7b0 mod_admin_shell: user:create(): Reject promise with error message on failure 2025-01-07 19:24:05 +00:00
Matthew Wild
f40e997879 mod_admin_shell: Mark event as handled when requested input is submitted 2025-01-07 19:23:23 +00:00
Matthew Wild
a1fda1fd1a prosodyctl: adduser: use shell user:create() to provide the implementation
This allows user creation to happen inside the running Prosody process, which
improves a number of things - such as executing event handlers for user
creation, fixing issues and race conditions with some storage drivers, etc.

The intent is to do the same for the other prosodyctl commands, but this is
the first proof of concept for the approach.
2025-01-07 18:47:24 +00:00
Matthew Wild
54718fffe0 mod_admin_shell: user:create(): request password via prompt if none given 2025-01-07 18:17:57 +00:00
Matthew Wild
7a9bc06049 mod_admin_shell: Add session method to request (password) input from shell client 2025-01-07 18:17:30 +00:00
Matthew Wild
72b6c110f0 mod_admin_socket: Fire event on admin client disconnect 2025-01-07 18:16:23 +00:00
Matthew Wild
957c69461f mod_admin_shell: Don't pause async thread while waiting for promise result
This allows us to continue sending/receiving on the session, for example if
the promise will be resolved by other data that the client is going to send.

Specifically, this allows the repl-request-input to work without a deadlock.

It does open the door to interleaved commands/results, which may not be a good
thing overall, but can be restricted separately if necessary (e.g. a flag on
the session).
2025-01-07 18:15:50 +00:00
Matthew Wild
91776f57ef util.prosodyctl.shell: Support for requesting special inputs, e.g. passwords
This lets the server signal to the client that a special input is requested.
Currently we support the "password" type only.
2025-01-07 18:10:59 +00:00
Matthew Wild
7a281ab905 util.adminstream: Expose session events (specifically "disconnected")
Currently there is no way to get this info and perform cleanup tasks.
2025-01-07 18:07:45 +00:00
Matthew Wild
d58c6ae7ca mod_cron: Don't run tasks if loaded inside prosodyctl
It's common for modules to depend on mod_cron, and this can lead to it loading
inside prosodyctl, where we don't really want to run any cron tasks.
2025-01-07 18:06:29 +00:00
Matthew Wild
c7005840e6 mod_authz_internal: Make 'prosody:guest' default role for all unknown JIDs
This fixes an issue where e.g. remote users or even other users on the server
were unable to list MUC rooms.

We want to define a permission to list MUC rooms, but we want it to be
available to everyone by default (the traditional behaviour).

prosody:guest is the lowest role we have. I ran a quick check and it isn't
really used for anything right now that would be concerning.

It was originally designed for anonymous logins. I think it's safe to treat
remote JIDs as equivalent, since we have no trust relationship with anonymous
users either.
2025-01-07 14:41:32 +00:00
Matthew Wild
25b7ac8ece mod_pep: Support for node/item management commands 2025-01-07 14:27:34 +00:00
Matthew Wild
a10a0140e5 mod_pubsub: Expand shell commands to include node/item management 2025-01-07 14:27:18 +00:00
Matthew Wild
0d15dab13f mod_roster: Add basic roster management shell commands 2025-01-07 12:26:03 +00:00
Matthew Wild
3ebf89a8c6 mod_flags: New module to view and manage flags on user accounts via shell/API
This will be useful for server operators to easily identify flagged accounts,
etc.
2025-01-03 11:45:48 +00:00
Matthew Wild
6e987bd13f Added tag 0.12.5 for changeset 836efad8483c 2024-12-29 12:13:29 +00:00
Matthew Wild
f45d88d614 mod_admin_shell: stats:show(): Friendlier error message when statistics disabled 2024-12-28 18:35:24 +00:00
Matthew Wild
a2b2d01c3e Merge 0.12->trunk 2024-12-20 14:22:25 +00:00
Matthew Wild
bca60e609d util.prosodyctl.check: Improve error handling of UDP socket setup (for #1803)
Not necessarily a fix, but may give us more information about failure cases.
2024-12-20 14:21:02 +00:00
Kim Alvefur
a2197df832 mod_saslauth: Use fully qualified import here too
Looks like I forgot to update these when merging the channel binding
changes after the great renamening.

Ref #1223
2024-11-24 14:53:49 +01:00
Kim Alvefur
0f931dea2a MUC: Use fully qualified import
Seems to be hard to break old habits?

Ref #1223
2024-11-23 17:43:43 +01:00
Kim Alvefur
ab148f782f muc: Update link to XEP-0421 (instead of inbox) 2024-11-23 16:46:34 +01:00
Matthew Wild
9de5f1149b mod_smacks: Run session destruction code in session's async context
This is the Right Thing and should fix various potential issues and race
conditions.
2024-11-21 17:02:55 +00:00
Matthew Wild
6bbfcd801a mod_c2s, mod_s2s: Support for queuing callbacks to run in session thread
This allows certain session-specific code that needs to run in the async
context, but is itself triggered outside of that context (e.g. timers), to
be queued.

An example of this is the session destruction code of mod_smacks, when the
hibernation timeout is reached.
2024-11-21 17:02:07 +00:00
Matthew Wild
a3b71e8fc9 util.pposix: Add fdopen() to return a Lua file object from an fd
Now we can, for example, read/write pipes using Lua's standard I/O routines.
2024-11-20 12:08:59 +00:00
Kim Alvefur
19429a5e7d mod_smacks: Fix previous commit for case of no session found 2024-11-19 00:57:24 +01:00
Kim Alvefur
fff5a91e37 mod_smacks: Prevent traceback on attempting to resume destroyed session
This shouldn't be possible, but seems to happen anyway after net.server
somehow calling the close handler twice, which also should not happen.
2024-11-19 00:53:01 +01:00
Kim Alvefur
61b0c0cd3a net.server_epoll: Don't try to flush buffer on closed connections
Attempt to fix a bug where connections are somehow closed twice, leading
to bad things happening elsewhere.

With LuaSec, closed connections are generally already too closed to
write anything to anyway since it does not support unidirectional
shutdown.
2024-11-19 00:41:02 +01:00
Kim Alvefur
ff00c6707f net.server_epoll: Revert opportunistic_writes tweak
Added in f0b2c026e542 and not sure why
2024-11-19 00:31:21 +01:00
Kim Alvefur
885fde62be util.stanza: Handle Clark notation for attributes in :find() 2024-11-17 13:40:20 +01:00
Kim Alvefur
00584c4d61 util.stanza: Handle namespace prefixes for attributes in :find()
More correct handling of namespaces here.

This works with both prefixes from the parser and hacky .attr["foo:bar"]
2024-11-17 12:35:51 +01:00
Jonas Schäfer
b9f73bc724 util.datamanager: fix duplicated word in log message 2024-11-16 09:20:29 +01:00
Jonas Schäfer
9f53fd30a9 mod_roster: do not store number in attribute
Attributes are strings. That definitely is a number. So we
tostring() it. This is important when the API becomes stricter,
for whatever reason that might happen.

Practically, this moves the overhead of converting to a string
to a place where it is visible.
2024-11-16 09:12:11 +01:00
Kim Alvefur
4bf9c26a26 core.loggingmanager: Bump expected util.pposix version
Otherwise no syslog or console detection
2024-11-16 14:35:36 +01:00
Kim Alvefur
35e92231f8 util.startup: Bump expected util.pposix version
Otherwise Prosody refuses to start.
2024-11-16 14:35:11 +01:00
Matthew Wild
6480651a93 util.pposix: Add pipe() (with support for pipe2() flags on Linux) 2024-11-16 12:26:55 +00:00
Kim Alvefur
7b8f6e3c3e mod_admin_shell: Report when a module is already loaded
Hopefully less confusing than "Module loaded onto 0 hosts"
2024-11-15 15:52:37 +01:00
Kim Alvefur
53edd95324 mod_admin_shell: Refactor end of module:load
Meant to improve clarity and make improving easier
2024-11-15 15:48:07 +01:00
Matthew Wild
d89b7fa672 Merge 0.12->trunk 2024-11-15 14:37:10 +00:00
Matthew Wild
48b271450d MUC: optimizations for broadcast of visitor presence (thanks Jitsi team)
This avoids doing performing unnecessary work in the case of visitors joining
a MUC, no functionality changes are intended.
2024-11-15 14:36:41 +00:00
Matthew Wild
c9cc6f4b67 util.queue: tests: Add test for :replace() method 2024-11-12 11:25:49 +00:00
Kim Alvefur
cc34f41086 mod_s2s: Really fix logging of outgoing stanza queue counts
Some confusion happened in 42b98ee73ca8, possibly because .count()
returns the items?
2024-11-11 08:49:57 +01:00
Kim Alvefur
e097713883 mod_s2s: Clone queued outgoing stanzas to prevent changes
This clone call was lost in 902d25cd0557

Affects e.g. presence broadcasts, where the same stanza is sent many
times while mutating the 'to' attribute.
2024-11-10 15:10:26 +01:00
Kim Alvefur
b126efdd1c mod_s2s: Fix counting items in outgoing stanza queue (in logs) 2024-11-10 15:06:00 +01:00
Kim Alvefur
1b68565d70 mod_s2s: Limit size of outgoing stanza queue
This queue is used to buffer stanzas while waiting for an outgoing s2s
connection to be established.

Limit it to prevent excessive memory usage.

Default chosen to approximate how many average stanzas fits in the
server_epoll default max_send_buffer_size of 32 MiB

Returns a custom error instead of the default core.stanza_router
"Communication with remote domains is not enabled" from is sent back,
which does not describe what is happening here.

Closes #1106
2024-11-09 16:47:14 +01:00
Kim Alvefur
52178d7430 net.server_epoll: Make running out of buffer space a fatal error
Prevent Bad Things from happening when the buffer gets full.
This of course opens up the possibility of intentionally killing
connections by sending much stuff, which need to be mitigated with rate
limits elsewhere.
2024-11-09 15:42:31 +01:00