binwiederhier / ntfy

Send push notifications to your phone or desktop using PUT/POST
https://ntfy.sh
Apache License 2.0
18.51k stars 728 forks source link

auth-file settings ignored #1040

Closed CountMurphy closed 8 months ago

CountMurphy commented 8 months ago

:lady_beetle: Describe the bug Just installed on Arch by the ntfysh package. My /etc/ntfy/server.yml has the following three lines:

listen-http: ":8082"
auth-file: "/Raid/ntfy/user.db" 
auth-default-access: "deny-all"

Now the server does indeed start on port 8082, so I know ntfy is reading the config. The permissions on the directory are

drwxr-xr-x ntfy ntfy

When I attempt to create a new user with ntfy user add --role=admin Name I get:

option auth-file not set; auth is unconfigured for this server

The user.db file is also not created at service start.

:computer: Components impacted

ntfy server :bulb: Screenshots and/or logs

:crystal_ball: Additional context

Additionally, the deny-all setting is also ignored and the server is publicly accessible.

wunter8 commented 8 months ago

I'd be happy to help on Discord! It's a bit hard to go back and forth here.

(But in essence, I'm guessing the problem is that the systemd service runs as the ntfy user, whereas ntfy user add ... runs as your user, so it's looking at ~/.config/ntfy/server.yml instead of /etc/ntfy/server.yml, so it doesn't know where the auth-file is. You can either sudo -u ntfy ntfy user add ... or ntfy user --auth-file /Raid/ntfy/user.db add ...)

CountMurphy commented 8 months ago

Also tried running as the ntfy user, exact same result. I've just joined. What channel should I join, or should I DM you?

CountMurphy commented 8 months ago

Well I did a dumb. My yml was missing a whitespace character before auth-file. Seems to be working now