Commit graph

131 commits

Author SHA1 Message Date
Roger A. Light
9aeb756dac Fix Coverity Scan 1499842 2022-10-16 23:28:02 +01:00
Roger A. Light
1d230bd255 dynsec: Fix listClients/getClient crashing if an anon user present
This only affects the unreleased `develop` branch.
2022-08-22 10:50:10 +01:00
Roger A. Light
fd68bf00c7 Merge branch 'master' into develop 2022-08-17 16:18:24 +01:00
Roger A. Light
ba13edc6a4 dynsec: Forbid deleting the anon group. 2022-08-17 12:10:24 +01:00
Roger A. Light
4d1b587e29 dynsec: Forbid deleting the anon group. 2022-08-16 12:55:48 +01:00
Roger A. Light
df317ff71f Dynamic security: Fix the plugin being able to be loaded twice.
Currently only a single plugin can interact with a unique $CONTROL
topic. Using multiple instances of the plugin would produce duplicate
entries in the config file.

Closes #2601.
Closes #2470.
2022-08-16 01:27:55 +01:00
Roger A. Light
436f0b9348 dynsec: Fix modifyClient and modifyGroup commands
They will now not modify the client/group if a new group/client being
added is not valid, or on other failures.

Closes #2598. Thanks to Sebastian Szczepański.
2022-08-16 00:48:02 +01:00
Roger A. Light
b22df5140e Clear errno before check. 2022-08-16 00:23:06 +01:00
Roger A. Light
80c7726d5c Fix confusing error message when dynamic security config file was a directory.
Closes #2520. Thanks to sezanzeb
2022-08-12 08:34:56 +01:00
Kai Buschulte
8b67883548 Remove old compatibility header support
Signed-off-by: Kai Buschulte <kai.buschulte@cedalo.com>
2022-08-08 09:25:16 +00:00
Roger A. Light
7794001ce2 Don't free arrays. 2022-08-07 08:24:34 +01:00
Roger A. Light
832e51cb57 dynsec: reduce memory allocations 2022-08-05 13:08:55 +01:00
Roger A. Light
e5d6bbb907 dynsec: don't leave in partial state on error 2022-08-04 19:16:30 +01:00
Roger A. Light
c397d080b4 Merge branch 'fix-corrupted-dynsec-config' of https://github.com/NorbertHeusser/mosquitto into NorbertHeusser-fix-corrupted-dynsec-config 2022-07-21 20:18:38 +01:00
Norbert Heusser
621d74fd6a Created new helper function mosquitto_write_file in common/misc_mosq.h to consolidate
saving config files in failsafe manner

Signed-off-by: Norbert Heusser <norbert.heusser@cedalo.com>
2022-07-19 17:22:19 +00:00
Kai Buschulte
71456077ad Introduce a common-options cmake target
this makes it possible to explicitly share compile options, without
using the `add_definition` function. This function declares options for
the current directory and below (in our case also for `deps`).

Adding -Wall, -Wconversion and -Wextra to at least make compiler
warnings visible for the cmake build.

Signed-off-by: Kai Buschulte <kai.buschulte@cedalo.com>
2022-07-04 11:16:01 +02:00
Roger A. Light
34391080d6 Add dynsec init by simple file. 2022-06-22 17:33:39 +01:00
Kai Buschulte
7e4746aac4 Fix missing symbols MacOS
Core symbols needed by plugins are now properly linked to their objects

 * Remove link_directories() call:

This specification is not necessary for our own libraries as cmake
shares this information over the targets.

If needed they should be specified target specific, like done for
the external DLT library.

Signed-off-by: Kai Buschulte <kai.buschulte@cedalo.com>
2022-05-11 07:01:22 +00:00
Kai Buschulte
0e9df05d0d Add imported target for cJSON
Signed-off-by: Kai Buschulte <kai.buschulte@cedalo.com>
2022-05-11 07:01:17 +00:00
Norbert Heusser
d4216c8cb6 Fixed CMakeLists.txt
* Addded missing files plugin_subscribe and plugin_unsubscribe to src/CMakeLists.txt
* Aligned mixed usage of all-keyword and all-plain in target_link_libra…ry definition in in CMakeLists.txt

