aboutsummaryrefslogtreecommitdiffstats
path: root/util
Commit message (Collapse)AuthorAgeFilesLines
* util.argparse: Fix bug (regression?) in argument parsing with --foo=barMatthew Wild35 hours1-2/+6
| | | | | | | | | | | | | | | | After recent changes, '--foo bar' was working, but '--foo=bar' was not. The test had a typo (?) (bar != baz) and because util.argparse is not strict by default, the typo was not caught. The typo caused the code to take a different path, and bypassed the buggy handling of --foo=bar options. I've preserved the existing test (typo and all!) because it's still an interesting test, and ensures no unintended behaviour changes compared to the old code. However I've added a new variant of the test, with strict mode enabled and the typo fixed. This test failed due to the bug, and this commit introduces a fix.
* util.sasl: Preserve 'userdata' field between clonesMatthew Wild7 days1-3/+8
| | | | | | | | | | | | | | The :clean_clone() method is designed to provide a new cloned SASL handler, to be used when starting a fresh SASL negotiation on an existing connection. The userdata field is currently populated by mod_saslauth with the "read-only" information that the channel binding methods need to do their stuff. When :clean_clone() does not preserve this, it causes tracebacks in the cb profile handlers due to the property being nil. This does mean that SASL handlers should now not be reused (even when cloned) across different connections, if they ever could.
* prosodyctl: check features: stop searching after finding a matching componentMatthew Wild2025-02-221-0/+1
|
* core.configmanager: Remove dependency on 'prosody' global for CredentialKim Alvefur2025-02-221-1/+8
| | | | | Minimizing dependencies on global state is nice, as it makes using configmanager outside of Prosody easier.
* util.argparse: Add strict mode + testsMatthew Wild2025-02-171-3/+10
|
* mod_admin_shell, util.prosodyctl.shell: Process command-line args on ↵Matthew Wild2025-02-171-11/+1
| | | | | | | | | | | | server-side, with argparse support This allow a shell-command to provide a 'flags' field, which will automatically cause the parameters to be fed through argparse. The rationale is to make it easier for more complex commands to be invoked from the command line (`prosodyctl shell foo bar ...`). Until now they were limited to accepting a list of strings, and any complex argument processing was non-standard and awkward to implement.
* util.argparse: Optionally continue processing past positional parametersMatthew Wild2025-02-171-30/+40
|
* util.x509: Per RFC 9525, remove obsolete Common Name checkKim Alvefur2024-02-111-44/+7
|
* prosodyctl: check features: Fix traceback for components with no recommended ↵Matthew Wild2025-02-171-13/+15
| | | | modules (thanks Menel, riau)
* util.prosodyctl.check: Recognise http_upload_external as a file upload serviceMatthew Wild2025-02-161-1/+1
|
* util.prosodyctl.check: Fix typo in informational messageMatthew Wild2025-02-161-1/+1
|
* prosodyctl: check features: check for mod_muc_mam on MUC componentsMatthew Wild2025-02-161-4/+64
|
* util.sql: Don't send SQLCipher key to Postgres or MySQL (thanks gllmhyt)Kim Alvefur2025-02-161-1/+1
| | | | | | This was copied from util.sqlite3 which only deals with SQLite3, but here Postgres or MySQL are also possibilities, which wouldn't support this.
* prosodyctl: check: Fix variable name (thanks luacheck)Matthew Wild2025-02-151-1/+1
|
* prosodyctl: check: Skip DNS checks for known invalid domains (fixes traceback)Matthew Wild2025-02-151-1/+5
|
* prosodyctl: check features: Check for recommended feature availabilityMatthew Wild2025-02-151-0/+232
| | | | | | Inspired by mod_compliance_*, this command will help people (especially those with older configs, upgrading from previous releases) learn what features their Prosody configuration may be missing.
* util.prosodyctl.check: Sort hosts in iterator for more stable outputMatthew Wild2025-02-151-1/+1
|
* prosodyctl: check: Fix indentation in warning messageMatthew Wild2025-02-151-2/+2
|
* prosodyctl: check: Warn about deprecated mod_posixMatthew Wild2025-02-131-0/+6
|
* util.dnsregistry: Update using scriptKim Alvefur2025-02-091-1/+2
|
* net.adns: Collect DNS lookup timing metricsKim Alvefur2025-02-071-0/+14
| | | | Nice to have this in OpenMetricts instead of debug logs
* util.prosodyctl: Add comments to explain logic and expected behaviour (#1688)Matthew Wild2025-02-061-0/+7
|
* util.prosodyctl.shell: Export function to check for availability of admin socketMatthew Wild2025-02-061-0/+8
|
* util.startup: Drop mention of systemd from notification socket handlingKim Alvefur2025-02-011-4/+4
| | | | This does not have to be specific to systemd
* util.sql: SQLCipher supportKim Alvefur2025-01-232-0/+12
| | | | | | | This enables use of encrypted databases if LuaDBI or LuaSQLite3 has been linked against SQLCipher. Using `LD_PRELOAD` may work as well. Requires SQLCipher >= 4.0.0 due to the use of UPSERT
* util.startup: Rename credentials path variable tooKim Alvefur2025-01-181-1/+1
|
* core.configmanager: Add function for getting secrets from separate filesKim Alvefur2025-01-161-2/+7
| | | | | | | | | | | | Idea is to enable easily retrieving of secret values from files outside of the config, e.g. via the method used by systemd credentials. CREDENTIALS_DIRECTORY is expected to be set by the process manager invoking Prosody, so being unset and unavailable from prosodyctl is going to be normal and a warning is reported in that case. Care will have to be taken to make it clear that prosodyctl check will not work with such values. An error is thrown if the directory is unavailable when running under Prosody.
* util.bitcompat: Avoid potential noise from global metatableKim Alvefur2025-01-151-1/+1
| | | | | If this module is require'd from a plugin on a Lua version without the global bit32 library, it may trip a warning about accessing globals.
* util.prosodyctl.shell: Remove non-existent export [luacheck]Kim Alvefur2025-01-081-1/+0
|
* util.prosodyctl.shell: Support for requesting special inputs, e.g. passwordsMatthew Wild2025-01-071-0/+17
| | | | | This lets the server signal to the client that a special input is requested. Currently we support the "password" type only.
* util.adminstream: Expose session events (specifically "disconnected")Matthew Wild2025-01-071-8/+10
| | | | Currently there is no way to get this info and perform cleanup tasks.
* Merge 0.12->trunkMatthew Wild2024-12-201-4/+14
|\
| * util.prosodyctl.check: Improve error handling of UDP socket setup (for #1803)0.12.5Matthew Wild2024-12-201-4/+14
| | | | | | | | Not necessarily a fix, but may give us more information about failure cases.
* | util.stanza: Handle Clark notation for attributes in :find()Kim Alvefur2024-11-171-0/+3
| |
* | util.stanza: Handle namespace prefixes for attributes in :find()Kim Alvefur2024-11-171-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äfer2024-11-161-1/+1
| |
* | util.startup: Bump expected util.pposix versionKim Alvefur2024-11-161-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?