1346 points · by tambourine_man · 4y ago · 296 comments
Edit: I am also looking for a new opportunity. If you need a good Staff/Principal Engineer, check out my resume here: https://heckel.io/resume.pdf
You've made a beautiful piece of software for your own enjoyment and the benefit of others. It is just what it needs to be. Bravo. In a world where projects get massively complicated and pumped full of VC funding, may efforts like this live on.
I guarantee for nothing, since this is a spare time project. That said, I have had zero outages in 11 months, see https://ntfy.statuspage.io/
When it outgrows the single EC2 instance, I'll likely start building some distributed thingy to spread the load and do some HA things (sounds like fun). Probably just a load balancer and 2-3 instances with a rqlite backend instead of SQLite, nothing too fancy.
Right now that's not necessary. As you can see, it handles traffic just fine for now.
rqlite will give you HA, but won't help with load (rqlite replicates for reliability, not for write performance). But I like to think the it'll give you solid -- and simple to use -- HA. Replicated just replaced their use of Postgres with rqlite for this reason[2].
[1] https://github.com/rqlite/rqlite
[2] https://www.replicated.com/blog/app-manager-with-rqlite/
I am incredibly humbled by the sponsorships. I would have never thought ntfy would take off like that. I love open source and I promise it'll always be free and open (as long as I can reasonably fight of the abusers).
If you'd like to help me out me, you can donate via GitHub Sponsors: https://github.com/sponsors/binwiederhier
It wont be me. But some enterprising engineer/pm/group who was recently laid off in this downturn will probably make a go of it.
I am suffering a little right now while I try to add E2E encryption, because I structured the handlePublish logic awkwardly. But other than that there have been no surprises.
Sorry that's such a boring answer.
Could you elaborate on how this differs from gotify?
I decided to add Ntfy.sh support today just because it was so goddamn easy. Thanks for the cool service!
Now whenever new pull requests, issues or commits are made I get a ding on my phone!
And to subscribe, either use UnifiedPush (https://unifiedpush.org/), or use intents (see link above). Or, implement your own foreground service with WebSockets (just like the ntfy app does).
I love this tool because it sits in a very convenient place in the alerting and monitoring stack.
At work the kind of alerting pipelines and frameworks needed can by necessity end up being nontrivial and somewhat sophisticated. If you run some stuff at home or in the cloud or whatever, I have often wanted some kind of simple alerting but never want to deal with mocking out similar systems that I've built at work.
Ntfy sits perfectly in this space, and I've used to to frame out my own kind of micro-alerting frameworks for a bunch of stuff that I run. It's incredibly easy to encapsulate in something like a bash TRAP or even || conditionals on random cronjobs, and just makes getting some kind of alerting so trivial. As such, it's spiraled out into a lot of different stuff that I run.
I use it to get notifications of the CI running on build.wireguard.com, which took less than a minute to get working. Sometimes I'll use it for random one-off notifications, like when a command finishes running or some shell script sleep-loop scraper finds what it was waiting for. It's the nicest thing I've had for that kind of thing since mytelephonenumber@txt.att.net.
I remember when you sent me that email months ago it was super cool for me. The creator of WireGuard emailing meee? whoa! Anyway. Thanks again for the kind words.
I just go to the website with my browser click generate. Then in my script I do `curl $pushurl?title=jobdone`. When it gets triggered a notification popups on my phone that says "jobdone".
It uses the native browser web push API so I don't need to install anything extra.
_edit:_ wrote a little Bash function for this; seems to work well:
function notify() {
argTitle='TerminalNotification'
argText="$1"
argUrl='https://www.example.com'
baseUrl='https://pushurl.43z.one/XXXXXXXXXXXXX'
curl --get \
--data-urlencode "title=$argTitle" \
--data-urlencode "text=$argText" \
--data-urlencode "url=$argUrl" \
$baseUrl
}Also it's surprisingly hard to kill telegram for some reason so it's kinda robust. My stupid mi phone is quite aggresive in killing most background apps except whatsapp and telegram.
I suspect it's because I'm subscribed to too many high traffic group chats, and even though they're muted, the telegram servers still send large numbers of push notifications for them, which eventually start hitting some rate limit and everything gets dropped - even for unmuted conversations.
That happens to me with WhatsApp. Curiously a message to Telegram kicks it back into gear too. My fiancee first messages me 'calling' on Telegram before calling on WhatsApp, because she figured out (remotely, by experience) that otherwise it often doesn't ring.
Part of the reason for this is hardcoded whitelisting.
Big reason is I can create groups and add people to such notifications. Super easy.
I have some scheduled ci/cd pipelines that send notifications. Just scroll up for history. This setup has been working with no changes needed for couple years, no hiccups. Love it.
I set up Tasker on my phone such that when a specific low-priority (no visible/audible alert) message from pushover, containing only a hash key, is received it picks it up and does an HTTPS request to my self-hosted server to retrieve the actual notification text.
I have a bash/websocat client connected 24/7 to wss://client.pushover.net/ as well that I should probably put up on git for other people.
I’ve been using for quite a fee years. The app is not free but once you pay the one-time fee for the app, they have a generous free tier for personal use, and it has worked quite flawlessly for me so far.
In my case I just did that recently to receive webhooks and send them to my phone: https://blog.notmyhostna.me/posts/push-notifications-from-ap...
Personally I setup a Slack server and use webhooks to push events to a channel there. Works great :)
I'm building exactly this right now for my first hardware project. Have you published any notes anywhere?
https://docs.joinmastodon.org/methods/apps/oauth/ https://docs.joinmastodon.org/methods/statuses/
Thanks!
And yes, you need to disable battery optimization if you don't want to use Firebase. On my phone it uses 1% battery in a full day (17h).
- avoid Google servers - preserve battery - show timely notifications
There's no dependency on Google services, although the app can use them if available.
If this doesn't work for you, you can always create a ticket or make your own app or website using the subscription API: https://ntfy.sh/docs/subscribe/api/
Works well, I wish more services were using UnifiedPush (so that I would not need the constant Telegram notification, for instance).
To be clear, if 100 people subscribe to ntfy.sh/mytopic, they all receive this message, right?
curl -d "Backup successful :)" ntfy.sh/mytopic
I wonder how many people got one when I was testing...- https://ntfy.sh/announcements for announcements (usually only release announcements) - https://ntfy.sh/stats for daily stats (right before midnight UTC)
Note that messages are only cached for 12h server-side, so you'll not see any messages in there mostly. I suggest to just subscribe and see if you like getting these messages.
Quick question: if my team and I already "subscribe" to a private matrix room to receive alerts from our automated scripts (which auto-send alerts into said private matrix room)...is there a need for also leveraging ntfy.sh into this type of workflow? Again, much love and respect to this project...I'm just trying to learn. Thanks!
It's funny how similar the domain name is.
How does that not become a slowloris attack? [2]
[0] https://ntfy.sh/docs/subscribe/api/#subscribe-as-json-stream
[1] https://ntfy.sh/docs/subscribe/api/#subscribe-as-raw-stream
[2] https://en.wikipedia.org/wiki/Slowloris_(computer_security)
Additionally I limit the number of subscriptions per IP address.
So far so good.
BTW if you _do_ want to send emails, ntfy can do that too, even without auth (limited to 16 a day though): https://ntfy.sh/docs/publish/#e-mail-notifications
It's working very well.
https://thejeshgn.com/2022/08/23/self-hosted-mobile-push-not...
Here's a quick fish function for being able to call this from a shell like `alt my message`
function alt
curl -d "\"$argv\"" ntfy.sh/<my topic>
end $ cat /bin/awkmail
#!/bin/gawk -f
BEGIN { smtp="/inet/tcp/0/smtp.yourISP.com/25";
ORS="\r\n"; r=ARGV[1]; s=ARGV[2]; sbj=ARGV[3]; # /bin/awkmail to from subj < in
print "helo " ENVIRON["HOSTNAME"] |& smtp; smtp |& getline j; print j
print "mail from:" s |& smtp; smtp |& getline j; print j
if(match(r, ","))
{
split(r, z, ",")
for(y in z) { print "rcpt to:" z[y] |& smtp; smtp |& getline j; print j
}
}
else { print "rcpt to:" r |& smtp; smtp |& getline j; print j }
print "data" |& smtp; smtp |& getline j; print j
print "From: " s |& smtp; ARGV[2] = "" # not a file
print "To: " r |& smtp; ARGV[1] = "" # not a file
if(length(sbj)) { print "Subject: " sbj |& smtp; ARGV[3] = "" } # not a file
print "" |& smtp
while(getline > 0) print |& smtp
print "." |& smtp; smtp |& getline j; print j
print "quit" |& smtp; smtp |& getline j; print j
close(smtp) } # /inet/protocol/local-port/remote-host/remote-port
$ echo ricki dont lose that number | awkmail 9998675309@vtext.com me@here.com testTwilio SMS API, on the other hand, does not have that limit and you can send long SMS messages with a single 'curl' command:
/usr/local/bin/curl -s -X POST -d "Body=$msg" -d "From=$from" -d "To=$to" "https://api.twilio.com/2010-04-01/Accounts/$accountsid/Messages" -u "$accountsid:$authtoken"
That's simplified - I actually pipeline through 'tidy5' and 'source-highlight' to make the output pleasing: /usr/local/bin/curl -s -X POST -d "Body=$msg" -d "From=$from" -d "To=$to" "https://api.twilio.com/2010-04-01/Accounts/$accountsid/Messages" -u "$accountsid:$authtoken" | tidy5 -xml -iq | source-highlight -s xml -f esc | awk 'xor(/TwilioResponse/,/Message/,/To/,/From/,/Body/,/Status/,/ErrorCode/,/ErrorMessage/)' | grep -v "/2010-04-01/Accounts/"I recently made it free because I am unable to monetize it. Please give it a try.
What I meant is that by supporting push notifications directly, you can do things like supporting action buttons, open a link when clicking the notification, etc, rather than just XMPP which was what my solution did.
I mean, it's just... a pub/sub server... using HTTP? With a thin UI for web/mobile? I'm obviously missing something, so what is it?
Again, not a hater, even though it may come off like I am, I'm just honestly wondering what makes this special. From first glance it seems like something most devs can hack in an hour or two.
I don't know about others, but the first time I looked into apps, I could make sense of everything until I got to push notifications. Then it became this insanely complicated rabbit hole with a bunch of companies saying they'd solve it for you for 20 bucks a month or whatever. For something that on the surface sounds like it should be dead simple.
So a simple, clean, free way to send a push notification to your phone, that you can use with a web request from anywhere? I can definitely see the mass appeal of that to the millions of people with small projects who don't want to become experts on google/apple's ecosystems just to make some words pop up on their phone.
Personally, the chosen feature set resonates a lot with me. I like services that don't need accounts f.e. because they are so easy to use.
Do you know something better that fills the same gap?
It has Apprise support, so you can use ntfy through that AFAIK.
Anyways, it's amazing that this is free! Very clean, very well done... bravo :)
> You should download Android Studio (or IntelliJ IDEA with the relevant Android plugins). Everything else will just be a pain for you. Do yourself a favor.
I'm not into mobile programming, and I wonder what is behind this statement.
Please elaborate.
You can read more about it below. https://www.verizon.com/about/news/vzw/2013/06/computer-to-p...
Gonna stick this on my home server & add some fw rules to filter out various countries
Though this doesn't work for the public server obviously. The public server doesn't support setting ACLs by users.
They have a free tier too. I keep my alert volumes very low.
E2EE means that it's always encrypted from the sending device to the receiving device and nothing in the middle (including the service operator) can read it.
> Will you know what topics exist, can you spy on me?
> If you don't trust me or your messages are sensitive, run your own server.
This is the way. No pinky promises in whitepaper format[2] that leave out the most important bits, no meticulously constructed but entirely meaningless marketing statements[3][4], but unassuming and deferential logic with a mitigation path.1: https://ntfy.sh/docs/faq/#will-you-know-what-topics-exist-ca...
2: (warning: redirects with identifiers, how ironic) https://www.whatsapp.com/security/WhatsApp-Security-Whitepap...
No promises so they could be selling your info more than anyone else…
> I love free software, and I'm doing this because it's fun. I have no bad intentions, and I will never monetize or sell your information, and this service and software will always stay free and open.
If you're still paranoid (which is your right), go host it yourself, or wait until I finished implementing E2E :-D
Im just wondering why anyone would feel better about an faq that really isn’t much different than anything else.
The application, I’ve no idea/ don’t assume any malicious intent or actions.
Both iOS and Android can run a completionHandler to decrypt them using a private key that can be stolen if the app is disassembled.
But you can generate a private key per user, after install, and each mailbox publisjes a public key.
The thing I find ironic is that the actual encryption is done in JS, which is served by a webserver so anyway you have to trust the webserver. Same as you trust WhatsApp to not send your text to Facebook.
Is there a way around this having to trust an app? Seems the only way to do that would be to have a browser extension or several, that you trust not to collude with a website.
Unfortunately none of that is currently implementable on the web for the reason you cited; the web server can just replace the entire application with any code it wants when you refresh the page. One possible path to fixing that is web packaging[3], but those standards are still in their infancy and don't yet have a mechanism for enforcing binary transparency.
[1]: https://reproducible-builds.org/
[2]: https://developers.google.com/android/binary_transparency
[3]: https://wicg.github.io/webpackage/draft-yasskin-wpack-use-ca...
Because it's not particularly easy to do, and there are a lot of caveats and drawbacks.
Let me rephrase your assumption: "Why couldn't you just mail me the letter in a 100lb safe. In 2022, that's my standard expectation from any service".
So - are you willing to pay to ship 100lbs for every letter you send? Are you meticulously managing the details of how to handle locking and unlocking that safe? Are you working out the details on recovery and storage, handling lost devices, configuring a communication channel for sharing certs/keys, managing several crypto dependencies and libraries - all so that you can go "Hey - what's up!" in a notification to your phone?
Or should you just stop whining - accept that this is free - and take the authors advice and host it yourself?
Clients encrypt data in the browser, share id of the data and key (+ optional password). Some other clients receive id of the data and the key and read it.
For a notification service, you would just need a setup step to generate a key and store it in the browser + on the phone. That said, I'm not sure I understand why would someone need to notify its own phone.
In 2022, there is no need to invent anything new about E2E encryption. There are many successful open-source examples, including Keybase and Firefox Sync.
There is no question that it adds development overhead, but I personally wouldn't even run a public service for others without E2E encryption.
> Or should you just stop whining - accept that this is free - and take the authors advice and host it yourself?
I am not attacking the author, nor do I currently care about this particular service he is providing.
This is Hacker News, a discussion platform, and I am raising a question about software development in general.
Fortunately, it's open-source, so if you really want, you can fork the app to add a decryption layer and then use `curl -d "$(echo "My Message" | openssl enc -aes-256-cbc -pbkdf2 -e -k "My Password")" ntfy.sh/my_topic` and that'll be E2E encrypted.
Or, you know, host your own ntfy server and trust in SSL.
E2E stands in the way in many ways. I have implemented crypto formats and such in the past, and the lack of a standard in this space is really blocking wide spread adoption and interoperability IMHO. That said, I have proposed a design here (https://github.com/binwiederhier/ntfy/issues/69#issuecomment...) that I have already partially implemented, and that seems easy enough to implement in many languages. But it definitely won't be the one-liner anymore.
It is entirely meaningless when the keys are generated by a closed source application, when there exists no way to verify that the data isn't exfiltrated before its encryption or after its decryption, or when the only transportation method is entirely in an untrusted party's hands.
When all those things are controlled by the same entity, especially one with a history of abusive and manipulative behaviour such as the operator of WhatsApp, it's not "encryption" but a "bad joke".
Encrypting stuff isn't hard.
Probably because getting the system together in its current state was enough work.
> In 2022, that's my standard expectation from any service.
You have high standards. Do you expect others to raise their standards as high as yours...?
E2E allows both clients to talk to eachother without server having a way to snoop on
Why couldn't you write a patch to do that, and submit it? Or clone the code and release e2entfy.sh?
The next topic on the FAQ. Also install instructions are provided.