Simple plugin that allows you to authenticate users against a YAML file.
- username: user1
password: password1
- username: user2
password: password2
In mosquitto.conf
auth_plugin /path/to/mosquitto-yaml-auth.so
auth_opt_users_file /path/to/users.yaml
cmake
pkg-config
mosquitto-dev
(ormosquitto-devel
)llvm-dev
(orllvm-devel
) andllvm-static
(orllvm-libs
)
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j$(nproc)
I use the included Dockerfile
to build the plugin for the Mosquitto Docker image, which I then simply place inside a
volume.
To build the plugin for the Mosquitto Docker image, run:
# Build the image and the plugin
docker build -t mosquitto-yaml-auth .
# Copy it outside the container
docker run --rm -v $PWD/libs/:/host -it mosquitto-yaml-auth cp /sources/build/libmosquitto_yaml_auth.so /host/
Find the built plugin in the libs
directory.
Note that the plugin built this way only works on Alpine Linux.
Licensed under the GNU Lesser General Public License v2.1 or later. See the LICENSE file for details.