Security
Users
You can securise your topic and ntfy instance by only allowing connected users. For that follow the next instructions:
- add to your docker-compose the following
environment:
NTFY_ENABLE_LOGIN: true # Enable the login module
NTFY_AUTH_FILE: /var/lib/ntfy/auth.db # Create the users/ACL database
NTFY_AUTH_DEFAULT_ACCESS: deny-all # If the user isn't in an ACL he can't see any topic can be change by write/read-only
- connect to your docker by shell and create your users, the password for the user will be asked after hit enter for the command
ntfy user add --role=<admin/user> <username>
ACL
To allow your user to use the different topics you can setup ACLs, use the following command:
ntfy access <username> <topic> <read/write/read-write/deny>
In case you want to manage the existing right of an user you can use the following:
ntfy access --reset # reset all ACLs
ntfy access --reset <username> # reset all ACLs for a specific user
ntfy access --reset <username> <topic> # reset ACL for a specific user on a specific topic>
Token
You can create access token to use in app or script, tokens are user specific and you can manage them with the following:
ntfy token list # Shows list of tokens for all users
ntfy token list <username> # Shows list of tokens for user phil
ntfy token add <username> # Create token for user phil which never expires
ntfy token add --expires=2d <username> # Create token for user phil which expires in 2 days
ntfy token remove <username> <token> # Delete token