1

我正在寻找一个现有的 Red5 应用程序。

我们的需求非常基本:
* 只需要一个提要
* 通过 IP 地址或用户/通行证限制广播
* 通过用户/通行证或令牌限制观看

我找到了 videowhisper,但它似乎缺乏身份验证功能。

开源应用程序会很棒,但如果成本不太高,我可以接受商业产品。

RTMPT 解决方案似乎很适合限制观看访问,但任何人仍然可以在未经授权的情况下在我的服务器上开始广播。如何限制广播访问?

4

1 回答 1

2

我正在使用以下使用 RTMPT(RTMP over HTTP)的 IP 安全机制:

所有 RTMPT 请求都通过在我的 apache 配置中使用 mod_proxy 传递到 red5(端口 5080),除了 /open/1 请求:

#send open/1 request to authentification script:
Alias /open/1 /var/www/html/auth.php

#other RTMP request directly to red5:
ProxyPass /send http://localhost:5080/send
ProxyPassReverse /send http://localhost:5080/send
ProxyPass /idle http://localhost:5080/idle
ProxyPassReverse /idle http://localhost:5080/idle
ProxyPass /close http://localhost:5080/close
ProxyPassReverse /close http://localhost:5080/close
ProxyPass /fcs http://localhost:5080/fcs
ProxyPassReverse /fcs http://localhost:5080/fcs

当用户启动播放器时,网页将首先联系一个 php 脚本来验证用户是否已登录。如果是这样,它的 IP 地址将被临时存储,包括当前时间(时间戳)。然后 RTMPT 流将在端口 80 上启动。现在 auth.php 脚本将接收来自播放器的 /open/1 请求。它将检查 IP 地址和时间戳。如果 IP 地址存在且时间戳不超过 3 秒,则 /open/1 请求将传递给 red5。结果(标识符)被传回给玩家。在 PHP 中:

<?php
 //after user is verified, send /open/1 request to red5:
 $data = `curl -s -F a=b localhost:5080/open/1`;
 $data_size = strlen($data);

 header("Content-Type: application/x-fcs");
 header("Connection: Keep-Alive");
 header("Content-Length: $data_size");
 header('Cache-Control: no-cache');

 echo $data;  //return answer from red5 (identifier) back to player
 exit;
?>

不幸的是,/open/1 请求不包含来自网页的任何 cookie 或引用信息,只有来自客户端的 REMOTE_ADDR(IP 地址)和 REQUEST_TIME 是来自 PHP $_SERVER 变量(使用 JW-player)的有用信息。

于 2012-12-20T10:24:33.537 回答