mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-05-09 08:26:00 +02:00
[GH-ISSUE #464] Feature request: Allow specifying users and ACLs declaratively #354
Labels
No labels
ai-generated
android-app
android-app
android-app
🪲 bug
build
build
dependencies
docs
enhancement
enhancement
🔥 HOT
in-progress 🏃
ios
prio:low
prio:low
pull-request
question
🔒 security
server
server
unified-push
web-app
website
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ntfy#354
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @pinpox on GitHub (Nov 3, 2022).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/464
Users and ACLs have currently to be set up imperatively using the
ntfy userandntfy accesscommands after ntfy is installed and running. It would be nice to be able to configure them declaratively, i.e. in a configuration file or environment variables that are read on startup.Benefits:
user addandaccess...commands by hand.Possible implementations I can think of:
@binwiederhier commented on GitHub (Nov 7, 2022):
I think that's a fair feature request. I think adding a section in the server.yml would be easy enough.
The only "issue" with this is that so far all options can be specified as CLI options, env variables OR in the server.yml. Nested structures like that may not be supported via the CLI library. I'd have to check.
@pinpox commented on GitHub (Nov 7, 2022):
Maybe, but it wouldn't remove any existing functionality from the CLI.
Just another implementation detail, because I see you added a bcrypt hash: If possible, it would be great if values (especially the password) could be read from environment variables here, something like
That would make it easy to provide these secrets to the systemd unit's environment and not have them in the config, which might be versioned in a public git repository. Alternatively, the password could be read from a separate file with something like
password_file: /var/lib/ntfy/secret-password.txt@agustinmista commented on GitHub (Nov 9, 2022):
This would be very handy! I'm hosting ntfy using the Docker image and the only way I found to set up user authentication was by attaching a shell to the running container:
@pinpox commented on GitHub (Nov 16, 2022):
Since ntfy already has a module for configuring it in NixOS, I can offer to extend that with ACL settings upstream when this issue is implemented.
@binwiederhier commented on GitHub (Nov 20, 2022):
I was gonna "quickly" implement this, but I stumbled over two things:
Would it be ok if
auth-fileandauth-userswere alternatives instead of complements. Initially I was going to offer andauth-usersyaml section in addition to theauth-file(= SQLite database), but that will be tricky to implement. Instead, I'd only allow eitherauth-users(declarative) orauth-file(db file).I am struggling to design the declarative design in such a way that it fits in environment variables and a yaml format. In yaml, it would look like this (or something similar):
@daedric7 commented on GitHub (Nov 20, 2022):
I don't believe you can encode so many info with env variables, not in a elegant way.
I've seen users being defined, but its always a yaml file. The granularity you require would be prohibitive with env variables.
We have username, that can have a role, must have a password, then a random-lenght list of topics each with its permissions.
@pinpox commented on GitHub (Dec 7, 2022):
Maybe just create a env variable like
AUTH_USERS_PATHthat points to that yaml file would be an option? If set, any modification of the configuration via the cli after the application has started should be prohibited.@macgregor commented on GitHub (Jul 1, 2023):
here from the future to give a bump. User/ACL configuration is very awkward in a containerized installation where you dont have easy access to the "server" to run commands like "ntfy user add ..." So far I:
bashand notshbut i wiped out the deployment so cant confirmI'm only doing this for fun, so at this point I think I'm just going to check back on the project in a couple months.
@binwiederhier commented on GitHub (Jul 2, 2023):
I agree with this. But there are other things that would need to be declarative, and it's not easy to combine declarative with command-driven user management. The world gets so much more complex when you have declarative users and can, e.g., also allow registration.
Plus, the CLI library does not allow nested yml structures at all, so that's a problem too.
@macgregor commented on GitHub (Jul 3, 2023):
Understood, just wanted to give a bump for the ever-more-containerized selfhosting landscape. For now I'm making due with ntfy.sh since I am not publishing anything remotely sensitive. I appreciate the service you're providing the open source community!
@pinpox commented on GitHub (Jul 4, 2023):
How about adding a parameter to just allow declarative users and disable cli-driven management? E.g.
--users-from-file=./myusers.ymlcould disable dynamic user management and set the acls and users to a fixed state.@weirlive commented on GitHub (Oct 4, 2023):
is there an update to this?
@wunter8 commented on GitHub (Oct 4, 2023):
Nothing yet
@fudini commented on GitHub (Jul 7, 2025):
I think the closest to declarative configuration would be a bash file that is just a list of commands, but there is no option (afaik) to specify token using
ntfy accesscommand and that makes it difficult.@binwiederhier commented on GitHub (Jul 7, 2025):
^^ The lack of declarative users has personally bugged me too, maybe I'll do that after IPv6 support. No promises
@binwiederhier commented on GitHub (Jul 27, 2025):
Only took 3 years, lol -- https://github.com/binwiederhier/ntfy/pull/1384
It's done and documented; though I may add
auth-tokenstoo since that's what people will ask for next. I won't addauth-tiersthough, because the format will be ridiculous. I kinda wish that ENV variables weren't a thing. They are so dumb for configuration files...@binwiederhier commented on GitHub (Aug 9, 2025):
This has been released as v2.14.0