Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/totalkrill/mosquitto_plugin
Write plugins for mosquitto in rust, with minimal friction!
https://github.com/totalkrill/mosquitto_plugin
mosquitto mqtt plugin
Last synced: 3 months ago
JSON representation
Write plugins for mosquitto in rust, with minimal friction!
- Host: GitHub
- URL: https://github.com/totalkrill/mosquitto_plugin
- Owner: TotalKrill
- Created: 2020-12-03T12:12:58.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2024-03-22T21:58:18.000Z (9 months ago)
- Last Synced: 2024-10-12T23:20:10.018Z (3 months ago)
- Topics: mosquitto, mqtt, plugin
- Language: Rust
- Homepage:
- Size: 76.2 KB
- Stars: 18
- Watchers: 4
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[![CI](https://github.com/TotalKrill/mosquitto_plugin/workflows/ci/badge.svg)](https://github.com/TotalKrill/mosquitto_plugin/actions)
# Mosquitto Plugin
A simple way to generate ACL and PASSWORD plugins for usage with the mosquitto
broker.Requires that mosquitto_plugin.h mosquitto.h files are installed on the system,
on linux systems this is usually achieved through the mosquitto-dev packages.
Not tested on windows.To pass additional (clang) arguments to the clang invocation from `bindgen`, set
`MOSQUITTO_PLUGIN_CLANG_EXTRA_ARGS` for e.g a special search path for the
mosquitto headers: "-I ../mosquitto-2.0.4/include".The optional functions are not implemented here.
## Debugging Segfaults
being a plugin utilizing the C ABI interface of mosquitto, there might be segfaults
due to unexpected behaviour in how mosquitto calls into the plugin, compiling in
debug mode will enable asserts of most raw pointer usage and can help in debugging
such cases.Otherwise, look at unsafe code, thats where segfaults occur. Which leaves the entire
mosquitto codebase, but mosquitto is quite well tested by now. So start looking in this code## Supported
- ease of access to write own mosquitto plugins
- auth_opt_ value in the mosquitto_conf
- mutable access to the structure between calls
- ACL implementations
- username/password implementatations## Example usage
There is an example usage in the github repo under "examples/acl" folder.
### Basic authentification
Simple example that allows only password/username combos where the password is
reversed (and no credentials as well, since those do not invoke ACL calls, and
thus needs to be configured in a mosquitto configuration)It also only allows messages on the topic specified in the mosquitto config as
auth_opt_topicSee the provided examples/mosquitto-acl.conf for details.
Start build and run:
```
cargo build --example basic-auth
mosquitto -c examples/basic-auth.conf
```### Extended authentification
Example how to negotiate authentification with a client with v5 AUTH packages.
Start build and run:
```
cargo build --example extended-auth
mosquitto -c examples/extended-auth.conf
```