RTSP Authentication negotiation fails

Hi, I’m trying to stream an IP Cam via RTSP.
While authenticating, the streaming plugin fails to negotiate the WWW-Authenticate header correctly.

Meetecho Janus (WebRTC Server) v1.1.4

root@cb7f2c9b3742:/ dpkg -l | grep -i curl
ii  libcurl4:amd64              7.74.0-1.3+deb11u7             amd64        easy-to-use client-side URL transfer library (OpenSSL flavour)

The mobotix cam tells the client (janus) it wants digest auth, the client ignores this, auth fails and the source is skipped:

Loading plugin 'libjanus_streaming.so'...
JANUS Streaming plugin created!
Configuration file: /usr/local/etc/janus/janus.plugin.streaming.jcfg
[janus.plugin.streaming.jcfg]
    general: {
        rtp_port_range: 10001-10070
    }
    rtsp-test: {
        type: rtsp
        id: 126
        description: RTSP Test
        audio: false
        video: true
        url: rtsp://[REDACTED]:9200/stream/profile0
        rtsp_user: test
        rtsp_pwd: test1234
        rtsp_reconnect_delay: 5
        rtsp_session_timeout: 60
        rtsp_timeout: 60
        rtsp_conn_timeout: 60
        videocodec: vp8
    }
Streaming RTP/RTCP port range: 10002 -- 10070