Signed-off-by: Norbert Heusser <norbert.heusser@cedalo.com>
2022-04-06 10:26:03 +00:00
Roger A. Light
af42640d60 Dynsec: Allow initial password generation from environment variable. 2022-03-24 22:40:40 +00:00
Roger A. Light
bf1d39746a dynsec: admin should have sys-observe role 2022-03-17 11:53:41 +00:00
Roger A. Light
3122d3e2c5 Simplify some dynsec config functions. 2022-03-13 22:22:19 +00:00
Roger A. Light
5279a424b1 Dynsec: Kick clients in tick event rather than immediately
This means that PUBACK/PUBREC should be sent to clients that modify
their own roles.

Closes #2474. Thanks to Stefano Berlato.
2022-03-12 23:16:57 +00:00
Roger A. Light
0deaae286e NULL after freeing. 2022-03-09 01:33:23 +00:00
Roger A. Light
051fbadb99 Move some CONTROL code to plugin common. 2022-03-08 21:28:22 +00:00
Roger A. Light
14d1c32f9d Update changelog. Style, whitespace and, linker fixes. 2022-02-24 15:52:06 +00:00
Roger A. Light
96931643a4 Use strings.h for strcasecmp, except on Windows.
Closes #2420. Thanks to Frédéric Fauberteau.
2022-02-24 12:02:16 +00:00
Norbert Heusser
e7e8b6e832 * Added list of connections to dynsec/getClient response
* Added new helper function mosquitto_apply_on_all_clients to broker
* Refactoring in dynamic-security plugin

Signed-off-by: Norbert Heusser <norbert.heusser@cedalo.com>
2022-02-21 16:27:26 +00:00
Roger A. Light
a0f58f20c3 Update threaded builds.
Most specifically use -pthread instead of -lpthread.
2022-02-09 22:19:35 +00:00
Roger A. Light
ffb7661d86 Move shared code to common directory
This is currently limited to "utility" type functions and does not include code common to the library and broker that are protocol related.
2022-02-09 16:26:10 +00:00
Roger A. Light
5a3b42d4a4 Use path vars in Makefiles. 2022-02-09 14:44:09 +00:00
Roger A. Light
8d073771c3 Make some plugin code shared for future use. 2022-02-03 23:08:28 +00:00
Roger A. Light
d032c94d14 Remove global vars. 2022-02-03 21:50:20 +00:00
Roger A. Light
4adce6d0da Add anonymous group when generating dynsec config. 2022-02-02 22:02:11 +00:00
Roger A. Light
11c5cf039f Simplify memory use for dynsec. 2022-01-27 16:09:09 +00:00
Roger A. Light
cd28187e5e Minor refactor to separate files. 2021-12-15 16:36:54 +00:00
Roger A. Light
17fd1929eb Move config load/save to own file. 2021-12-13 09:14:05 +00:00
Roger A. Light
2501a64035 Merge branch 'master' into develop 2021-11-23 12:53:50 +00:00
Roger A. Light
34b41a3b01 Dynsec: Add ability to deny wildcard subscriptions for a role 2021-11-10 11:20:25 +00:00
Konstantin Podsvirov
c4d51f0835 Fix DESTINATION for mosquitto_dynamic_security MODULE
On Windows MODULE will be installed as LIBRARY component
to `lib` folder that is not prefer for dynamic loaded modules
but can be found in RUNTIME DESTINATION (`bin` folder) too.

Signed-off-by: Konstantin Podsvirov <konstantin@podsvirov.pro>
2021-11-06 17:11:09 +03:00
Roger Light
cd07f1136b Bump copyrights. 2021-11-03 22:10:06 +00:00
Roger A. Light
8ac11929cc Merge branch 'master' into develop 2021-10-27 17:19:33 +01:00
Roger A. Light
799cdead15 Experimental custom websockets support. 2021-10-06 15:32:45 +01:00
Roger A. Light
a1a190b482 Pointless whitespace tidy. 2021-10-05 15:20:37 +01:00
Roger A. Light
55d5d2e5f2 Fix for building when uthash not available. 2021-09-30 21:37:11 +01:00
Roger A. Light
2bfc7e7cc8 Do plugin callback unregistering automatically. 2021-09-30 12:42:13 +01:00
Roger A. Light
6763d94962 Add plugin version helper. 2021-09-30 10:56:48 +01:00
Roger Light
dbd0d6f0d8 CMake build fixes. 2021-09-28 11:48:03 +01:00
Roger A. Light
a25fc166a8 Add $CONTROL/broker/v1 control & the getPluginInfo command. 2021-09-07 23:17:31 +01:00