Commit bddedae1 authored by Dele Olajide's avatar Dele Olajide Committed by dele

Fixed OF-715 - Update Openfire bouncycastle library from 1.46 to 1.49

Fixed OF-716 - Add Jitsi Videobridge plugin to Openfire plugins

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@13819 b35dd754-fafc-0310-a699-88a17e54d16e
parent 74e18f53
......@@ -160,7 +160,7 @@
<fileset dir="${lib.build.dir}" includes="*.jar" excludes="junit.jar"/>
<fileset dir="${lib.merge.dir}" includes="*.jar"/>
<fileset dir="${lib.dist.dir}"
includes="servlet.jar, mail.jar, activation.jar, jdic.jar, bouncycastle.jar"/>
includes="servlet.jar, mail.jar, activation.jar, jdic.jar, bcpg-jdk15on.jar bcpkix-jdk15on.jar bcprov-jdk15on.jar"/>
</path>
<path id="compile.dependencies">
......
......@@ -58,10 +58,11 @@ import java.util.regex.Pattern;
import org.bouncycastle.asn1.ASN1Encodable;
import org.bouncycastle.asn1.ASN1InputStream;
import org.bouncycastle.asn1.ASN1TaggedObject;
import org.bouncycastle.asn1.DEREncodable;
import org.bouncycastle.asn1.ASN1Encodable;
import org.bouncycastle.asn1.DERSequence;
import org.bouncycastle.asn1.DERObjectIdentifier;
import org.bouncycastle.asn1.DEROutputStream;
import org.bouncycastle.asn1.DERSequence;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.DERTaggedObject;
import org.bouncycastle.asn1.DERUTF8String;
import org.bouncycastle.asn1.x509.GeneralName;
......@@ -251,7 +252,7 @@ public class CertificateManager {
try {
// Value is encoded using ASN.1 so decode it to get the server's identity
ASN1InputStream decoder = new ASN1InputStream((byte[]) item.get(1));
DERSequence otherNameSeq = (DERSequence) decoder.readObject();
ASN1Sequence otherNameSeq = (ASN1Sequence) decoder.readObject();
// Check the object identifier
DERObjectIdentifier objectId = (DERObjectIdentifier) otherNameSeq.getObjectAt(0);
......@@ -266,7 +267,7 @@ public class CertificateManager {
// Get identity string
try {
final String identity;
DEREncodable o = otherNameSeq.getObjectAt(1);
ASN1Encodable o = otherNameSeq.getObjectAt(1);
if (o instanceof DERTaggedObject) {
ASN1TaggedObject ato = DERTaggedObject.getInstance(o);
Log.debug("... processing DERTaggedObject: " + ato.toString());
......@@ -455,7 +456,7 @@ public class CertificateManager {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DEROutputStream deros = new DEROutputStream(baos);
deros.writeObject(csr.getDERObject());
deros.writeObject(csr.toASN1Primitive());
String sTmp = new String(org.bouncycastle.util.encoders.Base64.encode(baos.toByteArray()));
// Header
......@@ -900,10 +901,10 @@ public class CertificateManager {
// Generate the subject alternative name
boolean critical = subjectDN == null || "".equals(subjectDN.trim());
DERSequence othernameSequence = new DERSequence(new ASN1Encodable[]{
ASN1Sequence othernameSequence = new DERSequence(new ASN1Encodable[]{
new DERObjectIdentifier("1.3.6.1.5.5.7.8.5"), new DERTaggedObject(true, 0, new DERUTF8String(domain))});
GeneralName othernameGN = new GeneralName(GeneralName.otherName, othernameSequence);
GeneralNames subjectAltNames = new GeneralNames(new DERSequence(new ASN1Encodable[]{othernameGN}));
GeneralNames subjectAltNames = new GeneralNames(new GeneralName[]{othernameGN});
// Add subject alternative name extension
certGenerator.addExtension(X509Extensions.SubjectAlternativeName, critical, subjectAltNames);
......
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Jitsi Video Bridge Plugin Changelog</title>
<style type="text/css">
BODY {
font-size : 100%;
}
BODY, TD, TH {
font-family : tahoma, verdana, arial, helvetica, sans-serif;
font-size : 0.8em;
}
H2 {
font-size : 10pt;
font-weight : bold;
padding-left : 1em;
}
A:hover {
text-decoration : none;
}
H1 {
font-family : tahoma, arial, helvetica, sans-serif;
font-size : 1.4em;
font-weight: bold;
border-bottom : 1px #ccc solid;
padding-bottom : 2px;
}
TT {
font-family : courier new;
font-weight : bold;
color : #060;
}
PRE {
font-family : courier new;
font-size : 100%;
}
</style>
</head>
<body>
<h1>
Jitsi Video Bridge Plugin Changelog
</h1>
<p><b>1.0</b> -- Nov 30th, 2013</p>
<ul>
<li>OF-716 Added to Openfire plugins </li>
</ul>
<p><b>1.0</b> -- Apr 12, 2013</p>
<ul>
<li>Initial release. </li>
</ul>
</body>
</html>
Some of the files here, notably libjitsi.jar, are OSGi bundles from the Jitsi
project. In Jitsi they are generated in the 'sc-bundles' directory by the
'bundles' ant target. To update the files here, run 'ant rebuild' in Jitsi and
then copy the files, e.g.:
for i in *; do
if [ -e ../../jitsi/sc-bundles/$i ]; then
cp ../../jitsi/sc-bundles/$i .;
fi;
done
<?xml version="1.0" encoding="UTF-8" ?>
<plugin>
<author>jitsi.org and igniterealtime.org</author>
<class>org.jitsi.videobridge.openfire.PluginImpl</class>
<description>Integrates Jitsi Video Bridge into Openfire.</description>
<licenseType>other</licenseType>
<minServerVersion>3.0.0</minServerVersion>
<name>Jitsi Video Bridge</name>
<version>1.0</version>
<adminconsole>
<tab id="tab-server">
<sidebar id="siderbar-jvb"
name="${plugin.title}">
<item id="jitsi-videobridge-settings"
name="${plugin.title}"
description="${plugin.title.description}"
url="jitsi-videobridge.jsp"/>
</sidebar>
</tab>
</adminconsole>
</plugin>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Jitsi Video Bridge Plugin Readme</title>
<style type="text/css">
BODY {
font-size : 100%;
}
BODY, TD, TH {
font-family : tahoma, verdana, arial, helvetica, sans-serif;
font-size : 0.8em;
}
H2 {
font-size : 10pt;
font-weight : bold;
}
A:hover {
text-decoration : none;
}
H1 {
font-family : tahoma, arial, helvetica, sans-serif;
font-size : 1.4em;
font-weight: bold;
border-bottom : 1px #ccc solid;
padding-bottom : 2px;
}
TT {
font-family : courier new;
font-weight : bold;
color : #060;
}
PRE {
font-family : courier new;
font-size : 100%;
}
#datatable TH {
color : #fff;
background-color : #2A448C;
text-align : left;
}
#datatable TD {
background-color : #FAF6EF;
}
#datatable .name {
background-color : #DCE2F5;
}
</style>
</head>
<body>
<h1>
Jitsi Video Bridge Plugin Readme
</h1>
<h2>Overview</h2>
<p>
The Jitsi Video Bridge Plugin is an XMPP server component that allows for
multiuser video communication. Unlike the expensive dedicated hardware videobridges,
Jitsi Videobridge does not mix the video channels into a composite video stream,
but only relays the received video channels to all call participants.
Therefore, while it does need to run on a server with good network bandwidth,
CPU horsepower is not that critical for performance.
</p>
<h2>Installation</h2>
<p>Copy jitsivideobridge.jar into the plugins directory of your Openfire server. The
plugin will then be automatically deployed. To upgrade to a new version, copy the new
jitsiVideobridge.jar file over the existing file.</p>
<h2>Configuration</h2>
Under Server settings -> Jitsi Videobridge tab you can configure it.
</body>
</html>
plugin.title=Jitsi Videobridge
plugin.title.description=Jitsi Videobridge Settings
config.page.title=Jitsi Videobridge Settings Page
config.page.configuration.title=Configuration
config.page.configuration.min.port=Min port used for media
config.page.configuration.max.port=Max port used for media
config.page.configuration.submit=Save
config.page.configuration.error.minport=Invalid min port value
config.page.configuration.error.maxport=Invalid max port value
/*
* Jitsi Videobridge, OpenSource video conferencing.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jitsi.videobridge.openfire;
import java.io.*;
import java.lang.reflect.*;
import java.net.*;
import java.util.*;
import java.util.jar.*;
import org.jitsi.service.neomedia.*;
import org.jitsi.util.*;
import org.jitsi.videobridge.*;
import org.jivesoftware.openfire.container.*;
import org.jivesoftware.util.*;
import org.slf4j.*;
import org.slf4j.Logger;
import org.xmpp.component.*;
/**
* Implements <tt>org.jivesoftware.openfire.container.Plugin</tt> to integrate
* Jitsi Video Bridge into Openfire.
*
* @author Lyubomir Marinov
* @author Damian Minkov
*/
public class PluginImpl
implements Plugin,
PropertyEventListener
{
/**
* The logger.
*/
private static final Logger Log = LoggerFactory.getLogger(PluginImpl.class);
/**
* The name of the property that contains the maximum port number that we'd
* like our RTP managers to bind upon.
*/
public static final String MAX_PORT_NUMBER_PROPERTY_NAME
= "org.jitsi.videobridge.media.MAX_PORT_NUMBER";
/**
* The name of the property that contains the minimum port number that we'd
* like our RTP managers to bind upon.
*/
public static final String MIN_PORT_NUMBER_PROPERTY_NAME
= "org.jitsi.videobridge.media.MIN_PORT_NUMBER";
/**
* The minimum port number default value.
*/
public static final int MIN_PORT_DEFAULT_VALUE = 5000;
/**
* The maximum port number default value.
*/
public static final int MAX_PORT_DEFAULT_VALUE = 6000;
/**
* The Jabber component which has been added to {@link #componentManager}
* i.e. Openfire.
*/
private Component component;
/**
* The <tt>ComponentManager</tt> to which the {@link #component} of this
* <tt>Plugin</tt> has been added.
*/
private ComponentManager componentManager;
/**
* The subdomain of the address of {@link #component} with which it has been
* added to {@link #componentManager}.
*/
private String subdomain;
/**
* Destroys this <tt>Plugin</tt> i.e. releases the resources acquired by
* this <tt>Plugin</tt> throughout its life up until now and prepares it for
* garbage collection.
*
* @see Plugin#destroyPlugin()
*/
public void destroyPlugin()
{
PropertyEventDispatcher.removeListener(this);
if ((componentManager != null) && (subdomain != null))
{
try
{
componentManager.removeComponent(subdomain);
}
catch (ComponentException ce)
{
// TODO Auto-generated method stub
}
componentManager = null;
subdomain = null;
component = null;
}
}
/**
* Initializes this <tt>Plugin</tt>.
*
* @param manager the <tt>PluginManager</tt> which loads and manages this
* <tt>Plugin</tt>
* @param pluginDirectory the directory into which this <tt>Plugin</tt> is
* located
* @see Plugin#initializePlugin(PluginManager, File)
*/
public void initializePlugin(PluginManager manager, File pluginDirectory)
{
PropertyEventDispatcher.addListener(this);
System.setProperty("net.java.sip.communicator.SC_HOME_DIR_LOCATION", pluginDirectory.getPath());
System.setProperty("net.java.sip.communicator.SC_HOME_DIR_NAME", ".");
// Let's check for custom configuration
String maxVal = JiveGlobals.getProperty(MAX_PORT_NUMBER_PROPERTY_NAME);
String minVal = JiveGlobals.getProperty(MIN_PORT_NUMBER_PROPERTY_NAME);
if(maxVal != null)
setIntProperty(
DefaultStreamConnector.MAX_PORT_NUMBER_PROPERTY_NAME,
maxVal);
if(minVal != null)
setIntProperty(
DefaultStreamConnector.MIN_PORT_NUMBER_PROPERTY_NAME,
minVal);
checkNatives();
ComponentManager componentManager
= ComponentManagerFactory.getComponentManager();
String subdomain = ComponentImpl.SUBDOMAIN;
Component component = new ComponentImpl();
boolean added = false;
try
{
componentManager.addComponent(subdomain, component);
added = true;
}
catch (ComponentException ce)
{
ce.printStackTrace(System.err);
}
if (added)
{
this.componentManager = componentManager;
this.subdomain = subdomain;
this.component = component;
}
else
{
this.componentManager = null;
this.subdomain = null;
this.component = null;
}
}
/**
* Checks whether we have folder with extracted natives, if missing
* find the appropriate jar file and extract them. Normally this is
* done once when plugin is installed or updated.
* If folder with natives exist add it to the java.library.path so
* libjitsi can use those native libs.
*/
private void checkNatives()
{
// Find the root path of the class that will be our plugin lib folder.
try
{
String binaryPath =
(new URL(ComponentImpl.class.getProtectionDomain()
.getCodeSource().getLocation(), ".")).openConnection()
.getPermission().getName();
File pluginJarfile = new File(binaryPath);
File nativeLibFolder =
new File(pluginJarfile.getParentFile(), "native");
if(!nativeLibFolder.exists())
{
nativeLibFolder.mkdirs();
// lets find the appropriate jar file to extract and
// extract it
String jarFileSuffix = null;
if(OSUtils.IS_LINUX32)
{
jarFileSuffix = "-native-linux-32.jar";
}
else if(OSUtils.IS_LINUX64)
{
jarFileSuffix = "-native-linux-64.jar";
}
else if(OSUtils.IS_WINDOWS32)
{
jarFileSuffix = "-native-windows-32.jar";
}
else if(OSUtils.IS_WINDOWS64)
{
jarFileSuffix = "-native-windows-64.jar";
}
else if(OSUtils.IS_MAC)
{
jarFileSuffix = "-native-macosx.jar";
}
String nativeLibsJarPath =
pluginJarfile.getCanonicalPath();
nativeLibsJarPath =
nativeLibsJarPath.replaceFirst("\\.jar", jarFileSuffix);
JarFile jar = new JarFile(nativeLibsJarPath);
Enumeration en = jar.entries();
while (en.hasMoreElements())
{
try
{
JarEntry file = (JarEntry) en.nextElement();
File f = new File(nativeLibFolder, file.getName());
if (file.isDirectory())
{
continue;
}
InputStream is = jar.getInputStream(file);
FileOutputStream fos = new FileOutputStream(f);
while (is.available() > 0)
{
fos.write(is.read());
}
fos.close();
is.close();
}
catch(Throwable t)
{}
}
Log.info("Native lib folder created and natives extracted");
}
else
Log.info("Native lib folder already exist.");
String newLibPath =
nativeLibFolder.getCanonicalPath() + File.pathSeparator +
System.getProperty("java.library.path");
System.setProperty("java.library.path", newLibPath);
// this will reload the new setting
Field fieldSysPath = ClassLoader.class.getDeclaredField("sys_paths");
fieldSysPath.setAccessible(true);
fieldSysPath.set(System.class.getClassLoader(), null);
}
catch (Exception e)
{
Log.error(e.getMessage(), e);
}
}
/**
* Returns the value of max port if set or the default one.
* @return the value of max port if set or the default one.
*/
public String getMaxPort()
{
String val = System.getProperty(
DefaultStreamConnector.MAX_PORT_NUMBER_PROPERTY_NAME);
if(val != null)
return val;
else
return String.valueOf(MAX_PORT_DEFAULT_VALUE);
}
/**
* Returns the value of min port if set or the default one.
* @return the value of min port if set or the default one.
*/
public String getMinPort()
{
String val = System.getProperty(
DefaultStreamConnector.MIN_PORT_NUMBER_PROPERTY_NAME);
if(val != null)
return val;
else
return String.valueOf(MIN_PORT_DEFAULT_VALUE);
}
/**
* A property was set. The parameter map <tt>params</tt> will contain the
* the value of the property under the key <tt>value</tt>.
*
* @param property the name of the property.
* @param params event parameters.
*/
public void propertySet(String property, Map params)
{
if(property.equals(MAX_PORT_NUMBER_PROPERTY_NAME))
{
setIntProperty(
DefaultStreamConnector.MAX_PORT_NUMBER_PROPERTY_NAME,
(String)params.get("value"));
}
else if(property.equals(MIN_PORT_NUMBER_PROPERTY_NAME))
{
setIntProperty(
DefaultStreamConnector.MIN_PORT_NUMBER_PROPERTY_NAME,
(String)params.get("value"));
}
}
/**
* Sets int property.
* @param property the property name.
* @param value the value to change.
*/
private void setIntProperty(String property, String value)
{
try
{
// let's just check that value is integer
int port = Integer.valueOf(value);
if(port >= 1 && port <= 65535)
System.setProperty(property, value);
}
catch(NumberFormatException ex)
{
Log.error("Error setting port", ex);
}
}
/**
* A property was deleted.
*
* @param property the name of the property deleted.
* @param params event parameters.
*/
public void propertyDeleted(String property, Map params)
{
if(property.equals(MAX_PORT_NUMBER_PROPERTY_NAME))
{
System.setProperty(
DefaultStreamConnector.MAX_PORT_NUMBER_PROPERTY_NAME,
String.valueOf(MAX_PORT_DEFAULT_VALUE));
}
else if(property.equals(MIN_PORT_NUMBER_PROPERTY_NAME))
{
System.setProperty(
DefaultStreamConnector.MIN_PORT_NUMBER_PROPERTY_NAME,
String.valueOf(MIN_PORT_DEFAULT_VALUE));
}
}
/**
* An XML property was set. The parameter map <tt>params</tt> will contain the
* the value of the property under the key <tt>value</tt>.
*
* @param property the name of the property.
* @param params event parameters.
*/
public void xmlPropertySet(String property, Map params)
{
propertySet(property, params);
}
/**
* An XML property was deleted.
*
* @param property the name of the property.
* @param params event parameters.
*/
public void xmlPropertyDeleted(String property, Map params)
{
propertyDeleted(property, params);
}
}
<%--
- Jitsi VideoBridge, OpenSource video conferencing.
-
- Distributable under LGPL license.
- See terms of license at gnu.org.
--%>
<%@ page import="org.jitsi.videobridge.openfire.*" %>
<%@ page import="org.jivesoftware.openfire.*" %>
<%@ page import="org.jivesoftware.util.*" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
<%
boolean update = request.getParameter("update") != null;
String errorMessage = null;
// Get handle on the plugin
PluginImpl plugin = (PluginImpl) XMPPServer.getInstance()
.getPluginManager().getPlugin("jitsivideobridge");
if (update)
{
String minPort = request.getParameter("minport");
if (minPort != null) {
minPort = minPort.trim();
try
{
int port = Integer.valueOf(minPort);
if(port >= 1 && port <= 65535)
JiveGlobals.setProperty(
PluginImpl.MIN_PORT_NUMBER_PROPERTY_NAME, minPort);
else
throw new NumberFormatException("out of range port");
}
catch (Exception e)
{
errorMessage = LocaleUtils.getLocalizedString(
"config.page.configuration.error.minport",
"jitsivideobridge");
}
}
String maxPort = request.getParameter("maxport");
if (maxPort != null) {
maxPort = maxPort.trim();
try
{
int port = Integer.valueOf(maxPort);
if(port >= 1 && port <= 65535)
JiveGlobals.setProperty(
PluginImpl.MAX_PORT_NUMBER_PROPERTY_NAME, maxPort);
else
throw new NumberFormatException("out of range port");
}
catch (Exception e)
{
errorMessage = LocaleUtils.getLocalizedString(
"config.page.configuration.error.maxport",
"jitsivideobridge");
}
}
}
%>
<html>
<head>
<title><fmt:message key="config.page.title" /></title>
<meta name="pageID" content="jitsi-videobridge-settings"/>
</head>
<body>
<% if (errorMessage != null) { %>
<div class="error">
<%= errorMessage%>
</div>
<br/>
<% } %>
<div class="jive-table">
<form action="jitsi-videobridge.jsp" method="post">
<table class="jive-table" cellpadding="0" cellspacing="0" border="0" width="50%">
<thead>
<tr>
<th colspan="2"><fmt:message key="config.page.configuration.title"/></th>
</tr>
</thead>
<tbody>
<tr>
<td><label class="jive-label"><fmt:message key="config.page.configuration.min.port"/>:</label><br>
</td>
<td align="left">
<input name="minport" type="text" maxlength="5" size="5"
value="<%=plugin.getMinPort()%>"/>
</td>
</tr>
<tr>
<td><label class="jive-label"><fmt:message key="config.page.configuration.max.port"/>:</label><br>
</td>
<td align="left">
<input name="maxport" type="text" maxlength="5" size="5"
value="<%=plugin.getMaxPort()%>"/>
</td>
</tr>
<tr>
<th colspan="2"><input type="submit" name="update"
value="<fmt:message key="config.page.configuration.submit" />"></th>
</tr>
</tbody>
</table>
</form>
</div>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment