idi527
I’m playing around with nginx-rtmp module (here’s a more active fork) and I’m wondering what is the correct way of restricting access to it?
I imagined a flow like this:
- a user connects to a socket (phoenix) with a token
Phoenix.Tokenverifies the user’s id- user is fetched from the database and assigned to the socket
- some time later the user can join a channel like
user:#{user_id}and ifuser_idis the same asuser.idstored in assigns, this user becomes the broadcaster for this channel and receives a link to where to push his/her rtmp stream. - at this point I start having troubles, how would I verify on nginx side that the stream coming to it is actually from the broadcaster and not some cracked cctv? how would I also forbid any “naughty” rtmp stream to an url that has not been received from
user:#{user_id}channel?
I was thinking maybe jwt but I am not sure since I haven’t had any experience with them.
I guess what I am asking is, how something like this generally works?
Should I keep all the rtmp links that have been sent from the channel in some kind of registry and redirect the first rtmp push to nginx-rtmp through this registry which would put an “authorisation” header in the request, so that nginx-rtmp would then check it?
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #hex
- #security











Showing Posts 1 to 3- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
idi527
There is an example in readme
I wonder if that can help me …
idi527
Somehow I failed to do a proper google search.
There’s a module in php/python [0] that maybe solves my problem and an issue [1] with more links [2][3].
[0] GitHub - Nesseref/nginx-rtmp-auth: Backend for handling nginx rtmp module stream authentication · GitHub
[1] Does nginx-rtmp-module has authentication · Issue #798 · arut/nginx-rtmp-module · GitHub
[2] http://helping-squad.com/nginx-rtmp-secure-your-nginx-server/
[3] Redirecting to Google Groups
I wonder if this is a better approach then jwt though.
tcbyrd
The general approach for securing RTMP is to use Stream Keys that are unique to the user account. This works basically the same as an API token, meaning if the key is present in the RTMP URL it will accept the stream. It also means you should typically give the user an option to refresh the token if they feel it’s been compromised for some reason.
Depending on the use case and audience, this is usually the better option than trying to tie it directly to a logged in user. For a lot of broadcasters, it’s common for your RTMP feed to come from external streaming equipment such as a Cerevo LiveShell, which may not even have an HTTP client. JWT usually implements with a timeout as well, which will refresh the token and could interrupt the stream.
You may find this article on implementing Stream Keys with Django helpful.