aboutsummaryrefslogtreecommitdiffstats
path: root/util
Commit message (Collapse)AuthorAgeFilesLines
* util.stanza: Handle Clark notation for attributes in :find()Kim Alvefur5 days1-0/+3
|
* util.stanza: Handle namespace prefixes for attributes in :find()Kim Alvefur5 days1-0/+4
| | | | | | More correct handling of namespaces here. This works with both prefixes from the parser and hacky .attr["foo:bar"]
* util.datamanager: fix duplicated word in log messageJonas Schäfer7 days1-1/+1
|
* util.startup: Bump expected util.pposix versionKim Alvefur6 days1-1/+1
| | | | Otherwise Prosody refuses to start.
* util.pubsub: Add method returning subset of config as metadataKim Alvefur2024-11-081-0/+19
| | | | | | Allows granting read only access to other sets of users using a separate access control capability, which makes sense as some properties may be intended to be public but read-only.
* mod_pubsub: Move precondition error wrangling out of util.pubsubKim Alvefur2024-10-291-6/+1
| | | | | | | | | Removes dependency on util.error from util.pubsub which was only used for this one special case. Line count reduction! Would be even nicer if templating could be done by util.error itself.
* util.dnsregistry: Refresh from IANAKim Alvefur2024-10-261-1/+6
| | | | For freshness. Not that it matters a lot for Prosody
* util.xtemplate: Use same argument order in filters even without 'args'Kim Alvefur2024-10-161-5/+1
| | | | | | | | | This removes the different argument order used between '{x|foo}' and '{x|foo(y)}' because the differing order was awkward and confusing. This util does not seem to be widely used so should not be problematic to change this part. The only known use is in mod_pubsub, which does not use the filter function feature.
* Merge 0.12->trunkKim Alvefur2024-08-301-1/+1
|\
| * util.prosodyctl.cert: Ensure old cert is moved out of the wayKim Alvefur2024-08-301-1/+1
| | | | | | | | This should make it visible if the move fails
| * util.xtemplate: Fix error on applying each() to zero stanzasKim Alvefur2024-07-111-1/+2
| | | | | | | | Backport of 1f93e4f78c53
* | util.sslconfig: Support DH parameters as literal stringKim Alvefur2024-07-121-2/+12
| | | | | | | | Simplifies shipping well-known DH parameters in the config
* | util.xtemplate: Fix error on applying each() to zero stanzasKim Alvefur2024-07-111-1/+2
| |
* | util.prosodyctl: Use notify socket to wait for Prosody to be readyKim Alvefur2024-05-191-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously, prosodyctl only waits for the pidfile to appear, which does not necessarily mean that Prosody is fully ready to receive traffic. By waiting until Prosody says it's ready via the systemd notify socket we know for sure that Prosody is really ready. Notably this should ensure that when running `make integration-test` Prosody is really ready when Scansion starts running tests. Not sure if this timeout handling is optimal.
* | mod_pep: Implement 'roster' (group) access_modelKim Alvefur2023-12-031-1/+1
| | | | | | | | | | | | | | Allows e.g. restricting your vcard4 to only family or similar. Notes: This does not include roster groups in the configuration form, so the client will have to get them from the actual roster.
* | prosodyctl shell: Fix invocation with 3+ command argumentsMatthew Wild2024-04-241-1/+1
| | | | | | | | | | | | | | The code correctly inserted the ',' when there was already a "%q" in the format string, but then the next argument would fail to match because it inserted ", %q" instead of "%q". The code now matches both, ensuring the generated code will not produce a syntax error with multiple arguments.
* | util.startup: Fix notifying config-reload to systemdKim Alvefur2024-04-081-1/+1
| | | | | | | | Does this event name seem backwards to anyone else?
* | util.startup: Support systemd Type=notify service typeKim Alvefur2024-04-041-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | This lets Prosody report its lifecycle status to systemd, so it knows when Prosody has completed its startup, when it's reloading and shutting down. Both Type=notify and Type=notify-reload is supported Example systemd .service configuration snippet: [Service] Type=notify
* | util.startup: Fix exiting on pidfile troubleKim Alvefur2024-03-271-3/+3
| | | | | | | | | | | | | | | | | | | | | | prosody.shutdown() relies on prosody.main_thread, which has not been set yet at this point. Doing a clean shutdown might actually be harmful in case it tears down things set up by the conflicting Prosody, such as the very pidfile we were looking at. Thanks again SigmaTel71 for noticing
* | Merge 0.12->trunkMatthew Wild2024-03-271-0/+51
|\|
| * prosodyctl check: Warn about invalid domain names in the config fileMatthew Wild2024-03-271-0/+51
| | | | | | | | | | This ensures that domain names of virtual hosts and components are valid in XMPP, and that they are encoded correctly.
* | util.startup: Abort before initialization of logging when started as rootKim Alvefur2024-03-241-3/+3
| | | | | | | | | | Prevents creation of log files owned by the root user which could be inaccessible once started correctly.
* | util.startup: Don't use not yet existent shutdown procedure when started as ↵Kim Alvefur2024-03-241-1/+1
| | | | | | | | root (thanks SigmaTel71)
* | util.startup: Check root after detecting platform and reading config (thanks ↵Kim Alvefur2024-03-241-1/+1
| | | | | | | | | | | | | | | | SigmaTel71) Ensures that startup.detect_platform() runs so know whether to use the POSIX method of checking the current user or something else. Also after reading the config so we know whether the root override setting is set.
* | mod_posix: Move everything to util.startupKim Alvefur2024-03-231-9/+108
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows greater control over the order of events. Notably, the internal ordering between daemonization, initialization of libunbound and setup of signal handling is sensitive. libunbound starts a separate thread for processing DNS requests. If this thread is started before signal handling has been set up, it will not inherit the signal handlers and instead behave as it would have before signal handlers were set up, i.e. cause the whole process to immediately exit. libunbound is usually initialized on the first DNS request, usually triggered by an outgoing s2s connection attempt. If daemonization happens before signals have been set up, signals may not be processed at all.
* | util.startup: Back out 598df17b8ebbKim Alvefur2024-03-101-1/+1
| | | | | | | | | | | | | | | | Broke signal handling again, such that an early s2s connection results in libunbound catching signals and getting Prosody killed on e.g. SIGHUP This returns to the situation where prosody --daemonize does not respond to signals.
* | util.startup: Hook signals after daemonizationKim Alvefur2024-03-061-1/+1
| | | | | | | | | | | | signalfds stop working with epoll after forking hooking signals later should not affect anything
* | util.startup: Fix firing of USR1/2 eventsKim Alvefur2024-03-021-2/+2
| |
* | mod_posix: Move POSIX signal handling into util.startup to avoid raceKim Alvefur2024-03-021-0/+43
| | | | | | | | | | | | | | | | | | | | When libunbound is initialized, it spawns a thread to work in. In case a module initializes libunbound, e.g. by triggering a s2s connection, Prosody would not handle signals, instead immediately quit on e.g. the reload (SIGHUP) signal. Likely because the libunbound thread would not have inherited the signal mask from the main Prosody thread. Thanks Menel, riau and franck-x for reporting and help narrowing down
* | util.bit53: Add bnot() methodMatthew Wild2024-03-011-0/+3
| |
* | util.ip: Remove ip.bits and related code, switch to more efficient strbitopMatthew Wild2024-02-231-22/+6
| | | | | | | | 100,000 iterations of match() on my laptop from 3.5s -> 0.5s.
* | util.rfc6724: Remove, unused since introduction of Happy EyeballsKim Alvefur2024-02-221-141/+0
| | | | | | | | | | | | | | | | It was mainly used to determine whether to try IPv6 or IPv4 first, following the rules for this in the RFC. Now we always try IPv6 and IPv4 at roughly the same time, thus there no need to carry these rules.
* | util.startup: Expose core.features.available as prosody.featuresMatthew Wild2024-02-221-0/+2
| | | | | | | | for convenience.
* | util.prosodyctl.shell: Fix lint [luacheck]Kim Alvefur2023-12-091-1/+0
| |
* | util.prosodyctl.shell: Add :method syntax to make e.g. MUC commands easierKim Alvefur2023-12-091-2/+11
| | | | | | | | | | e.g. prosodyctl shell muc room room@muc.example.com :set_name "This Room"
* | util.xtemplate: Adopt {-path-} syntax to strip preceding and/or trailing ↵Kim Alvefur2023-12-091-4/+12
| | | | | | | | | | | | whitespace Seen in some other template languages
* | util.jsonschema: Return basic structured validation responseKim Alvefur2023-12-021-61/+108
| |
* | util.datamanager: Fix missing pack format when reading first index entryKim Alvefur2023-11-301-1/+1
| | | | | | | | Thanks MattJ
* | util.human.io: Don't accept ambiguous durations by defaultMatthew Wild2023-11-301-3/+17
| | | | | | | | | | The new method parse_duration_lax() exports the old behaviour, mainly for compatibility purposes.
* | util.datamanager: Load first item into index earlierKim Alvefur2023-11-271-1/+2
| | | | | | | | Should get rid of fseek() call
* | util.startup: Use prosody. module namespaceKim Alvefur2023-11-241-1/+1
| | | | | | | | Maybe we need some sort of lint for this?
* | util.async: Clip long line [luacheck]Kim Alvefur2023-11-211-1/+2
| |
* | util.async: Expose default runner functionMatthew Wild2023-11-211-0/+2
| | | | | | | | | | | | This is purely for informational purposes, so it's possible to determine externally whether a runner is using the default runner function (which executes functions as work items) or a custom runner function.
* | util.async: Record current work item in the runner objectMatthew Wild2023-11-211-0/+5
| | | | | | | | Mostly expected to be useful for debugging purposes.
* | util.async: Improve debug logging in a few placesMatthew Wild2023-11-211-2/+5
| | | | | | | | Knowing the state of the coroutine as well as the runner state can be helpful.
* | util.async: Export a table of currently-waiting runnersMatthew Wild2023-11-211-0/+5
| | | | | | | | This can be used for debugging and introspection.
* | util.prosodyctl.check: Disable https cert check if http_external_url setKim Alvefur2023-11-131-0/+4
| | | | | | | | | | This would indicate that a reverse proxy is used, which gets to be responsible for that since it probably holds the actual cert.
* | util.prosodyctl.check: Check cert for HTTPS if http module enabledKim Alvefur2023-11-131-3/+13
| |
* | util.prosodyctl.check: Update conditions for s2s cert checksKim Alvefur2023-11-131-3/+3
| | | | | | | | | | | | The 'anonymous_login' setting is deprecated and prosodyctl check config will tell you to change it to 'authentication = "internal_hashed"', so we shouldn't need to care about here anymore.
* | util.prosodyctl.check: Simplify conditions for c2s and s2s cert checksKim Alvefur2023-11-131-3/+3
| | | | | | | | This code is hard to follow and in need of some refactoring.