-
Notifications
You must be signed in to change notification settings - Fork 107
Proposal to add support for RFC 7714 SRTP with AES-GCM #420
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
base: development
Are you sure you want to change the base?
Conversation
…protocol negotiation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding support for multiple signature algorithm is a good idea.
However the proposal has two issues:
Minor: for backward compatibility reasons SecureRTSPStreamingAlgorithms may not be present for old devices.
Major: Inserting a parameter is a breaking change. We have never appended a parameter. Doing so would need a compatibility assessment.
…ecurity protocol negotiation" This reverts commit d40607a.
The proposal has changed significantly since. There are now no changes to the StreamingCapabilities. |
…ANA SRTP Crypto Suite Registrations.
This approach is not RFC-compliant, RFC 4567 explicitly forbids using multiple
Few possible alternatives which better follows RFCs:
BTW, MIKEY protocol can be used in different ways. Existing RTSP implementations with SRTP support use in are not compatible with each others and have some details wrong (send concatenated key and salt as TEK instead of separate as TEK+SALT). I listed all discovered differences here: #436 . Make sure to review them and add necessary clarifications here to avoid ambiguities and incompatible implementations in the future. |
Thank you, we will revise the proposal. |
Few more thoughts about this:
Please also check how Genetec handles SRTP. It has its own extension to ONVIF for this, and performs key exchange in RTSP 2.0 way (client is initiator) while using RTSP 1.0 headers. It also specifies rekeying procedure. |
@jcbeaulieu is this still in rework? |
@kieran242, Yes, I wanted to discuss it during the meeting. |
We've changed the proposal to configure the algorithm negotiation in ONVIF itself. For GetStreamUri, no any parameter has been defined, so a GetStreamUri2 has been added. @sirzooro, I've added clarification that the MKI must be used and an example for session opening. |
@jcbeaulieu RFC 3830 at the end of sections 3.1 (PSK) and 3.2 (PK) have sentence "It is MANDATORY to implement this method." Also keep in mind that PSK was intended to send keys in encrypted format. MIKEY-NULL is a special case of MIKEY-PSK. Some note that we do not use encryption and authentication intentionally would be good. SSRC=0: section 6.1.1 of RFC 3830 contains this:
Key type sent in Key - Table 6.13.a in RFC 3830 specifies both TEK and TEK+SALT versions, so TEK+SALT seems better choice to send key and salt, instead of concatenating them and send as TEK. GStreamer internally concatenates them, so maybe someone just sent them both as-is as TEK. General Extension Payload with SDP IDs type probably is not an issue. As RTSP allows to use only one key management protocol, bidding-down attack cannot be performed as described in RFC 4567. |
Hello @sirzooro, For section 3.2 of RFC3830, I would like to explicitly propose in the streaming document that MIKEY-PK should not be used for ONVIF. MIKEY-PSK and initiation of SRTP should only be done using RTSPS, which would protect the key. I worry that implementing MIKEY-PSK would be a waste of time since:
For MIKEY-NULL , it seems like it should only be used for SIP. "Note that this MUST NOT be used unless Would these proposals be acceptable? For the MIKEY key data sub-payload, I know that Genetec uses TEK only and that many devices work with TEK. |
I am OK with a note in ONVIF spec that MIKEY-PK is not supported. SRTP adoption in ONVIF cameras is not very common now - I did some research about year ago and at that time I was able to find some public documentation about Axis, Bosch and Hikvision cameras only. Probably other brands relied on media tunneling over SRTSP or RTSP/HTTPS to provide encryption. Incompatible implementations of open source clients also supports claim that SRTP in RTSP was/is not popular option.
The key part here is "Note that this MUST NOT be used unless the underlying protocols can guarantee security". RTSP over TLS (RTSPS) provide it. Genetec docs also says something similar, that TLS is used so additional encryption and authentication of data in Key payload is not needed. So please add note in ONVIF spec that full MIKEY-PSK is not supported and MIKEY-NULL is used because TLS is used. Also please add requirement that use of SRTP and MIKEY key exchange require use of SRTCP or tunneling over secure protocol (RTSP over HTTPS). "None" option may be useful like you wrote. Please add clarification that it means plain RTP and not NULL SRTP cipher - with latter one server still has to send MKI and authentication tag for SRTP, and use encryption/MKI/AuthTag with SRTCP. Current wording is a bit misleading here.
What is unclear here is whether key and salt should be sent using TEK+SALT format (Type field set to 3, key and salt in separate fields in Key payload), or using TEK (Type field set to 2, key and salt concatenated and sent in Key data field). Please add note which one should be used. |
Thanks! Most things are clear now. One missing point is that encryption key and encryption salt should be concatenated before inserting into Key subpayload. I also noticed one typo, sohuld->should. |
In Genetec's implementation there is no salt, only the key data. |
GStreamer internally stores concatenated key+salt in capabilities Genetec uses Master Key with 128 bits and Master Salt with 112 bits, so definitely they have salt too. They just expect both to be concatenated and put in Key subpayload with Type set to TEK. |
You're right. I've tested with some cameras and sending a TEK+SALT MIKEY makes the camera return seemingly unencrypted packets (No MKI). |
I have changed the SRTP configuration from StreamingCapabilities and GetStreamUri2 to the encoder configurations, for audio, video and metadata for both media 1 and media 2. Streaming specification XML changes are still ongoing and were not included in the latest commit. |
Fixed optional attribute for SecureStreamingProtocolAlgorithms
Hi @jcbeaulieu, what are your plans for this PR? We are still have few points to address:
In last few days I also noticed few new issues to clarify:
Edit: I have decoded MIKEY message examples and checked them. In ones for |
Hello @sirzooro, I plan on requiring TEK for AES-CM-128-HMAC-SHA1 since it's what is already used for cameras deployed, but I'd like to force TEK + SALT for the other algorithms to clearly delineate the key from the salt as some other algorithms may be more flexible than AES-GCM in the future. AEGIS comes to mind. (https://datatracker.ietf.org/doc/draft-irtf-cfrg-aegis-aead/) If I understand correctly, ONVIF does not officially support stating multiple streams with the same RTSP session (Aggregate control). Is this correct @HansBusch? I will add the 463 error code and the server selected SSRC in SETUP note to the documentation. SRTCP is not defined by our internal SRTP whitepaper and to my knowledge, has never been used or tested in an ONVIF device. |
Ok, makes sense.
RTCP is needed to properly synchronize video and audio streams. Receiver Reports also may be used for diagnostics at server side. Plus for extended feedback when AVPF/SAVPF profile is negotiated. And last very important role, RTCP packets also serve as a session keep-alive packets. GStreamer RTSP client does not use correct key+salt to encrypt SRTCP, so these packets are dropped by server because authentication tag is invalid, and as a result RTSP session times out. GStreamer RTSP client would have to be configured to repeatedly send RTSP requests to keep session alive. This may be common issue for RTSP clients and servers. When RTCP works but SRTCP not, it may be considered a regression. |
ONVIF may require RTSP sessions with single stream and certified devices surely supports this. However there are also non-certified ONVIF devices which may work differently. I am aware of some video encoder with broken RTSP server, it sent 200 OK responses when client tried to start audio-only session and did not send any RTP frame with audio. That encoder properly sent audio when it was in one session with video. Despite this but it worked with at least some ONVIF software. Edit: regarding SRTCP we can have something like "RTCP support is optional. When device supports RTCP, it should also support SRTCP" plus details necessary for SRTCP implementation. Edit2: sometimes customers add camera to one VMS in ONVIF mode and as RTSP stream to other one(s). Please add new SDP attribute (e.g. |
I have noticed that there is streaming capability "MultiTrackStreaming - Indicates support for multiple video RTP streams in one RTSP session.". So multiple streams in one RTSP sessions are supported, although for different use case (multiple video streams instead of video+audio). |
@jcbeaulieu Given the PR #555 is this PR still valid? Can it be closed or is it still required? |
Hello @kieran242, it can be closed. Work will continue in PR #555 |
Proposal for cryptographic algorithm negotiation to add support for RFC 7714 SRTP AES-GCM.
Reason:
EU governments will start forbidding SHA-1 starting 2025 December 31.
RFC 3711 defines an 80 bit SHA-1 authentication tag, which will be forbidden.
Using AES-CM (Counter Mode) without an authentication tag is insecure and forbidden by FIPS.
Compatibility analysis:
Devices that do not support the feature will not include the SecureRTSPStreamingAlgorithms in the StreamingCapabilities.
Clients that do not support the feature will not include the SecurityProtocolAlgorithm the GetStreamUri.
When either a client or device does not support the feature, AES-128-CM-SHA1_80 is implied. (As defined in RFC 3711).