4

我正在寻找有关保护 Red5 免受入侵的分步教程。这似乎是一个在谷歌搜索中经常出现的问题,但从来没有以对普通 Flash 开发人员有意义的方式得到真正的回答。

4

2 回答 2

5

您可以使用安全框架保护 red5 用于发布、播放或共享对象。在这种情况下,客户端无关紧要,但如果您想保护 oflaDemo,例如,您需要在后端添加安全挂钩。这是您需要的教程: http
://wiki.red5.org/wiki/Documentation/UsersReferenceManual/Red5CoreTechnologies/04-Security 更深入的安全教程在这里: http ://wiki.red5.org/wiki /Documentation/Tutorials/Red5AndAcegiSecurity
阻止播放的简单示例如下:

public class PlaybackSecurity implements IStreamPlaybackSecurity {
    @Override
    public boolean isPlaybackAllowed(IScope scope, String name, int start, int length, boolean flushPlaylist) {
        //start out denied
        boolean allowed = false;
        //get the current connection
        IConnection conn = Red5.getConnectionLocal();
        //token to use for auth
        Long token = -1L;
        if (conn.hasAttribute("token")) {
            //get a 'token' we stored on their connection from elsewhere
            token = conn.getLongAttribute("token");
            //validate the token in some way
            if (token > 0L) {
                allowed = true;
            }
        }
        //return allowed or denied state
        return allowed;
    }
}
安全类应该在你的应用程序启动时添加,所以我建议你把它放在你的应用程序适配器“appStart”方法中,如下所示:
    @Override
    public boolean appStart(final IScope app) {
        //register our stream security classes
    registerStreamPlaybackSecurity(new PlaybackSecurity(applicationContext));
        //pass control back to super
        return super.appStart(app);
    }

CRAM authentication with Red5教程和来源:http ://blog.infrared5.com/2012/05 /red5-身份验证/

于 2010-09-02T23:15:27.780 回答
0

您无法从客户端保护后端,OflaDemo 是一个演示应用程序,而不是生产应用程序。默认情况下,Red5 不允许全局连接,因此如果您只运行自己的应用程序,您可以实现任何您希望的安全性。

不,实际上不需要(也没有用)尝试仅在防火墙级别管理安全性。API 允许限制用户访问 red5 的各种用途。

于 2010-06-04T05:52:16.827 回答