Skip to content

Commit 9b36d4e

Browse files
committed
feat: require RM admin for certain operations
1 parent 4c4269b commit 9b36d4e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/rmmtxauthz/web/mediamtx.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ async def get_auth(authreq: MTXAuthReq) -> Response:
2323
if authreq.password != dbuser.mtxpassword:
2424
LOGGER.error("Wrong password for {}".format(authreq.user))
2525
raise HTTPException(status_code=403)
26+
# Operations that require admin privileges
27+
if authreq.action in ("api", "metrics", "pprof") and not dbuser.is_rmadmin:
28+
LOGGER.error("{} is not admin requesting {}".format(authreq.user, authreq.action))
29+
raise HTTPException(status_code=403)
2630
return Response(status_code=204)
2731
except (NotFound, Deleted) as exc:
2832
LOGGER.error("Invalid user {}: {}".format(authreq.user, exc))

0 commit comments

Comments
 (0)