*   Trying [REDACTED]:9200...
* Connected to [REDACTED] ([REDACTED]) port 9200 (#0)
> DESCRIBE rtsp://[REDACTED]:9200/stream/profile0 RTSP/1.0
CSeq: 1
Accept: application/sdp

< RTSP/1.0 401 Unauthorized
< CSeq: 1
< Date: Wed, Sep 06 2023 13:01:11 GMT
< WWW-Authenticate: Digest realm="MOBOTIX Camera User", nonce="45cd93f0206dda91ef6d52140a479906"
< 
* Connection #0 to host [REDACTED] left intact
* Issue another request to this URL: 'rtsp://[REDACTED]:9200/stream/profile0'
* Found bundle for host [REDACTED]: 0x55aa11dbfea0 [serially]
* Re-using existing connection! (#0) with host [REDACTED]
* Connected to [REDACTED] ([REDACTED]) port 9200 (#0)
> DESCRIBE rtsp://[REDACTED]:9200/stream/profile0 RTSP/1.0
CSeq: 2
Accept: application/sdp

< RTSP/1.0 401 Unauthorized
< CSeq: 2
< Date: Wed, Sep 06 2023 13:01:11 GMT
* Authentication problem. Ignoring this.
< WWW-Authenticate: Digest realm="MOBOTIX Camera User", nonce="e0fdcac1308b3ad10a5171c258380614"
< 
* Connection #0 to host [REDACTED] left intact


e[31m[ERR]e[0m [plugins/janus_streaming.c:janus_streaming_rtsp_connect_to_server:7914] Couldn't get DESCRIBE code: 401
e[31m[ERR]e[0m [plugins/janus_streaming.c:janus_streaming_init:2761] Error creating 'rtsp' mountpoint 'rtsp-test'...
JANUS Streaming plugin initialized!
	Version: 10 (0.0.10)
	   [janus.plugin.streaming] JANUS Streaming plugin
	   This is a streaming plugin for Janus, allowing WebRTC peers to watch/listen to pre-recorded files or media generated by an external source.
	   Plugin API version: 102

Trying this with other clients looks like this, DESCRIBE: 401 → Digest → DESCRIBE: description

[client:rtsp] RTSP/1.0 200 OK
CSeq: 1
Date: Wed, Sep 06 2023 11:53:46 GMT
Public: OPTIONS, DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, GET_PARAMETER, SET_PARAMETER

[client:rtsp] DESCRIBE rtsp://[REDACTED]:9200/stream/profile0 RTSP/1.0
Accept: application/sdp
CSeq: 2
User-Agent: SFRtsp 0.3

[client:rtsp] RTSP/1.0 401 Unauthorized
CSeq: 2
Date: Wed, Sep 06 2023 11:53:46 GMT
WWW-Authenticate: Digest realm="MOBOTIX Camera User", nonce="6a6f521f76a71d35e7f6e4774c828c11"

[client:rtsp] Digest realm="MOBOTIX Camera User", nonce="6a6f521f76a71d35e7f6e4774c828c11" 

[client:rtsp] DESCRIBE rtsp://[REDACTED]:9200/stream/profile0 RTSP/1.0
Accept: application/sdp
CSeq: 3
User-Agent: SFRtsp 0.3
Authorization: Digest username="test", realm="MOBOTIX Camera User", nonce="6a6f521f76a71d35e7f6e4774c828c11", uri="rtsp://[REDACTED]:9200/stream/profile0", response="5775ac4658fccbd2164cb4bf64973953"

[client:rtsp] RTSP/1.0 200 OK
CSeq: 3
Date: Wed, Sep 06 2023 11:53:46 GMT
Content-Base: rtsp://[REDACTED]:9200/stream/profile0/
Content-Type: application/sdp
Content-Length: 458

v=0
o=- 1693991924053286 1 IN IP4 [REDACTED]
s=Mobotix IP-Camera
i=Profile profile0
t=0 0
a=tool:LIVE555 Streaming Media vmxrtp
a=type:broadcast
a=control:*
a=range:npt=0-
a=x-qt-text-nam:Mobotix IP-Camera
a=x-qt-text-inf:Profile profile0
m=video 0 RTP/AVP 96
c=IN IP4 0.0.0.0
b=AS:2000
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1;profile-level-id=424020;sprop-parameter-sets=Z0JAIKaAUAeZ,aM48gA==
a=control:track1
a=recvonly

Update libcurl, it was a problem there and it was solved.

1 Like

Using sucwangsr/janus-webrtc-gateway-docker:1.2.0 I only get libcurl4:amd64@7.81.0-1ubuntu1.13 as a packaged version.

Building libcurl from source (curl 8.3.0 (x86_64-pc-linux-gnu) libcurl/8.3.0 OpenSSL/3.0.2 zlib/1.2.11 brotli/1.0.9 libidn2/2.3.2 libpsl/0.21.0 (+libidn2/2.3.2) ) however, resolves the issue indeed.

Are there any recommended / up-to-date docker images which make sense to use for a production environment, or is building your own the right way?

Hi,
I’m having the exact same problem described here, not only with a mobotix camera, but also with an Axis camera.

I have curl and libcurl 7.81.0 which is the latest available version in my version of Ubuntu. I tried manually building curl 8.3.0, but it did not fix my problem.

I’m sending the following json through the Janus websocket connection:
{“janus”:“message”,“apisecret”:“randomstring”,“admin_secret”:“supersecretadminkey”,“transaction”:“1234”,“session_id”:8368737503644488,“handle_id”:8070250175089605,“body”:{“admin_key”:“supersecretadminkey”,“type”:“rtsp”,“request”:“create”,“id”:1221,“audio”:false,“video”:true,“videocodec”:“h264”,“url”:“rtsp://[REDACTED]:554/stream/profile0”,“rtsp_user”:“[REDACTED]”,“rtsp_pwd”:“[REDACTED]”}}

Which creates the following logging in my Janus:

[Wed Nov 27 14:05:36 2024] [8070250175089605] There's a message for JANUS Streaming plugin
[Wed Nov 27 14:05:36 2024] Audio NOT enabled, Video enabled
[Wed Nov 27 14:05:36 2024] Missing name, will generate a random one...
*   Trying [REDACTED]:554...
* Connected to [REDACTED] ([REDACTED]) port 554 (#0)
> DESCRIBE rtsp://[REDACTED]:554/stream/profile0 RTSP/1.0
CSeq: 1
Accept: application/sdp

< RTSP/1.0 401 Unauthorized
< CSeq: 1
< Date: Wed, Nov 27 2024 13:04:21 GMT
< WWW-Authenticate: Digest realm="MOBOTIX Camera User", nonce="0367d7e8dab24f1aa9324b5db76423f6"
<
* Connection #0 to host [REDACTED] left intact
* Issue another request to this URL: 'rtsp://[REDACTED]:554/stream/profile0'
* Found bundle for host [REDACTED]: 0xffff0c005ec0 [serially]
* Re-using existing connection! (#0) with host [REDACTED]
* Connected to [REDACTED] ([REDACTED]) port 554 (#0)
> DESCRIBE rtsp://[REDACTED]:554/stream/profile0 RTSP/1.0
CSeq: 2
Accept: application/sdp

< RTSP/1.0 401 Unauthorized
< CSeq: 2
< Date: Wed, Nov 27 2024 13:04:21 GMT
* Authentication problem. Ignoring this.
< WWW-Authenticate: Digest realm="MOBOTIX Camera User", nonce="9132faf71259abf0f048a14f1dedda0f"
<
* Connection #0 to host [REDACTED] left intact
[Wed Nov 27 14:05:36 2024] [ERR] [plugins/janus_streaming.c:janus_streaming_rtsp_connect_to_server:8163] Couldn't get DESCRIBE code: 401
[Wed Nov 27 14:05:36 2024] [ERR] [plugins/janus_streaming.c:janus_streaming_process_synchronous_request:4157] Error creating 'rtsp' stream...

Nevermind my previous post. I found this link https://github.com/meetecho/janus-gateway/issues/3038#issuecomment-1222096474 and downgraded my curl and libcurl version to version 7.68.0 and the problem is now fixed.

1 Like

7.79.0 broke RTSP authentication. IIRC it was solved only after 7.87.0.

1 Like