Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Files backend issue #291

Open
yogesh-rgb opened this issue Aug 22, 2023 · 7 comments
Open

Files backend issue #291

yogesh-rgb opened this issue Aug 22, 2023 · 7 comments

Comments

@yogesh-rgb
Copy link

I am using files as a backend providing all relevent configurations with all file and password file.

I am using passwor and all files as a docker mount

On broker start I have added one user able to login with that

Now I have added one more user in password file

I am not able to login, if I restart I can login with new user.

So is there a fix or how can we achieve use and all addition dynamically without restarting the broker.

Thanks in advance.

@iegomez
Copy link
Owner

iegomez commented Aug 23, 2023

The only way to reload static files without restart is via SIGHUP signal which is watched and intercepted here: https://github.com/iegomez/mosquitto-go-auth/blob/master/backends/files/files.go#L102C31-L102C31

Other than that, the Files backend is not meant for dynamic changes, other backends are better suited for that.

@yogeshanivaln
Copy link

@iegomez thanks for the response cold you please share how to achieve this with SIGHUP part

else if i use JS backend will that dynamically load the user and acl part.
the examples have less info need more on how to configure them

Thanks in advance

@iegomez
Copy link
Owner

iegomez commented Aug 25, 2023

As far as I remember, you can send a SIGHUP like this: kill -HUP <pid>.

As for the other question, every backend that's not the static files one is dynamic in nature, e.g. your JS functions will run on each check with whatever logic they have, or the Postgres checks will query the current state of the DB which can be changed externally, etc.
The Files backend could be changed to load the file on each check, but that beats the purpose: it's supposed to work exactly as Mosquitto's static files check and it's there only to support that use case along side other backends if you know some kind of users are static and won't be changing.

@yogeshanivaln
Copy link

HI @iegomez ,

thanks for your help on above as we are running customised docker image one quite tedious to run the HUP command

so planning to go for JS one, have few questions on it

with JS does caching works ?

Our requirent is we dont want to use any DB to save credentials so we need some kind of alterative where we can communicate with vault to get credentials instead of DB

and we will update our valut from our other bakend apis

any suggestions on above

Thanks in advance

@iegomez
Copy link
Owner

iegomez commented Aug 28, 2023

Caching is not tied to any specific backend, so yes, it works. Check the readme for more details on how to set it up.

@iegomez
Copy link
Owner

iegomez commented Aug 28, 2023

And I don't have any suggestions because that's highly dependent on your team, context, product, etc., so it could range from "sure, JS is fine" to "I'd fork or create my own implementation".

@yogeshanivaln
Copy link

HI @iegomez ,

thanks for your help will proceed with JS backend

as we need dynamic part so checking on otto's file reading properties

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants