Skip to content

Commit

Permalink
SYMMETRICDS-517 - support multiple symmetric engines in a single inst…
Browse files Browse the repository at this point in the history
…ance
  • Loading branch information
chenson42 committed Sep 26, 2011
1 parent e513c53 commit 87fd403
Show file tree
Hide file tree
Showing 73 changed files with 1,873 additions and 5,143 deletions.
4 changes: 2 additions & 2 deletions symmetric/symmetric-assemble/pom.xml
Expand Up @@ -23,7 +23,7 @@

<properties>
<docbook.source>${basedir}/src/docbook</docbook.source>
<docbook.target>${basedir}/target/site/guide/2.4</docbook.target>
<docbook.target>${basedir}/target/site/guide/2.5</docbook.target>
<docbook.build>${basedir}/target/docbook</docbook.build>
</properties>

Expand Down Expand Up @@ -138,7 +138,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<destDir>apidocs-2.4</destDir>
<destDir>apidocs-2.5</destDir>
<doctitle>SymmetricDS API ${project.version}</doctitle>
</configuration>
<reportSets>
Expand Down
150 changes: 0 additions & 150 deletions symmetric/symmetric-assemble/src/docbook/advanced-topics.xml
Expand Up @@ -999,154 +999,4 @@ Enter key password for <sym>
</para>
</section>

<section id="ip-filtering">
<title>IP Filtering</title>
<para>
SymmetricDS supports restricting IP addresses of clients that are allowed to
connect to servers. The following filtering functionality is supported for IPv4
addresses (IPv6 is currently not supported).
</para>
<itemizedlist>
<listitem>
<para>CIDR (Classless Inter-Domain Routing) notation</para>
</listitem>
<listitem>
<para>Wildcarding</para>
</listitem>
<listitem>
<para>Range</para>
</listitem>
<listitem>
<para>Literal</para>
</listitem>
</itemizedlist>

<section xml:id="filter.cidr">
<title>CIDR Filter</title>
<para>
Classless Inter-Domain Routing, <ulink url='http://www.ietf.org/rfc/rfc1519.txt'>CIDR</ulink>, notation
is the preferred notation for restricting client connections to a server node in a SymmetricDS tree.
It is a commonly utilized format for IP address filtering. Many established frameworks, such as
<ulink url='http://httpd.apache.org/docs/1.3/mod/mod_access.html'>Apache</ulink>, utilize this notation for
filtering IP addresses.
</para>
<para>
The basis for implementing CIDR notation is defining the IP address block and significant
bits of that address that are to be checked. The filter must be a well formatted IP address
with a ending with a <quote>/</quote> followed by a numeric value between 0 and 32. The use
of <quote>0</quote> denotes that all IP addresses are allowed (in which case it's fairly pointless
to enable the filtering framework), and <quote>32</quote> signifies only the precesding IP address
would be authorized. In the latter case, a <xref linkend="filter.literal" xrefstyle="table"/> string
would be recommended as it is significantly more obvious that only that address is allowed.
</para>
<example xml:id="ex.ip.cidr.filter">
<title>CIDR Filter String Definition in symmetric.properties</title>
<programlisting>
#
# Filter string definition to restrict connecting client
# IP addresses
#
ip.filters=10.10.4.32/27, 10.5.0.0/16
</programlisting>
</example>

</section>
<section xml:id="filter.literal">
<title>Literal Filter</title>
<para>
Literal filter definitions are just that: they define a single IP address that is authorized
to connect to the server. The only requirement is that the filter string is a complete, well
formatted IP address.
</para>
</section>
<section xml:id="filter.wildcarding">
<title>Wildcarding</title>
<para>
The wildcard notation allows all values for a specific piece of an IP address to be valid (0 to 255 for IPv4 addresses).
This is denoted with a <quote>*</quote> within the specific piece (octet for IPv4) of an IP
address. The wildcard character is the only allowable character within that piece of the address
(no other characters included whitespace).
</para>
<para>
Wildcard filters may be combined with <xref linkend="filter.range" xrefstyle="table"/>.
They may NOT be combined with <xref linkend="filter.cidr" xrefstyle="table"/>.
</para>
<example xml:id="ex.ip.wildcard.filter">
<title>Wildcard Filter String Definition in symmetric.properties</title>
<programlisting>
#
# Filter string definition to restrict connecting client
# IP addresses
#
ip.filters=10.10.*.40
</programlisting>
</example>
</section>
<section xml:id="filter.range">
<title>Range Filters</title>
<para>
Range filter definitions allow for a numeric range to be specified within an address filter. A
range must be a valid numeric range for an piece of an IP address (i.e. an octet in IPv4). The range
definition must be in the form:
</para>
<example xml:id="ex.ip.range.filter">
<title>Filter String Definition in symmetric.properties</title>
<programlisting>
#
# Filter string definition to restrict connecting client
# IP addresses
#
ip.filters=10.10.40-20.200-1
</programlisting>
</example>
</section>
<section xml:id='filter.innerworking'>
<title>Inner workings</title>
<para>
Filter strings are compiled on startup, so the hit (although very small) of compiling
the authorizers is incurred only once. Once compiled each request is passed through
the chain of authorizers until either a authorization is passed or the chain is exhausted. In
the latter case the request is denied and a protocol specific response is sent to the client. In
the case of HTTP this would be a response code of 401 (FORBIDDEN).
</para>
</section>
<section xml:id='filter.configuration'>
<title>Configuration</title>
<para>
Configuring IP filter strings is done through defining the following property in the
SymmetricDS configuration (one of the symmetric .properties files). One need only to
define the <varname>ip.filter</varname> property and assign a comma <quote>,</quote> delimited
string of filter tokens to provide to the filter framework.
</para>
<example xml:id="ex.ip.filter">
<title>Filter String Definition in symmetric.properties</title>
<programlisting>
#
# Filter string definition to restrict connecting client
# IP addresses
#
ip.filters=10.10.4.32/27, 100.50-40.10-5.*, 35.58.124.89
</programlisting>
</example>
</section>

<important>
<para>
Note, that there is obvious overlap between the some of the filtering notation, and hence, functionality.
The <xref linkend="filter.wildcarding" xrefstyle="table"/> and
<xref linkend="filter.range" xrefstyle="table"/>
functionality exists to provide workarounds for scenarios where <xref linkend="filter.cidr" xrefstyle="table"/>
notation and <xref linkend="filter.literal" xrefstyle="table"/> will not suffice.
</para>
</important>

<warning>
<para>
Take care in defining your filter string as it is possible to overlap filters. Also, as with
the definition of any other property in the SymmetricDS configuration, if the property is
defined in multiple properties files the property file that is read in last will override any
previous filter string definitions.
</para>
</warning>
</section>
</chapter>
7 changes: 0 additions & 7 deletions symmetric/symmetric-assemble/src/docbook/extensions.xml
Expand Up @@ -246,11 +246,4 @@
Implement this extension point to intercept the saving and rendering of the node password.
</para>
</section>
<section id="extensions-servlets">
<title>IServletExtension</title>
<para>
Implement this extension point to allow additional Servlets to be registered with SymmetricDS. This is probably only
useful if SymmetricDS is running in standalone or embedded mode.
</para>
</section>
</chapter>
11 changes: 0 additions & 11 deletions symmetric/symmetric-assemble/src/docbook/parameters.xml
Expand Up @@ -590,17 +590,6 @@
[&#xA0;Default:&#xA0;true&#xA0;]
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<command>http.download.rate.kb</command>
</term>
<listitem>
<para>
This is the download rate for the HTTP symmetric transport. A value of -1 means full
throttle. [&#xA0;Default:&#xA0;-1&#xA0;]
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
Expand Down
Expand Up @@ -17,12 +17,11 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License. */


package org.jumpmind.symmetric;

import java.util.Properties;

import org.jumpmind.symmetric.common.Constants;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
Expand All @@ -35,7 +34,9 @@
*/
public class SpringWireableSymmetricEngine extends AbstractSymmetricEngine implements ApplicationContextAware {

private Properties properties;
private Properties properties;

private String springXml = Constants.SERVER_SPRING_XML;

public SpringWireableSymmetricEngine() {
}
Expand All @@ -50,7 +51,18 @@ public void setApplicationContext(ApplicationContext applicationContext) throws

@Override
protected ApplicationContext createContext(ApplicationContext parentContext) {
return new ClassPathXmlApplicationContext(new String[] { "classpath:/symmetric-server.xml" }, parentContext);
return new ClassPathXmlApplicationContext(new String[] { springXml }, parentContext);
}

/**
* @param springXml use {@link Constants#CLIENT_SPRING_XML} or {@link Constants#SERVER_SPRING_XML}
*/
public void setSpringXml(String springXml) {
this.springXml = springXml;
}

public String getSpringXml() {
return springXml;
}

}
Expand Down

0 comments on commit 87fd403

Please sign in to comment.