Examples/SecurityExample

Security Plugin example for Red5 applications

Available is a a new red5 plugin called security plugin. It enables security of playback, publishing and shared objects using the Red5 Security API.

Place the securityplugin.jar into the plugins directory of the red5 root.

Sets up page / swf url checks for playback security, publish names for publish security, and shared object names and checks for shared object security.

Before setting up read Chapter 11 of the manual about the new plugin API.  http://www.red5.org/wiki/Documentation/UsersReferenceManual/Red5CoreTechnologies/11-Plugins#Chapter11.Plugins

Playback Security

Supply text files with domain entries seperated by a new line.

<bean class="org.red5.server.plugin.PluginDescriptor">
                    <property name="pluginName" value="securityPlugin"/>
                    <property name="pluginType" value="org.red5.server.plugin.security.SecurityPlugin"/>
                    <property name="method" value="getPlaybackSecurityHandler"/>
                    <property name="methodReturnType" value="org.red5.server.plugin.security.PlaybackSecurityHandler"/>
                    <property name="properties">
                        <map>
                            <entry>
                                <key><value>htmlDomains</value></key>
                                <value>file:///www/red5_server/dist/webapps/oflaDemo/WEB-INF/allowedHTMLdomains.txt</value>
                            </entry>
                            <entry>
                                <key><value>swfDomains</value></key>
                                <value>file:///www/red5_server/dist/webapps/oflaDemo/WEB-INF/allowedSWFdomains.txt</value>
                            </entry>
                        </map>
                    </property> 
     </bean>

allowedHTMLDomains.txt

Example showing a list of domains

localhost
electroteque.org
electrocode.net

allowedSWFDomains.txt

Example showing an asterix wildcard to disable domain checks.

localhost
electroteque.org
electrocode.net
*

Publish Security Bean

Supply a text file with a list of publish names and publish modes seperated by a new line. Enable / disable publishing globally.

<bean class="org.red5.server.plugin.PluginDescriptor">
                    <property name="pluginName" value="securityPlugin"/>
                    <property name="pluginType" value="org.red5.server.plugin.security.SecurityPlugin"/>
                    <property name="method" value="getPublishSecurityHandler"/>
                    <property name="methodReturnType" value="org.red5.server.plugin.security.PublishSecurityHandler"/>
                    <property name="properties">
                        <map>
                            <entry>
                                <key><value>publishNames</value></key>
                                <value>file:///www/red5_server/dist/webapps/oflaDemo/WEB-INF/allowedPublishNames.txt</value>
                            </entry>
                            <entry>
                                <key><value>enablePublish</value></key>
                                <value>true</value>
                            </entry>
                        </map>
                    </property>                     
                </bean>

allowedPublishNames.txt

Example showing a list of publish names and then modes delimited by a comma and seperated by a colon.

danielr;publish,record,live

Shared Object Security Bean

Supply a text file with a list of allowed shared object names seperated by a new line. Enable / disable connections, creation, deleting, sending, writing shared objects.

 <bean class="org.red5.server.plugin.PluginDescriptor">
                    <property name="pluginName" value="securityPlugin"/>
                    <property name="pluginType" value="org.red5.server.plugin.security.SecurityPlugin"/>
                    <property name="method" value="getSharedObjectSecurityHandler"/>
                    <property name="methodReturnType" value="org.red5.server.plugin.security.SharedObjectSecurityHandler"/>
                    <property name="properties">
                        <map>
                            <entry>
                                <key><value>sharedObjectNames</value></key>
                                <value>file:///www/red5_server/dist/webapps/oflaDemo/WEB-INF/allowedSharedObjectNames.txt</value>
                            </entry>
                            <entry>
                                <key><value>enableSharedObjects</value></key>
                                <value>true</value>
                            </entry>
                            <entry>
                                <key><value>connectionAllowed</value></key>
                                <value>true</value>
                            </entry>
                            <entry>
                                <key><value>creationAllowed</value></key>
                                <value>true</value>
                            </entry>
                            <entry>
                                <key><value>deleteAllowed</value></key>
                                <value>true</value>
                            </entry>
                            <entry>
                                <key><value>sendAllowed</value></key>
                                <value>true</value>
                            </entry>
                            <entry>
                                <key><value>writeAllowed</value></key>
                                <value>true</value>
                            </entry>
                        </map>
                    </property> 
                </bean>