Red5 RTMPS与自签名证书的连接失败

时间:2014-11-20 09:11:03

标签: red5 self-signed rtmps

我正在使用Red5 1.0.3,并尝试使用自签名证书通过端口8443完成RTMPS。

我已经做过的事情:

  • 在conf / red5-core.xml中启用RTMPS
  • 将我的自签名证书添加到密钥库和信任库
  • 确认密钥库和信任库的密码是正确的(这是一个测试,因此为简单起见,密码是相同的)
  • 通过在浏览器中接受例外(在Ubuntu上使用Chrome)解决了“不受信任的证书”问题
  • 确保Red5正在侦听8443且端口可连接

我尝试连接Red5时,浏览器中的下一个障碍是“空响应”。

来自Red5日志:

[DEBUG] [NioProcessor-30] org.red5.server.net.rtmps.RTMPSMinaIoHandler - SSL provider is: SunJSSE version 1.7
[DEBUG] [NioProcessor-30] org.red5.server.BaseConnection - New BaseConnection - type: persistent
[DEBUG] [NioProcessor-30] org.red5.server.BaseConnection - Generated session id: 7DTVIWZ5UXILR
[DEBUG] [NioProcessor-30] org.red5.server.net.rtmp.RTMPConnection - startWaitForHandshake - 7DTVIWZ5UXILR
[DEBUG] [NioProcessor-30] org.red5.server.net.rtmp.RTMPMinaIoHandler - Session opened: 77 id: 7DTVIWZ5UXILR
[DEBUG] [NioProcessor-30] org.red5.server.net.rtmp.RTMPMinaIoHandler - Session closed: 77 id: 7DTVIWZ5UXILR
[DEBUG] [NioProcessor-30] org.red5.server.net.rtmp.BaseRTMPHandler - connectionClosed: 7DTVIWZ5UXILR
[DEBUG] [NioProcessor-30] org.red5.server.net.rtmp.RTMPConnection - close: 7DTVIWZ5UXILR
[DEBUG] [NioProcessor-30] org.red5.server.net.rtmp.RTMPConnection - State: connect
[DEBUG] [NioProcessor-30] org.red5.server.api.Red5 - Set connection: 7DTVIWZ5UXILR with thread: NioProcessor-30
[DEBUG] [NioProcessor-30] org.red5.server.net.rtmp.RTMPConnection - Stream service was not found for scope: null or non-existant
[DEBUG] [NioProcessor-30] org.red5.server.BaseConnection - Close, not connected nothing to do
[DEBUG] [NioProcessor-30] org.red5.server.net.rtmp.RTMPConnection - Shutting down scheduler
[DEBUG] [NioProcessor-30] org.red5.server.net.rtmp.RTMPConnection - Scheduler - shutdown: true queued: 0
[DEBUG] [NioProcessor-30] org.red5.server.net.rtmp.RTMPConnection - Shutting down executor
[DEBUG] [NioProcessor-30] org.red5.server.net.rtmp.RTMPConnection - Executor - shutdown: true queued: 0
[DEBUG] [NioProcessor-30] org.red5.server.net.rtmp.RTMPMinaConnection - IO Session closing: true
[DEBUG] [NioProcessor-30] org.red5.server.net.rtmp.RTMPMinaConnection - Connection state: RTMP [state=disconnecting, encrypted=false, readChunkSize=128, writeChunkSize=128, encoding=AMF0]
[DEBUG] [NioProcessor-30] org.red5.server.net.rtmp.BaseRTMPHandler - connectionClosed: 7DTVIWZ5UXILR
[DEBUG] [NioProcessor-30] org.red5.server.api.Red5 - Set connection: null with thread: NioProcessor-30
[DEBUG] [NioProcessor-31] org.red5.server.net.rtmps.RTMPSMinaIoHandler - SSL provider is: SunJSSE version 1.7
[DEBUG] [NioProcessor-31] org.red5.server.BaseConnection - New BaseConnection - type: persistent
[DEBUG] [NioProcessor-31] org.red5.server.BaseConnection - Generated session id: UB7GI0V7POCE2
[DEBUG] [NioProcessor-31] org.red5.server.net.rtmp.RTMPConnection - startWaitForHandshake - UB7GI0V7POCE2
[DEBUG] [NioProcessor-31] org.red5.server.net.rtmp.RTMPMinaIoHandler - Session opened: 78 id: UB7GI0V7POCE2
[DEBUG] [NioProcessor-31] org.red5.server.api.Red5 - Get connection on thread: NioProcessor-31
[DEBUG] [NioProcessor-31] org.red5.server.api.Red5 - Set connection: UB7GI0V7POCE2 with thread: NioProcessor-31
[DEBUG] [NioProcessor-31] org.red5.server.net.rtmp.codec.RTMPProtocolDecoder - decodeHandshake - state: RTMPDecodeState [sessionId=UB7GI0V7POCE2, decoderState=0, decoderBufferAmount=0] buffer: HeapBuffer[pos=0 lim=377 cap=1536: 50 4F 53 54 20 2F 6F 70 65 6E 2F 31 20 48 54 54...]
[DEBUG] [NioProcessor-31] org.red5.server.net.rtmp.codec.RTMPProtocolDecoder - Handshake init too small, buffering. remaining: 377
[DEBUG] [NioProcessor-31] org.red5.server.api.Red5 - Set connection: null with thread: NioProcessor-31
[WARN] [RTMPConnectionExecutor#14164738195671] org.red5.server.net.rtmp.RTMPConnection - Closing UB7GI0V7POCE2, due to long handshake. State: connect
[DEBUG] [RTMPConnectionExecutor#14164738195671] org.red5.server.net.rtmp.RTMPConnection - close: UB7GI0V7POCE2
[DEBUG] [RTMPConnectionExecutor#14164738195671] org.red5.server.net.rtmp.RTMPConnection - State: connect
[DEBUG] [RTMPConnectionExecutor#14164738195671] org.red5.server.api.Red5 - Set connection: UB7GI0V7POCE2 with thread: RTMPConnectionExecutor#14164738195671
[DEBUG] [RTMPConnectionExecutor#14164738195671] org.red5.server.net.rtmp.RTMPConnection - Stream service was not found for scope: null or non-existant
[DEBUG] [RTMPConnectionExecutor#14164738195671] org.red5.server.BaseConnection - Close, not connected nothing to do
[DEBUG] [RTMPConnectionExecutor#14164738195671] org.red5.server.net.rtmp.RTMPConnection - Shutting down scheduler
[DEBUG] [RTMPConnectionExecutor#14164738195671] org.red5.server.net.rtmp.RTMPConnection - Scheduler - shutdown: true queued: 0
[DEBUG] [RTMPConnectionExecutor#14164738195671] org.red5.server.net.rtmp.RTMPConnection - Shutting down executor
[DEBUG] [RTMPConnectionExecutor#14164738195671] org.red5.server.net.rtmp.RTMPConnection - Executor - shutdown: true queued: 0
[DEBUG] [RTMPConnectionExecutor#14164738195671] org.red5.server.net.rtmp.RTMPMinaConnection - IO Session closing: false
[DEBUG] [NioProcessor-31] org.red5.server.net.rtmp.RTMPMinaIoHandler - Session closed: 78 id: UB7GI0V7POCE2
[DEBUG] [NioProcessor-31] org.red5.server.net.rtmp.BaseRTMPHandler - connectionClosed: UB7GI0V7POCE2
[DEBUG] [NioProcessor-31] org.red5.server.api.Red5 - Set connection: null with thread: NioProcessor-31
[DEBUG] [RTMPConnectionExecutor#14164738195671] org.red5.server.net.rtmp.RTMPMinaConnection - Connection close future: org.apache.mina.core.future.DefaultCloseFuture@41fb8175
[DEBUG] [RTMPConnectionExecutor#14164738195671] org.red5.server.net.rtmp.RTMPMinaConnection - Connection is closed
[WARN] [RTMPConnectionExecutor#14164738195671] org.red5.server.net.rtmp.RTMPConnManager - Connection not found for UB7GI0V7POCE2
[DEBUG] [RTMPConnectionExecutor#14164738195671] org.red5.server.net.rtmp.RTMPMinaConnection - Connection state: RTMP [state=disconnected, encrypted=false, readChunkSize=128, writeChunkSize=128, encoding=AMF0]

连接只是关闭。 经过对Wireshark的仔细检查,我发现了一个加密警报(21),根据我的理解,这意味着解密失败。还没有提示为什么它失败了,但确实如此。

在浏览器(Flash客户端)中,控制台输出

POST https://10.32.1.218:8443/open/1 net::ERR_EMPTY_RESPONSE 10.32.1.218:8443/open/1:1
DEBUG: Flash says: NetworkManager: NetConnection.Connect.Failed 

在阅读Red5 and RTMPS self-signed certificate之后,我继续使用真实证书(来自StartCom),但在使用该证书连接到Red5时,我收到了

javax.net.ssl.SSLHandshakeException: SSL handshake failed.
Caused by: javax.net.ssl.SSLHandshakeException: no cipher suites in common

我尝试使用-keyalg RSA(显式)将证书重新添加到密钥库和信任库中,但这没有帮助。

现在回到自签名证书......无论如何。

么?也许客户端不接受不受信任的证书并且在握手时超时? 任何要往下看的新路径都会受到赞赏。

更新

更新Flash客户端并设置NetConnection属性proxyType = "best"后,Flash现在输出NetworkManager: NetConnection.Connect.SSLHandshakeFailed

更新II

我意识到我错误地将证书添加到密钥库和信任库。我已经将密钥添加到密钥库而没有添加他们的私钥。

为此,我使用了以下answer

我也从自签名证书转移到CA签名证书。自签的问题不值得为我的情况解决。

0 个答案:

没有答案