将 SSL/HTTPS 用于动态视频流
Using SSL/HTTPS with Motion Video Streaming
是否可以使用动作创建安全连接?我使用 Apache 将我的动态流嵌入到 HTML 页面上,但它不会显示,因为它是安全页面上的不安全 iframe。我可以在
查看动态流
http://example.com:<Motion-Port>
但是
处的嵌入视频
https://example.com
不会显示。
iFrame代码:
<iframe src="http://example.com:<Motion-Port>" width="1300" height="740"></iframe>
答案是不使用动效。它没有在 3 years! Use ZoneMinder or iSpy 中更新。
之前检查过这个
是的,先生 -- 你完全可以做到这一点 -- 但光靠动作是做不到的。运动只做最少的授权。本质上,它归结为 你需要一些东西来代理 http 流,并将其包装在 ssl 中。
node 中有一个有点过时的包,称为 mjpeg-proxy,您可以将其用作中间件。 https://github.com/vizzyy-org/mothership/blob/master/routes/cam.js#L27
在 java 中,您可以做同样的事情:调用您的网络服务器,该服务器调用运动流,然后将整个内容包装在 ssl 连接中返回给客户端。 https://github.com/vizzyy-org/spring_react/blob/master/src/main/java/vizzyy/controller/VideoController.java#L54
最后,您可以使用 ngix 或 apache2 完成此操作。在 apache 中,它就像设置相互身份验证然后代理到流一样简单。这是我的 2 路 ssl 包装我的流的 apache 配置
<VirtualHost *:443>
ServerAdmin somehost
SSLEngine on
SSLProtocol -all +TLSv1.2 +TLSv1.3
SSLHonorCipherOrder on
SSLCipherSuite ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AE$
SSLCompression off
SSLSessionTickets off
SSLCertificateFile server-cert.pem
SSLCertificateKeyFile server-key.pem
SSLVerifyClient require
SSLCACertificateFile "ca-bundle-client.crt"
ProxyPass "/video" "http://stream.local:9002"
ProxyPassReverse "/video" "http://stream.local:9002"
</VirtualHost>
请务必注意,上述所有三个选项都必须出现在您的 LAN/VPC/Locally 中,否则您将公开您的流。 您必须在其中代理它您信任的网络,然后将包装后的流暴露给外部网络。
Motion 仍在积极维护here(最后一次提交是在 25 天前),我也遇到了类似的问题。
Motion 允许我们通过 following settings:
使用 HTTPS
# for web UI
webcontrol_tls on
webcontrol_cert /full/path/to/motion.crt
webcontrol_key /full/path/to/motion.key
# only for streams
# requires webcontrol_cert & webcontrol_key
stream_tls on
对于本地需求,您可以像我一样将其与 self-signed 证书一起使用:
sudo apt -y install openssl
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -out motion.crt -keyout motion.key
sudo chmod motion:motion motion.crt
sudo chmod motion:motion motion.key
然后如上所述编辑motion.conf
并重新启动它。
注意:Motion 将仅提供 HTTPS。
希望对大家有帮助。
是否可以使用动作创建安全连接?我使用 Apache 将我的动态流嵌入到 HTML 页面上,但它不会显示,因为它是安全页面上的不安全 iframe。我可以在
查看动态流http://example.com:<Motion-Port>
但是
处的嵌入视频https://example.com
不会显示。
iFrame代码:
<iframe src="http://example.com:<Motion-Port>" width="1300" height="740"></iframe>
答案是不使用动效。它没有在 3 years! Use ZoneMinder or iSpy 中更新。
之前检查过这个是的,先生 -- 你完全可以做到这一点 -- 但光靠动作是做不到的。运动只做最少的授权。本质上,它归结为 你需要一些东西来代理 http 流,并将其包装在 ssl 中。
node 中有一个有点过时的包,称为 mjpeg-proxy,您可以将其用作中间件。 https://github.com/vizzyy-org/mothership/blob/master/routes/cam.js#L27
在 java 中,您可以做同样的事情:调用您的网络服务器,该服务器调用运动流,然后将整个内容包装在 ssl 连接中返回给客户端。 https://github.com/vizzyy-org/spring_react/blob/master/src/main/java/vizzyy/controller/VideoController.java#L54
最后,您可以使用 ngix 或 apache2 完成此操作。在 apache 中,它就像设置相互身份验证然后代理到流一样简单。这是我的 2 路 ssl 包装我的流的 apache 配置
<VirtualHost *:443>
ServerAdmin somehost
SSLEngine on
SSLProtocol -all +TLSv1.2 +TLSv1.3
SSLHonorCipherOrder on
SSLCipherSuite ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AE$
SSLCompression off
SSLSessionTickets off
SSLCertificateFile server-cert.pem
SSLCertificateKeyFile server-key.pem
SSLVerifyClient require
SSLCACertificateFile "ca-bundle-client.crt"
ProxyPass "/video" "http://stream.local:9002"
ProxyPassReverse "/video" "http://stream.local:9002"
</VirtualHost>
请务必注意,上述所有三个选项都必须出现在您的 LAN/VPC/Locally 中,否则您将公开您的流。 您必须在其中代理它您信任的网络,然后将包装后的流暴露给外部网络。
Motion 仍在积极维护here(最后一次提交是在 25 天前),我也遇到了类似的问题。
Motion 允许我们通过 following settings:
使用 HTTPS# for web UI
webcontrol_tls on
webcontrol_cert /full/path/to/motion.crt
webcontrol_key /full/path/to/motion.key
# only for streams
# requires webcontrol_cert & webcontrol_key
stream_tls on
对于本地需求,您可以像我一样将其与 self-signed 证书一起使用:
sudo apt -y install openssl
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -out motion.crt -keyout motion.key
sudo chmod motion:motion motion.crt
sudo chmod motion:motion motion.key
然后如上所述编辑motion.conf
并重新启动它。
注意:Motion 将仅提供 HTTPS。
希望对大家有帮助。