Crowd 1.4 : Configuring Crowd to Work with SSL
This page last changed on May 07, 2008 by smaddox.
When web applications are accessed across the internet, there is always the possibility of usernames and passwords being intercepted by intermediaries. These intercepts may occur when the data is travelling between a client and the server. It is often a good idea to enable access via HTTPS (HTTP over SSL) and require the use of HTTPS for pages where passwords are sent. In some cases where transmitted data is sensitive, all pages should be accessed via HTTPS.
On this page: Error formatting macro: toc: java.lang.NullPointerException
Using Crowd over SSLThe process of enabling SSL access is specific to each application server, but specifying which pages require protection is generic. Below we describe the process for Tomcat, the application server bundled with Crowd. Step 1: Enable Tomcat SSL AccessEdit CROWD/apache-tomcat/conf/server.xml, and at the bottom before the </Service> tag, add this section (or uncomment it if it's already there): <Connector port="8443" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" disableUploadTimeout="true" acceptCount="100" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" /> This enables SSL access on port 8443. (The default for HTTPS is 443, but just as Tomcat uses 8080 instead of 80 to avoid conflicts, 8443 is used instead of 443 here). Step 2: Create or Import your SSL Key (Self-Signed or CA-Issued)You can either create a self-signed SSL key or import a certificate issued by a Certificate Authority (CA). We describe both methods below. Creating a Self-Signed SSL KeyYou can create a self-signed key for testing purposes with one of the following commands: %JAVA_HOME%\bin\keytool \-genkey \-alias tomcat \-keyalg RSA (Windows) $JAVA_HOME/bin/keytool \-genkey \-alias tomcat \-keyalg RSA (Unix) The keytool utility will prompt you for two passwords: the keystore password and the key password for Tomcat. You must use the same value for both passwords, and the value must be either:
For information on adding a key pair issued by a Certificate Authority (CA), refer to the section entitled 'Installing a Certificate from a Certificate Authority' in the Apache Tomcat documentation.
Importing a CA-Issued CertificateWhen using certificates issued by a Certificate Authority, you also need import the certificate using the keytool command, rather than generating a self-signed key. Here is an example of the command: keytool \-import \-alias tomcat \-file certificate.cer \-keystore some/path/to/file \-storepass something.secure
The -file is your certificate and the -keystore is an optional destination, but it will guarantee that you know where your keystore is. By default, the keystore is placed in your user home directory. You can refer to the following Sun documentation for more information on the keytool: Try this blog post for a handy tutorial: Now edit the server.xml file as described in section 'Edit the Tomcat Configuration File' in the Apache Tomcat documentation. Basically, you'll need to add the keystoreFile and keystorePass to the SSL Connector definition to match your keystore settings. Step 3: Modify crowd.propertiesModify your crowd-webapp/WEB-INF/classes/crowd.properties file to reflect your new SSL settings. For example: #Wed Apr 09 12:36:21 EST 2008 session.lastvalidation=session.lastvalidation session.isauthenticated=session.isauthenticated application.password=password application.name=crowd session.validationinterval=0 crowd.server.url=https\://localhost:8443/crowd/services/ session.tokenkey=session.tokenkey application.login.url=https\://localhost:8443/crowd/console/ Step 4: Create or Modify setenv.sh or setenv.batIn order to ensure that XFire calls work over SSL you will need to pass keystore values to the JVM. To do this either edit or create a setenv.sh or setenv.bat file located in Tomcat's bin directory: apache-tomcat/bin/setenv.sh or setenv.bat The contents of the file should look similar to this: JAVA_OPTS="-Xms128m -Xmx256m $JAVA_OPTS -Djavax.net.ssl.keyStore=/<pathtokeystore>/.keystore -Djavax.net.ssl.keyStorePassword=changeit -Djavax.net.ssl.trustStore=/<pathtokeystore>/.keystore -Djavax.net.ssl.trustStorePassword=changeit"
Replace <pathtokeystore> with the path to your .keystore file and the password with your keystore's password if modified. Now restart your Crowd instance. You should be able to access Crowd at this URL: https://localhost:8443/crowd/console TroubleshootingHere are some troubleshooting tips if you are using a self-signed key created by keytool, as described above. When you enter 'https://localhost:8443' in your browser, if you get a message such as 'Cannot establish a connection to the server at localhost:8443', look for error messages in your logs/catalina.out log file. Here are some possible errors with explanations: Can't Find the Keystorejava.io.FileNotFoundException: /home/idaniel/.keystore (No such file or directory) This indicates that Tomcat cannot find the keystore. The keytool utility creates the keystore as a file called .keystore in the current user's home directory. For Unix/Linux the home directory is likely to be /home/<username>. For Windows it is likely to be C:\Documents And Settings\<UserName>. Make sure you are running Crowd as the same user who created the keystore. If this is not the case, or if you are running Crowd on Windows as a service, you will need to specify where the keystore file is in conf/server.xml. Add the following attribute to the connector tag you uncommented: keystoreFile="<location of keystore file>" Incorrect Passwordjava.io.IOException: Keystore was tampered with, or password was incorrect You used a different password than 'changeit'. You must either use 'changeit' for both the keystore password and for the key password for Tomcat, or if you want to use a different password, you must specify it using the keystorePass attribute of the Connector tag, as described above. Passwords don't Matchjava.io.IOException: Cannot recover key You specified a different value for the keystore password and the key password for Tomcat. Both passwords must be the same. To find out more about the options that Tomcat offers, please take a look at the Apache Tomcat documentation. Using SSL between an LDAP Server and CrowdMicrosoft Active Directory Connector using SSL CertificatePlease refer to Configuring an SSL Certificate for Microsoft Active Directory. Other LDAP ServersFor other LDAP servers, please consult your LDAP server documentation. On the Crowd side, when configuring the connector properties, you will have to simply check the 'Secure SSL' box and make sure you use the correct port in the 'URL' field (usually 636). RELATED TOPICSConfiguring an SSL Certificate for Microsoft Active Directory |
![]() |
Document generated by Confluence on May 08, 2008 19:39 |