Revision: 3ad11f6a9714
Author: Jean Deruelle <[email protected]>
Date: Fri Apr 6 01:22:55 2012
Log: Fixes Issue 4
http://code.google.com/p/sipservlets/source/detail?r=3ad11f6a9714
Added:
/docs/sources/src/main/resources/en-US/concept-chapter-Security.xml
/docs/sources/src/main/resources/en-US/concept-section-SS_TLS.xml
Modified:
/docs/jdocbook-mobicents/pom.xml
/docs/jdocbook-telscale/pom.xml
/docs/sources/src/main/resources/en-US/SIP_Servlets_Server_User_Guide.xml
/docs/sources/src/main/resources/en-US/concept-chapter-Advanced_Features_of_the_SIP_Servlets_Server.xml
/docs/sources/src/main/resources/en-US/concept-section-SS_SIP_Servlet_Security.xml
=======================================
--- /dev/null
+++ /docs/sources/src/main/resources/en-US/concept-chapter-Security.xml Fri
Apr 6 01:22:55 2012
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "SIP_Servlets_Server_User_Guide.ent">
+%BOOK_ENTITIES;
+]>
+<!-- chapter id nickname: sssecurity -->
+<chapter id="ssecurity-Sip_Servlet_Security">
+ <title>Security</title>
+
+ <para>The information present in SIP requests often contains sensitive
user
+ information. To protect user information, SIP Security can be enabled on
the
+ server, and within the SIP application to mitigate the risk of
unauthorised
+ access to the information.</para>
+
+ <para>There are essentially two levels of security that can be enabled on
+ the server, the communication between the server and other SIP entities
and
+ securing the application and its content.</para>
+
+ <xi:include href="concept-section-SS_SIP_Servlet_Security.xml"
+ xmlns:xi="http://www.w3.org/2001/XInclude"/>
+
+ <xi:include href="concept-section-SS_TLS.xml"
+ xmlns:xi="http://www.w3.org/2001/XInclude"/>
+</chapter>
=======================================
--- /dev/null
+++ /docs/sources/src/main/resources/en-US/concept-section-SS_TLS.xml Fri
Apr 6 01:22:55 2012
@@ -0,0 +1,307 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "SIP_Servlets_Server_User_Guide.ent">
+%BOOK_ENTITIES;
+]>
+<section id="sss-TLS">
+ <title>TLS</title>
+
+ <para>In order to configure TLS you will have to obtain a public/private
key, a X.509 certificate,
+ add those to the Java keystore and optionally add certificates
from a known CA (certicate
+ authority). The entire process can be confusing but in order to
get a basic setup for
+ testing purposes up and running with minimal effort, this section
starts off with a simple
+ quick start. However, for production environment you need to
obtain an officially signed
+ certificate from a known CA and that process is outlined in
section <xref linkend="sss-TLS_production_setup">Production
Setup</xref>.</para>
+
+ <section>
+ <title>Quick Start</title>
+
+ <para>This section shows how to create a self signed certificate, how
to
+ add that to the Java keystore and how to configure the SIP Servlet
+ Container to make use of this configuration. Note, this section should
+ only be used in a development environment and the main reason for this
+ quickstart section is to get you going right away as well as get you
+ comfortable with generating keys and certificates and adding them to
the
+ Java keystore.</para>
+
+ <procedure>
+ <title>Server Side Authentication</title>
+
+ <para> At a high-level, we will execute the following three steps:
<orderedlist>
+ <listitem>
+ <para>Generate a public/private key pair and a
self signed certificate and
+ add those to the Java keystore.</para>
+ </listitem>
+ <listitem>
+ <para>Configure the SIP Servlet Container to load
our certificate from the
+ keystore.</para>
+ </listitem>
+ <listitem>
+ <para>Test!</para>
+ </listitem>
+ </orderedlist></para>
+
+
+ <step>
+ <title>Generate certificate</title>
+ <para>Generating a new key-pair and a certificate can be done in a
few different ways with a
+ few different tools but here we will just use the java keytool
that comes with the JDK.
+ Simple issue the following command, which will generate a new
public and private key,
+ generate a self-signed certificate and add it all to the Java
keystore: </para>
+
+ <para><programlisting>keytool -genkeypair -alias myserver -keyalg RSA
-keysize 1024 -keypass secret -validity 365 -storetype jks -keystore
myserver.jks -storepass secret -v -dname "CN=James Smith, OU=Engineering,
O=My Company, L=My City, S=My State, C=US"</programlisting></para>
+
+ <para>-keystore specifies which keystore we should use/update. If
the keystore doesn't
+ exist, a new one will be created for one. In the above example,
we named the keystore
+ <classname>myserver.jks</classname> and it will be saved in the
current directory
+ </para>
+
+ <para>-keypass and -storepass should be chosen wisely since with
bad passwords you won't
+ have much protection anyway. Also, normally you should
never passwords on the
+ command prompt, it is too easy for other people to
steal. If you leave these two
+ options out, the keytool command will ask you for it.
</para>
+
+ <para>-keyalg specifies which algorithm to use when generating
the keys and the keysize
+ how long those keys should be. </para>
+
+ <para>Note: the command -genkeypair is new in JDK 6 and was
previously named -genkey. The
+ keytool in JDK 6 has some improvements over the
previous versions so it is
+ recommended to use it instead. </para>
+
+ <para>See more about the Java keytool here: <ulink
url="http://docs.oracle.com/javase/6/docs/technotes/tools/solaris/keytool.html">http://docs.oracle.com/javase/6/docs/technotes/tools/solaris/keytool.html</ulink></para>
+ </step>
+
+ <step>
+ <title>Configure the SIP Servlet Container</title>
+ <para>The SIP Servlet Container relies on the JAIN SIP stack to
support it with TLS
+ capabilities. As such, it is the JAIN SIP stack that
we need to configure to
+ have it read our certificate we added to the key
store. The various
+ configuration options are described in the javadoc of
the <ulink
url="http://ci.jboss.org/jenkins/job/jain-sip/lastSuccessfulBuild/artifact/javadoc/gov/nist/javax/sip/SipStackImpl.html">SipStackImpl</ulink>
+ class but for this quickstart, we will be using
the following ones: </para>
+
+ <para>
+ <itemizedlist>
+ <listitem><para><literal>javax.net.ssl.keyStore</literal>
– the filename and location of the keystore to use.</para></listitem>
+
<listitem><para><literal>javax.net.ssl.keyStorePassword</literal> – the
password to the keystore.</para></listitem>
+
<listitem><para><literal>gov.nist.javax.sip.TLS_CLIENT_AUTH_TYPE</literal>
– which type of authentication we will require of the
+ client (for now, the client authentication type will
be set to Disabled).</para></listitem>
+ </itemizedlist>
+ </para>
+
+ <para>The configuration options are JVM parameters and you will
have to add these to the
+ command line when you start the server:
+ <programlisting>./bin/run.sh
-Djavax.net.ssl.keyStorePassword=mysecret
-Dgov.nist.javax.sip.TLS_CLIENT_AUTH_TYPE=Disabled
-Djavax.net.ssl.keyStore=/path/to/your/keystore/myserver.jks</programlisting></para>
+
+
+ <para>Once the server is up, we are ready to verify that we can
get a TLS connection using the
+ certificate we previously added in the first step. </para>
+
+ <para>Note: for this first part of the quickstart we will not
require a certificate from the
+ client since this involves more configuration. This is
controlled by the
+ <literal>gov.nist.javax.sip.TLS_CLIENT_AUTH_TYPE
parameter</literal>. </para>
+ </step>
+
+
+ <step>
+ <title>Test!</title>
+ <para> To verify your setup there are a few different tools that
you can use. <itemizedlist>
+ <listitem>
+ <para><ulink
url="http://www.openssl.org/">openssl</ulink> is an open source SSL toolkit
and contains a generic SSL/TLS test
+ client</para>
+ </listitem>
+ <listitem>
+ <para><ulink
url="http://sipp.sourceforge.net/">SIPp</ulink> – an open source SIP load
testing tool that is capable of using TLS.
+ However, it requires some additional steps that we
have not addressed in the first
+ parf of this quickstart so therefore we willl not be
using SIPp.</para>
+ </listitem>
+ <listitem>
+ <para>Using your favorite SIP client. Most SIP clients out
there are capable of
+ establishing a TLS connection but you will have to
consult its documentation of how
+ to configure TLS.</para>
+ </listitem>
+ </itemizedlist></para>
+
+ <para>Using openssl:</para>
+
+ <para>Assuming that your server is running on localhost and is
listening for TLS on port 5081
+ the command would be:
+ <programlisting>openssl s_client -host 127.0.0.1
-port 5081</programlisting></para>
+
+
+ <para>If you are successful you should see an output from openssl
displaying information about
+ the server certificate (which should be the one we generated
in Step 1). If there are any
+ issues with the setup, openssl is pretty good about giving out
information about what it
+ thinks is wrong. </para>
+
+ <para>Tip: if you add the following JVM parameter as well you will
get a lot of useful debug
+ information: <literal>-Djavax.net.debug=ssl</literal></para>
+ </step>
+ </procedure>
+
+ <procedure>
+ <title>Server Side Authentication</title>
+
+ <para>In the first part of this quickstart we generated a public
and private key along with a
+ self-signed certificate and added them all into the Java
keystore. The server was then
+ configured to use this information and when a client
connected, our certificate was served
+ up to the client. However, normally, the client and the server
would like to verify each
+ others certificate to make sure they both trust each other and
if not, either of them will
+ terminate the connection. In the first part of the quickstart,
the server did not require
+ the client to present a certificate when connecting (remember
that we set the <literal>gov.nist.javax.sip.TLS_CLIENT_AUTH_TYPE</literal>
to disabled) so let's do
+ that now.</para>
+
+ <para> At a high-level, these are the tasks we need to execute:
<orderedlist>
+ <listitem>
+ <para>Generate a public/private key pair for
the client along with a
+ certificate.</para>
+ </listitem>
+ <listitem>
+ <para>The server need to add the client
certificate to its keystore as a
+ trusted certificate.</para>
+ </listitem>
+ <listitem>
+ <para>Start the server with client
authenticating enabled.</para>
+ </listitem>
+ </orderedlist></para>
+
+
+ <step>
+ <title>Generate Client Certificate</title>
+ <para>We will use the Java keytool for this step in the same
we did for for the server side
+ in the previous quikstart. The command is exactly
the same and the only
+ difference is that we store the information in a
new keystore called
+ <classname>myclient.jks</classname>.
+ <programlisting>keytool -genkeypair -alias
myclient -keyalg RSA -keysize 1024 -keypass secret -validity 365 -storetype
jks -keystore myclient.jks -storepass secret -v -dname "CN=John Doe,
OU=Engineering, O=Some Work, L=Some City, S=Some State, C=US"
</programlisting></para>
+ <para>We have now generated a new keystore containing the
clients authentication
+ information. However, the server needs to import
the client certificate into its
+ trusted keystore so we need to extract the
certificate out of the client key
+ store. This can also be done using the Java
keytool.
+ <programlisting>keytool -exportcert -alias
myclient -file client.cert -keystore myclient.jks -storepass secret
-rfc</programlisting>The
+ certificate is saved in file “client.cert” and we
will use this file in the next
+ step. </para>
+ </step>
+
+ <step>
+ <title>Re-configure the server</title>
+ <para>Simply change the
<literal>gov.nist.javax.sip.TLS_CLIENT_AUTH_TYPE</literal> from “Disabled”
to “Enabled” and start the server again.</para>
+ </step>
+
+ <step>
+ <title>Test</title>
+ <para>We will once again use openssl to verify our
setup but now that the client
+ will be forced to present a certificate as well,
we do need the certificate's
+ private key as well. The private key is embedded
into the keystore and was
+ generated when we issued the “kenkeypair”
keytool-command. Unfortunately, the
+ keytool does not have an option for exporting the
private key so we will have to
+ write a small java program to extract it for us.
Luckily, it is not a lot of
+ code:</para>
+ <programlisting role="xml">import
java.io.FileInputStream;
+ import java.security.Key;
+ import java.security.KeyStore;
+ import sun.misc.BASE64Encoder;
+
+ /**
+ * Code originally posted on Sun's developer forums but
+ * can now only be found at stackoverflow:
+ *
http://stackoverflow.com/questions/150167/how-do-i-list-export-private-keys-from-a-keystore
+ */
+ public class DumpPrivateKey {
+
+ static public void main(String[] args)
+ throws Exception {
+ if(args.length < 3) {
+ throw new IllegalArgumentException("expected args: Keystore
filename, Keystore password, alias, <key password: default same than
keystore");
+ }
+ final String keystoreName = args[0];
+ final String keystorePassword = args[1];
+ final String alias = args[2];
+ final String keyPassword =
getKeyPassword(args,keystorePassword);
+ KeyStore ks = KeyStore.getInstance("jks");
+ ks.load(new FileInputStream(keystoreName),
keystorePassword.toCharArray());
+ Key key = ks.getKey(alias, keyPassword.toCharArray());
+ String b64 = new BASE64Encoder().encode(key.getEncoded());
+ System.out.println("-----BEGIN PRIVATE KEY-----");
+ System.out.println(b64);
+ System.out.println("-----END PRIVATE KEY-----");
+ }
+
+ private static String getKeyPassword(final String[] args, final
String keystorePassword)
+ {
+ String keyPassword = keystorePassword; // default case
+ if(args.length == 4) {
+ keyPassword = args[3];
+ }
+ return keyPassword;
+ }
+ }</programlisting>
+
+ <para>Copy and paste the above code into a file call
DumpPrivateKey.java and then compile it: </para>
+
+ <programlisting>javac DumpPrivateKey.java</programlisting>
+ <para>and then use it to extract the private key: </para>
+ <programlisting>java DumpPrivateKey myclient.jks secret myclient >
clientprivate.key</programlisting>
+
+<para>Now that we have the private key of the client we can use openssl to
verify the setup again: </para>
+
+ <programlisting>openssl s_client -host 127.0.0.1 -port
5081 -cert client.cert -certform PEM -key clientprivate.key</programlisting>
+
+<para>If all goes well you should successfully establish a connection and
openssl will dump
+ information about the certificate exchange. </para>
+ </step>
+ </procedure>
+ </section>
+
+ <section id="sss-TLS_production_setup">
+ <title>Production Setup</title>
+ <para>In a production environment it is important that you run with
an officially signed
+ certificate from a known CA. It is this certificate that
you will load into your
+ keystore and the process is very similar to the one
outlined in the quick start.</para>
+ <procedure>
+ <step>
+ <title>Generate a PKCS#12 Storage</title>
+ <para>Assuming that you already have a private key and a signed
certificate from a known CA
+ you first have to wrap these two into a pkcs#12 storage
(pkcs#12 is a file format
+ for storing X.509 public certificates along with the
private key), and then load
+ that into the Java keystore. To create a pkcs#12 storage
you can use the <ulink
url="http://www.openssl.org/docs/apps/pkcs12.html">openssl pkcs12</ulink>
command:</para>
+
+ <para><programlisting>openssl pkcs12 -inkey myprivate.key -in
mycertificate.pem -export -out mystorage.pkcs12 -passout
mysecret</programlisting></para>
+
+ <para>where myprivate.key is the private key,
<classname>mycertificate.pem</classname> is the X.509
+ certificate. The password for the storage is
“mysecret” and the name of the
+ storage file is
<classname>mystorage.pkcs12</classname>. </para>
+ </step>
+
+ <step>
+ <title>Generate the Java Keystore</title>
+
+ <para>Once the pkcs#12 has been created, use the Java keytool to
load the pkcs12 storage
+ and convert it into a java keystore. </para>
+
+ <para><programlisting>keytool -importkeystore -srckeystore
mystorage.pkcs12 -srcstoretype PKCS12 -destkeystore myserver.jks
-deststorepass mysecret -srcstorepass mysecret</programlisting></para>
+
+ <para>A few things to point out: </para>
+
+ <para>
+ -srcstoretype is important and tells the Java keytool which
format the key store that we are importing is in. In the previous step, we
generated a pkcs#12 store so in this example, the store type must be PKCS12.
+ </para>
+
+ <para>
+ -srcstorepass is the password for the pkcs#12 storage and in the
above example it is the same as the destination key store (-deststorepass)
but most likely they will be different.
+ </para>
+ </step>
+
+ <step>
+ <title>Re-configure and Test</title>
+ <para>Now that we have a java keystore the server configuration
is exactly the same as
+ described in the quick start, i.e., simply set the
java properties
+ <literal>javax.net.ssl.keyStore</literal> to point to
this key keystore file and then set the
+ password through the property
<literal>javax.net.ssl.keyStorePassword</literal>. Once the server
+ has been re-started you can use openssl to verify the
setup. </para>
+ </step>
+
+ </procedure>
+ </section>
+
+
+</section>
=======================================
--- /docs/jdocbook-mobicents/pom.xml Thu Apr 5 13:03:09 2012
+++ /docs/jdocbook-mobicents/pom.xml Fri Apr 6 01:22:55 2012
@@ -49,13 +49,13 @@
<dependency>
<groupId>org.mobicents.jdocbook</groupId>
<artifactId>telestax-xslt-ns</artifactId>
-
<version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.FINAL</version>
</dependency>
<dependency>
<groupId>org.mobicents.jdocbook</groupId>
<artifactId>telestax-community-style</artifactId>
<type>jdocbook-style</type>
-
<version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.FINAL</version>
</dependency>
</dependencies>
<configuration>
=======================================
--- /docs/jdocbook-telscale/pom.xml Thu Apr 5 13:03:09 2012
+++ /docs/jdocbook-telscale/pom.xml Fri Apr 6 01:22:55 2012
@@ -49,13 +49,13 @@
<dependency>
<groupId>org.mobicents.jdocbook</groupId>
<artifactId>telestax-xslt-ns</artifactId>
-
<version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.FINAL</version>
</dependency>
<dependency>
<groupId>org.mobicents.jdocbook</groupId>
<artifactId>telestax-community-style</artifactId>
<type>jdocbook-style</type>
-
<version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.FINAL</version>
</dependency>
</dependencies>
<configuration>
=======================================
---
/docs/sources/src/main/resources/en-US/SIP_Servlets_Server_User_Guide.xml
Fri Sep 16 15:16:30 2011
+++
/docs/sources/src/main/resources/en-US/SIP_Servlets_Server_User_Guide.xml
Fri Apr 6 01:22:55 2012
@@ -17,6 +17,7 @@
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="concept-section-SS_Load_Balancer.xml"/>
</chapter>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="concept-chapter-Enterprise-Monitoring-Operations-Management.xml"/>
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="concept-chapter-Security.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="concept-chapter-Advanced_Features_of_the_SIP_Servlets_Server.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="concept-chapter-Best_Practices.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="concept-chapter-JSR289-Errata.xml"/>
=======================================
---
/docs/sources/src/main/resources/en-US/concept-chapter-Advanced_Features_of_the_SIP_Servlets_Server.xml
Mon Aug 1 12:47:32 2011
+++
/docs/sources/src/main/resources/en-US/concept-chapter-Advanced_Features_of_the_SIP_Servlets_Server.xml
Fri Apr 6 01:22:55 2012
@@ -9,7 +9,6 @@
Congestion Control, load balancing with the &PLATFORM_NAME; Load Balancer,
and, exclusively for &SHORT_PLATFORM_NAME; for JBoss, clustering and
failover support.</para>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="concept-section-SS_Media_Support.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="concept-section-SS_Concurrency_and_Congestion_Control.xml"/>
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="concept-section-SS_SIP_Servlet_Security.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="concept-section-SS_STUN_Support.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="concept-section-SS_JSR289_Extensions.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="concept-section-SS_CDI_Telco_Framework.xml"/>
=======================================
---
/docs/sources/src/main/resources/en-US/concept-section-SS_SIP_Servlet_Security.xml
Tue Jan 17 10:14:03 2012
+++
/docs/sources/src/main/resources/en-US/concept-section-SS_SIP_Servlet_Security.xml
Fri Apr 6 01:22:55 2012
@@ -1,82 +1,112 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML
V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % BOOK_ENTITIES SYSTEM "SIP_Servlets_Server_User_Guide.ent">
%BOOK_ENTITIES;
]>
<section id="sss-SIP_Servlet_Security">
<title>SIP Servlets Application Security</title>
- <para>The information present in SIP requests often contains sensitive
user information. To protect user information, SIP Security can be enabled
on the server, and within the SIP application to mitigate the risk of
unauthorised access to the information.</para>
- <para>Application security varies depending on the server type used. The
following procedures describe how to configure the JBoss Application
Server, and the Tomcat server.</para>
+
+ <para>Application security varies depending on the server type used. The
+ following procedures describe how to configure the JBoss Application
Server,
+ and the Tomcat server.</para>
+
<procedure>
<title>Enable SIP Application Security in JBoss Application
Server</title>
+
<step>
<title>Add Security Policy to Server</title>
+
<orderedlist>
<listitem>
<para>Open a terminal and navigate to the conf directory:</para>
+
<programlisting>home]$ cd server/default/conf/</programlisting>
</listitem>
+
<listitem>
- <para>Open <literal>login-config.xml</literal> (using your
preferred editor) and append the security policy to the file:</para>
- <programlisting role="XML"><![CDATA[
-<application-policy name="sip-servlets">
-<authentication>
- <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule"
- flag = "required">
- <module-option name="usersProperties">props/sip-servlets-
- users.properties</module-option>
- <module-option name="rolesProperties">props/sip-servlets-
- roles.properties</module-option>
- <module-option name="hashAlgorithm">MD5</module-option>
- <module-option name="hashEncoding">rfc2617</module-option>
- <module-option name="hashUserPassword">false</module-option>
- <module-option name="hashStorePassword">true</module-option>
- <module-option name="passwordIsA1Hash">true</module-option>
- <module-option name="storeDigestCallback">
- org.jboss.security.auth.spi.RFC2617Digest</module-option>
- </login-module>
-</authentication>
-</application-policy>]]>
+ <para>Open <literal>login-config.xml</literal> (using your
preferred
+ editor) and append the security policy to the file:</para>
+
+ <programlisting role="XML">
+<application-policy name="sip-servlets">
+<authentication>
+ <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule"
+ flag = "required">
+ <module-option name="usersProperties">props/sip-servlets-
+ users.properties</module-option>
+ <module-option name="rolesProperties">props/sip-servlets-
+ roles.properties</module-option>
+ <module-option name="hashAlgorithm">MD5</module-option>
+ <module-option name="hashEncoding">rfc2617</module-option>
+ <module-option name="hashUserPassword">false</module-option>
+ <module-option name="hashStorePassword">true</module-option>
+ <module-option name="passwordIsA1Hash">true</module-option>
+ <module-option name="storeDigestCallback">
+ org.jboss.security.auth.spi.RFC2617Digest</module-option>
+ </login-module>
+</authentication>
+</application-policy>
</programlisting>
</listitem>
</orderedlist>
</step>
+
<step>
<title>Update SIP Server User Properties File</title>
+
<orderedlist>
<listitem>
<para>Open a terminal and navigate to the /props
directory:</para>
+
<programlisting>home]$ cd server/default/props/</programlisting>
</listitem>
+
<listitem>
- <para>Open <literal>sip-servlets-users.properties</literal> and
append the user lines to the file:</para>
- <programlisting> <![CDATA[
+ <para>Open <literal>sip-servlets-users.properties</literal> and
+ append the user lines to the file:</para>
+
+ <programlisting>
# A sample users.properties file, this line creates user "admin" with
# password "admin" for "sip-servlets-realm"
- admin=<A1_cryptographic_string>]]>
+ admin=<A1_cryptographic_string>
</programlisting>
</listitem>
+
<listitem>
- <para>To create <A1_cryptographic_string>, execute the
following command in a terminal:</para>
+ <para>To create <A1_cryptographic_string>, execute the
+ following command in a terminal:</para>
+
<programlisting>home]$ java
-cp ../../common/lib/jbosssx-server.jar
org.jboss.security.auth.spi.RFC2617Digest admin sip-servlets-realm
<password></programlisting>
</listitem>
+
<listitem>
- <para>Copy the A1 hash, and paste it into the admin parameter in
the previous step.</para>
+ <para>Copy the A1 hash, and paste it into the admin parameter in
the
+ previous step.</para>
</listitem>
+
<listitem>
- <para>Save and close
<literal>sip-servlets-users.properties</literal>.</para>
+ <para>Save and close
+ <literal>sip-servlets-users.properties</literal>.</para>
</listitem>
</orderedlist>
</step>
+
<step>
<title>Update the SIP Server Roles File</title>
+
<orderedlist>
<listitem>
<para>Open a terminal and navigate to the /props
directory:</para>
+
<programlisting>home]$ cd server/default/props/</programlisting>
</listitem>
+
<listitem>
- <para>Open <literal>sip-servlets-roles.properties</literal>
(using your preferred editor) and append the following information to the
file:</para>
+ <para>Open <literal>sip-servlets-roles.properties</literal>
(using
+ your preferred editor) and append the following information to
the
+ file:</para>
+
<programlisting>
# A sample roles.properties file for use with some roles
# Each line in this file assigns roles to the users defined in
@@ -86,103 +116,135 @@
</listitem>
</orderedlist>
</step>
+
<step>
<title>Add the Security Domain to the SIP Application</title>
+
<orderedlist>
<listitem>
- <para>Open the <literal>jboss-web.xml</literal> file for the SIP
application to which security is required.</para>
+ <para>Open the <literal>jboss-web.xml</literal> file for the SIP
+ application to which security is required.</para>
</listitem>
+
<listitem>
- <para>Add the <markup><security-domain></markup> element
as a child of the <markup><jboss-web></markup> element:</para>
+ <para>Add the <markup><security-domain></markup> element
as a
+ child of the <markup><jboss-web></markup> element:</para>
+
<programlisting role="XML">
-<![CDATA[<jboss-web >
-<!--Uncomment the security-domain to enable security. You will need to
edit the htmladaptor-->
-<!--login configuration to setup the login modules used to authentication
users.-->
- <security-domain>java:/jaas/sip-servlets</security-domain>
-</jboss-web >]]>
+<jboss-web >
+<!--Uncomment the security-domain to enable security. You will need to
edit the htmladaptor-->
+<!--login configuration to setup the login modules used to
authentication users.-->
+ <security-domain>java:/jaas/sip-servlets</security-domain>
+</jboss-web >
</programlisting>
</listitem>
</orderedlist>
</step>
+
<step>
<title>Add Security Constraints to the SIP Application</title>
+
<orderedlist>
<listitem>
- <para>Open the <literal>sip.xml</literal> file for the SIP
application.</para>
+ <para>Open the <literal>sip.xml</literal> file for the SIP
+ application.</para>
</listitem>
+
<listitem>
- <para>Add the <markup><security-domain></markup> element
as a child of the <markup><jboss-web></markup> element:</para>
- <programlisting role="XML"><![CDATA[
-<security-constraint>
- <display-name>REGISTER Method Security Constraint</display-name>
- <resource-collection>
- <resource-name>SimpleSipServlet</resource-name>
- <description>Require authenticated REGISTER requests</description>
- <servlet-name>SimpleSipServlet</servlet-name>
- <sip-method>REGISTER</sip-method>
- </resource-collection>
- <auth-constraint>
- <role-name>caller</role-name>
- </auth-constraint>
-</security-constraint>
-<login-config>
- <auth-method>DIGEST</auth-method>
- <realm-name>sip-servlets-realm</realm-name>
-</login-config>]]>
+ <para>Add the <markup><security-domain></markup> element
as a
+ child of the <markup><jboss-web></markup> element:</para>
+
+ <programlisting role="XML">
+<security-constraint>
+ <display-name>REGISTER Method Security
Constraint</display-name>
+ <resource-collection>
+ <resource-name>SimpleSipServlet</resource-name>
+ <description>Require authenticated REGISTER
requests</description>
+ <servlet-name>SimpleSipServlet</servlet-name>
+ <sip-method>REGISTER</sip-method>
+ </resource-collection>
+ <auth-constraint>
+ <role-name>caller</role-name>
+ </auth-constraint>
+</security-constraint>
+<login-config>
+ <auth-method>DIGEST</auth-method>
+ <realm-name>sip-servlets-realm</realm-name>
+</login-config>
</programlisting>
</listitem>
</orderedlist>
</step>
</procedure>
+
<procedure>
<title>Enable SIP Application Security in Tomcat Server</title>
+
<step>
<title>Activate the Memory Realm in Catalina:</title>
+
<orderedlist>
<listitem>
- <para>Open a terminal and navigate to the
<filename>/conf</filename> directory:</para>
+ <para>Open a terminal and navigate to the
<filename>/conf</filename>
+ directory:</para>
+
<programlisting>home]$ cd
server/default/<tomcat_home>/conf/</programlisting>
</listitem>
+
<listitem>
- <para>Open <literal>server.xml</literal> and uncomment the
following line:</para>
- <programlisting role="XML"><![CDATA[<!--<Realm
className="org.apache.catalina.realm.MemoryRealm"/>-->]]></programlisting>
+ <para>Open <literal>server.xml</literal> and uncomment the
following
+ line:</para>
+
+ <programlisting role="XML"><!--<Realm
className="org.apache.catalina.realm.MemoryRealm"/>--></programlisting>
</listitem>
</orderedlist>
</step>
+
<step>
<title>Update SIP Server User Properties File</title>
+
<orderedlist>
<listitem>
- <para>In the <filename>/conf</filename> directory, open
<literal>tomcat-users.xml</literal> (using your preferred editor) and
append the following <markup><user></markup> child element:</para>
- <programlisting role="XML"><![CDATA[<user name="user"
password="password" roles="caller"/>]]></programlisting>
+ <para>In the <filename>/conf</filename> directory, open
+ <literal>tomcat-users.xml</literal> (using your preferred editor)
+ and append the following <markup><user></markup> child
+ element:</para>
+
+ <programlisting role="XML"><user name="user"
password="password" roles="caller"/></programlisting>
</listitem>
</orderedlist>
</step>
+
<step>
<title>Add Security Constraints to the SIP Application</title>
+
<orderedlist>
<listitem>
- <para>Open the <literal>sip.xml</literal> file for the SIP
application to which security is required.</para>
+ <para>Open the <literal>sip.xml</literal> file for the SIP
+ application to which security is required.</para>
</listitem>
+
<listitem>
- <para>Add the <markup><security-domain></markup> child
element to the <markup><jboss-web></markup> element:</para>
- <programlisting role="XML"><![CDATA[
-<security-constraint>
- <display-name>REGISTER Method Security Constraint</display-name>
- <resource-collection>
- <resource-name>SimpleSipServlet</resource-name>
- <description>Require authenticated REGISTER requests</description>
- <servlet-name>SimpleSipServlet</servlet-name>
- <sip-method>REGISTER</sip-method>
- </resource-collection>
- <auth-constraint>
- <role-name>caller</role-name>
- </auth-constraint>
-</security-constraint>
-<login-config>
- <auth-method>DIGEST</auth-method>
- <realm-name>sip-servlets-realm</realm-name>
-</login-config>]]>
+ <para>Add the <markup><security-domain></markup> child
element
+ to the <markup><jboss-web></markup> element:</para>
+
+ <programlisting role="XML">
+<security-constraint>
+ <display-name>REGISTER Method Security
Constraint</display-name>
+ <resource-collection>
+ <resource-name>SimpleSipServlet</resource-name>
+ <description>Require authenticated REGISTER
requests</description>
+ <servlet-name>SimpleSipServlet</servlet-name>
+ <sip-method>REGISTER</sip-method>
+ </resource-collection>
+ <auth-constraint>
+ <role-name>caller</role-name>
+ </auth-constraint>
+</security-constraint>
+<login-config>
+ <auth-method>DIGEST</auth-method>
+ <realm-name>sip-servlets-realm</realm-name>
+</login-config>
</programlisting>
</listitem>
</orderedlist>