Created
April 23, 2020 19:23
-
-
Save half2me/dfa35245016a2e0f1fe969bd490d1187 to your computer and use it in GitHub Desktop.
RTSP authentication with python and gst-rtsp-server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server = GstRtspServer.RTSPServer() | |
auth = GstRtspServer.RTSPAuth() | |
token = GstRtspServer.RTSPToken() | |
token.set_string('media.factory.role', "user") | |
basic = GstRtspServer.RTSPAuth.make_basic("user", "password") | |
auth.add_basic(basic, token) | |
server.set_auth(auth) | |
factory = RtspFactory() | |
permissions = GstRtspServer.RTSPPermissions() | |
permissions.add_permission_for_role("user", "media.factory.access", True) | |
permissions.add_permission_for_role("user", "media.factory.construct", True) | |
factory.set_permissions(permissions) |
@siretru I've never tried, but looking at the auth class: https://lazka.github.io/pgi-docs/GstRtspServer-1.0/classes/RTSPAuth.html it seems to have options for TLS.
That's what I'm trying to do.
The problem is that in the implemented c code I've shared, I manage to consume the stream with authentication enabled. When I activate TLS, there's no way of consuming the stream...
Thanks for your answer
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
I really appreciate this piece of code and sharing it.
Given your knowledge of this subject, I was wondering if you had any idea how difficult it would be to implement a gstRtspServer.RTSPServer() using TLS? There's a GStreamer example here implementing this functionality in C: GStreamer RTSP server with TLS
Unfortunately I haven't managed to translate this into python...