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

Ntfy custom server not working #6488

Closed
Raito00 opened this issue Oct 31, 2024 · 9 comments
Closed

Ntfy custom server not working #6488

Raito00 opened this issue Oct 31, 2024 · 9 comments
Assignees
Labels

Comments

@Raito00
Copy link

Raito00 commented Oct 31, 2024

Steps to reprosduce:

Set up a self-hosted ntfy server (e.g. ntfy.example.com)
Configure MeshCentral messaging to use the self-hosted ntfy server:**

"messaging": {
  "ntfy": {
    "host": "ntfy.example.com",
    "userurl": "https://ntfy.example.com/userhelp",
    "authorization": "Bearer <token>",
    "description": "Custom ntfy server"
  }
}

Attempt to send a test notification in MeshCentral
Expected Behavior
A verification code should be sent to the ntfy client to approve the MeshCentral server. Once approved, notifications should work properly.

Actual Behavior
The verification code is not sent from the MeshCentral server to the self-hosted ntfy server. Notifications do not work with the self-hosted ntfy server.

Workaround
Using the public ntfy.sh host works properly.

Additional Details
MeshCentral version: v1.1.32
ntfy server version: v2.8.0

Notifications to and from the self-hosted ntfy server works properly. Including SMTP to and from the self-hosted ntfy server.

NTFY Server Software (please complete the following information):

OS: Ubuntu 22.04
Virtualization: none
Network: LAN/WAN, reverse proxy.
Version: v2.8.0
MeshCentral Server Software (please complete the following information):

OS: Ubuntu 22.04
Virtualization: none
Network: LAN/WAN
Version: 1.1.32
** redacted snippet of messaging section from config.json file**

"messaging": {
  "ntfy": {
    "host": "ntfy.example.com",
    "userurl": "https://ntfy.example.com/userhelp",
    "authorization": "Bearer <token>",
    "description": "Custom ntfy server"
  }
},
  "smtp": { .......

I also tested with:

 "authorization": "Basic <base64-user:passw>" 

The same problem ...

@Raito00 Raito00 added the bug label Oct 31, 2024
@PTR-inc
Copy link
Contributor

PTR-inc commented Oct 31, 2024

I also have a self-hosted ntfy server and it works fine with meshcentral 1.1.32
My ntfy version is v2.11.0 btw
Do you have logging from the mesh and ntfy server?

@Raito00
Copy link
Author

Raito00 commented Oct 31, 2024

I have my self-hosted nfty setup so only authenticated user can send notifications or with Token.
@PTR-inc Your Meshcentral config is the same like my?
I updated ntfy to v2.11.0 - the same problem

@Raito00
Copy link
Author

Raito00 commented Oct 31, 2024

Ntfy logs found one error:

"DEBUG","message":"Access to topic userhelp not authorized","error":"unauthorized","http_method":"GET","http_path":"/userhelp/ws"

@si458
Copy link
Collaborator

si458 commented Oct 31, 2024

@Raito00 have you verified you can send a message to your topic without meshcentral first?
https://docs.ntfy.sh/config/#example-private-instance

better docs - https://docs.ntfy.sh/publish/#authentication

@Raito00
Copy link
Author

Raito00 commented Nov 1, 2024

Yes! I`m using my ntfy few years.
My most used command is:

curl -X POST "https://ntfy.<mydomain>/MyTopic" \
     -H "Authorization: Bearer tk_<redacted>" \
     -d "Message go here!" \
     -H "Title: Title message go here" \
     -H "Tags: Extra TAGS go here!"

or simple one:

curl \
  -H "Authorization: Bearer tk_<redacted>" \
  -d "Message go here!" \
  https://ntfy.<mydomain>/MyTopic

@si458
Copy link
Collaborator

si458 commented Nov 1, 2024

@Raito00, have u ever had ntfy working with meshcentral, or is this the first time setting it up?

U also didn't quite follow the bug template report correctly.

What nodejs version are u using?

Is the ssl on ur ntfy domain a valid ssl or self signed?

@Raito00
Copy link
Author

Raito00 commented Nov 1, 2024

This is first time i try use on Meshcentral.
Node: v22.5.1
Yes, all ok with ssl is valid

P.S.
I can create user for You in my nft for direct testing ...

@si458
Copy link
Collaborator

si458 commented Nov 1, 2024

This is first time i try use on Meshcentral.
Node: v22.5.1
Yes, all ok with ssl is valid

P.S.
I can create user for You in my nft for direct testing ...

Sure, please email me details with link etc, I'll be stationary in 2 hours 🚗

si458 added a commit that referenced this issue Nov 1, 2024
Signed-off-by: si458 <simonsmith5521@gmail.com>
@si458 si458 self-assigned this Nov 1, 2024
@si458
Copy link
Collaborator

si458 commented Nov 1, 2024

ok this is all fixed now!
thank you for sending details, what appears to be happening is because you use cloudflare,
cloudflare EXPECTED a User-Agent header on EVERY request,
and nodejs just doesnt include you, so you have to set one!
the patch is here if you want to manually patch it yourself! 7928f7f

@si458 si458 closed this as completed Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants