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

basic auth credentials for api #1341

Closed
wants to merge 1 commit into from

Conversation

andrew-ld
Copy link
Contributor

No description provided.

@codecov-commenter
Copy link

Codecov Report

Merging #1341 (8ef6398) into main (455b8be) will decrease coverage by 0.04%.
The diff coverage is 65.00%.

@@            Coverage Diff             @@
##             main    #1341      +/-   ##
==========================================
- Coverage   62.48%   62.44%   -0.05%     
==========================================
  Files         113      113              
  Lines       12020    12027       +7     
==========================================
- Hits         7511     7510       -1     
- Misses       3915     3921       +6     
- Partials      594      596       +2     
Impacted Files Coverage Δ
internal/conf/conf.go 73.70% <ø> (ø)
internal/core/formatprocessor_h264.go 75.43% <ø> (ø)
internal/core/hls_muxer.go 54.30% <ø> (ø)
internal/core/rtmp_conn.go 63.40% <ø> (ø)
internal/core/rtmp_source.go 65.06% <ø> (-2.74%) ⬇️
internal/core/webrtc_conn.go 0.00% <ø> (ø)
internal/hls/client_processor_fmp4.go 65.89% <ø> (ø)
internal/hls/client_processor_mpegts.go 61.24% <ø> (ø)
internal/hls/fmp4/init.go 60.09% <ø> (ø)
internal/hls/fmp4/init_track.go 67.79% <ø> (ø)
... and 13 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@aler9
Copy link
Member

aler9 commented Dec 30, 2022

Hello there are two possible ways to protect the API listener:

  • not protecting the API at all, add a reverse proxy before it and let the reverse proxy handle the authentication.
  • protecting the API, but i think that basic auth will not be enough for a lot of users that will ask for more advanced authentication techniques (separate credentials / JWT / external authentication)

We can certainly work towards the second approach, but keep in mind that handling security directly is not a "best practice" approach since there's a high risk of causing security issues. In my work i always try to avoid developing security components directly, i generally use a series of rugged security components (identity servers, gateways, WFAs, etc) and i put them before my services.

Anyway, we can certainly add a basic security layer to the server too, but i think that basic authentication will not be enough.

@andrew-ld
Copy link
Contributor Author

having a simple level of protection like basic auth would be useful, it would avoid adding additional software such as reverse proxy and its maintenance will still remain almost zero cost since everything is implemented by gin

@eravellaSC
Copy link

If I may ask, is this PR going to be merged? I am working on a system with MediaMTX inside and this feature wuold be very much appreciated.

@aler9
Copy link
Member

aler9 commented Oct 4, 2023

@eravellaSC i'm working on an authentication system that will support explicit credentials, external authentication or JWTs along the entire server, including paths and API.

In the meanwhile, in order to protect the API, you can use a reverse proxy.

@t3therdev
Copy link

Hi @aler9 any update on this.

@andrew-ld
Copy link
Contributor Author

andrew-ld commented Feb 9, 2024

the implementation of jwt seems like something that takes a long time to be completed, many people simply want to block requests to the api via basic auth, this solution however remains very easy to maintain and solves many of the cases

@aler9
Copy link
Member

aler9 commented Feb 27, 2024

replaced by #3081

@aler9 aler9 closed this Feb 27, 2024
aler9 added a commit that referenced this pull request Mar 4, 2024
This is a new authentication system that covers all the features exposed by the server, including playback, API, metrics and PPROF, improves internal authentication by adding permissions, improves HTTP-based authentication by adding the ability to exclude certain actions from being authenticated, adds an additional method (JWT-based authentication).
Copy link
Contributor

github-actions bot commented Mar 4, 2024

This issue is mentioned in release v1.6.0 🚀
Check out the entire changelog by clicking here

@github-actions github-actions bot locked and limited conversation to collaborators Sep 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants