Personal tools
You are here: Home GRIA Documentation Documentation 5.3 Reference Manuals Service Installation Manual (all services)

Service Installation Manual (all services)

Note: Return to reference manual view.

This guide contains the core installation instructions that are common to all GRIA services. Topics covered include installing Java and Tomcat, war file deployment and firewall configuration.

1. Introduction

Installing the prerequisites

GRIA services are distributed in war files. This guide assumes you have already downloaded and unpacked one of the GRIA packages. Inside it you will find the war file.

Once the pre-requisites have been set-up and the war file has been deployed, the web-based administration interface will guide you through the rest of the installation process.

Prerequisites

Currently, we provide documented instructions for installation on the following:

  • Debian
  • Fedora
  • SuSE
  • Ubuntu
  • Windows XP and Windows 2003 Server

GRIA has also been installed on Red Hat and Mandriva with minor changes to the installation/configuration instructions (please contact GRIA support if you require assistance with these or other operating systems). However, our recommended platforms to use are Ubuntu or SuSE - these Linux distribution contains all of the prerequisites required for GRIA, are straightforward to maintain and patch, and are the platforms that this software has undergone the most testing with.

Whichever operating system you install on, the software prerequisites are:

2. Preparing the Operating System

How to install the prerequisites on various platforms.

2.1. Windows

Preparing Windows XP and Windows 2003 Server

Installing Windows

Before installing the GRIA package on a Windows system, you will require the following:

  • The Windows installation CD, Service Packs, etc.
  • User with administrator privileges to install GRIA.

N.B. There are several ways to install and configure Windows, so you are advised to consult your system manager and set-up the system according to your needs.

This page explains how to install and configure all Windows prerequisites and how to configure the firewall.

Software Pre-requisites

The Windows distribution CD does not include several of the necessary packages. These are Java 6.x and Tomcat 5.5.x which must be installed separately. In addition if you are installing the GRIA Basic Application Services then Python is a pre-requisite and, optionally, if you wish to use the demo applications, ImageMagick version 6.0.x or later. The following sections describe how to install and configure these packages for Windows.

Java Installation

Download the SE Update for the Windows platform from Sun (the file will have the form jdk-6ux-windows-i586-p.exe). Double-click on the downloaded binary to run the installer, and during installation use the default values.

Tomcat installation

Download version 5.5.20 or higher of the Windows Service Installer Package.

Install Tomcat by double-clicking on the downloaded package e.g. apache-tomcat-6.0.x.exe. During installation use the default values, ensuring that:

  • the path for JVM points to the SDK directory and NOT the JRE, e.g. C:\Program Files\Java\jdk1.6.0_06
  • a password for the Tomcat admin account is provided.

Configuring the Firewall

The deployed GRIA war (or webapp) should be hosted behind a firewall to ensure that your server can only be accessed on certain ports. You should consult with your systems administrator to determine if you need to run a firewall on the GRIA server machine.

Windows XP by default runs a firewall which blocks ports 8080, and 8443. However, Windows 2003 Server by default does not run a firewall. If you decide to run a firewall on the machine hosting the GRIA services, you will need to open port 8080 and 8443 during installation. The firewall can be configured by: choosing the Windows Firewall from the Control Panel, then click on Exceptions -> Add Port and enter name and number:

  • Tomcat, 8080 and leave transport protocol as TCP
  • Tomcat (secure), 8443 and leave transport protocol as TCP

When you've finished setting up GRIA you can block port 8080 again.

Configuring NTP

In order to provide some synchronisation between the clocks on machines that the various GRIA packages are installed on, it is recommended to run an NTP client service that will synchronise your system with an Internet time server.

There are several NTP client implementations available, e.g. Meinberg's NTP client. If you decide to use this one, then during installation select the default options except for the "Configuration File Settings" dialogue. Here you should select an NTP server from the "Want to use predefined public NTP servers" drop-down list that is geographically located closest to you.

Starting Tomcat

The easiest way to control Tomcat on Windows is to use the Tomcat Monitor tool. This is available by selecting Start -> All Programs-> Apache Tomcat 5.5 -> Monitor Tomcat. Once it is started you will notice a new icon on your taskbar. Right-click on the icon to start and stop the tomcat service. If you want the tomcat service to automatically start on boot-up right-click on the icon and select "Configure". Then change startup type to "Automatic".

2.2. OpenSUSE 11

Preparing OpenSuSE 11

Introduction

This page explains how to install and configure all pre-requisites for OpenSUSE 11, configure a firewall on the GRIA server machine and set-up Tomcat for or deployment of a GRIA war.

Software Prerequisites

This page describes how the prerequisites for SuSE can be installed using the YaST systems configuration tool. They are as follows:

  • The Java SDK v1.6.0 (6.0) or higher
    • java-1_6_0-sun
    • java-1_6_0-sun-devel
  • Jakarta Tomcat 6
    • tomcat6-admin-webapps
    • tomcat6-webapps
  • Apache Server v2.2 (an optional package to provide secure access)
    • apache2
    • apache2-prefork
    • apache2-mod_jk
  • A web browser, such as Firefox (can be installed on a different machine)
    • MozillaFirefox
  • A sample application (only required for the GRIA Basic Application Services package)
    • ImageMagick

You can use either Tomcat or Apache to provide secure access. If you are unsure then choose Tomcat as it is easier to set up.

In order to provide some synchronisation between the clocks on machines that the various GRIA packages are installed on, it is recommended that you run an NTP client that will synchronise your system with an Internet time server. Having installed the Linux base platform, configure the Network Services to use an NTP server. This is done as follows:

  1. Run YaST and select 'Network Services'
  2. From here, choose 'NTP Client' (or 'NTP Configuration') and select an NTP server, setting it to start on boot up. If you don't have an NTP server available on your local network then select a public one e.g. a.ntp.alphazed.net in Great Britain.

Having configured the machine to use NTP, the system should then be restarted to ensure the changes made during the installation of the above pre-requisites are applied.

This completes the installation of the GRIA software prerequisites.

Configuring the Firewall

The deployed GRIA war (or webapp) should be hosted behind a firewall to ensure that your server can only be accessed on certain ports. You should consult with your systems administrator to determine if you need to run a firewall on the machine hosting the GRIA webapp. If so, configure the firewall as follows:

  1. Run YaST
  2. Click on Security and Users.
  3. Click on Firewall.
  4. Select Interfaces from the menu and set interfaces appropriate to you network. You may need to discuss this with your systems administrator.
  5. Select Allowed Services from the menu, then:
    • add a HTTPS server.
    • add a HTTP server.
    • Use the Advanced button to add TCP port 8080. If you intend to use Tomcat for secure access then also add port the 8443.
    • if you require Secure Shell access then also add SSH.
  6. Click on Next and then Accept to finalise the settings.
  7. Start the firewall.

Set-up Tomcat Users

In order to deploy the war file, the Tomcat Manager for application deployment will be used. The Tomcat manager functions are disabled by default.

To enable Tomcat administration and management we must add a role and a tomcat user to the tomcat-users.xml file.

  1. Open the /etc/tomcat6/tomcat-users.xml file with a suitable editor and add this element, replacing ADMIN_PASSWORD with an appropriate password:
    <user username="admin" password="ADMIN_PASSWORD" roles="manager"/>
    
  2. Save the file.

Start Tomcat

Having installed and configured the pre-requisites, the next step it to start Tomcat. The following commands assume that the pre-packaged version of Tomcat has been installed with SuSE.

 

To start Tomcat:

$ su
# /etc/init.d/tomcat6 start

To stop Tomcat:

$ su
# /etc/init.d/tomcat6 stop

To restart Tomcat:

$ su
# /etc/init.d/tomcat6 restart

To get the status of Tomcat:

$ su
# /etc/init.d/tomcat6 status

Test it with your browser by pointing to your machine URL ( http://<host IP>:8080). You should be able to access your Tomcat server home page.

2.3. Fedora

Installation on Fedora 9

Initial system Configuration

There are several ways to install and configure Fedora, we advise consulting your system manager and setup the system according to your needs. In the following sections we describe a simple way to install all the necessary prerequisites for GRIA services on a Fedora system.

Firewall Configuration

For security reasons you should run a firewall. Check your firewall settings using the following command as root:

# system-config-firewall

Ensure in your firewall configuration that the following predefined ports: WWW, and Secure WWW are enabled. Additionally you need to add the following ports 8080 and 8443.

Click on other ports (section to expand) and use the add button to add new ports, type 8080 for the port number and select the protocol type as tcp. Repeat the same steps to add port 8443.

Click next and say yes to overwrite system settings.

 

SELinux Configuration

To start the configuration tool:

# system-config-selinux

Leave the default settings to Enforcing, then from the Modify SELinux Policy expand the HTTP Service Section and click on Allow HTTPD scripts and modules to connect to the network.

 

Date and Time

In order to provide some synchronisation between the clocks on machines that the various GRIA packages are installed on, we recommend running an NTP client service that will synchronise your system with an Internet time server. From the system settings choose Date and Time section choose the Network Time Protocol tab and click on the Enable Network Time Protocol button.

Installing the Software Pre-requisites

Having installed the operating system, the following lists the pre-requisites which must be installed if a GRIA service is to function correctly. It is important to install any dependencies which may also required by these software pre-requisites:

The Fedora distribution include RPM packages for Tomcat and for GNU Java. However, to use GRIA you must install Sun Java. Unfortunately, it is very difficult to configure the pre-packaged Tomcat to use Sun Java, so Tomcat must also be manually installed by following the instructions below.

First, download the Java binary JDK selecting the "Linux self-extracting file" (e.g. jdk-1_5_0_05-linux-i586.bin) and Tomcat packages and place them into /tmp directory on the Fedora Core 5 machine. You may find it easiest to do this by downloading the packages to your desktop machine and copying them to the server. Finally, log in to the server machine as the root user ready to install the software.

Install Java

In order to install Java the following must be done (adjusting the version number to your particular package):

  1. Move to /opt:
    # cd /opt
  2. Unpack the binary from the temporary directory:
    # sh /tmp/jdk-1_5_x_xx-linux-i586.bin
  3. Create a symbolic link within this directory:
    # ln -s jdk1.5.x_xx java

Install Tomcat

The following must be done in order to install Tomcat successfully (adjusting the version number to your particular package):

  1. Tomcat will be installed under the /opt directory, therefore move to this directory with:
    # cd /opt
  2. Unpack the Tomcat tarball from the temporary directory:
    # tar xvfz /tmp/apache-tomcat-5.5.xx.tar.gz
  3. Create a symbolic link for Tomcat
    # ln -s apache-tomcat-5.5.xx tomcat
  4. Tomcat will be most secure if it is not run by root, therefore create a user for the tomcat server to run as e.g. "tomcat" with the user's home directory set to /opt/tomcat:
    # system-config-users

    Create a new user called "tomcat" with a home directory of "/opt/tomcat".

  5. Alter the ownership of the directory to the tomcat user created above:
    # chown -HR tomcat:tomcat tomcat
  6. Configure tomcat to use Sun Java by editting /opt/tomcat/bin/catalina.sh. Open the file (e.g. in vi) and add the line JAVA_HOME=/opt/java to the top of the file after the file header, e.g.:
    # system class path used to start Tomcat.
    #
    # CATALINA_PID (Optional) Path of the file which should contains the pid
    # of catalina startup java process, when start (fork) is used
    #
    # $Id: fc4-pre.htm 3715 2006-04-10 14:01:19Z ajw $
    # -----------------------------------------------------------------------------
    
    JAVA_HOME=/opt/java
    
    # OS specific support. $var _must_ be set to either true or false.
    cygwin=false
    

Setting Up Tomcat Users

In order to deploy the war file, the Tomcat Manager for application deployment will be used. The Tomcat manager functions are disabled by default.

To enable Tomcat administration and management we must add a user with appropriate roles to the /opt/tomcat/conf/tomcat-users.xml file. Do this by adding the line:

<user username="tomcat" password="TOMCAT_PASSWORD" roles="admin,manager"/>
replacing TOMCAT_PASSWORD with a suitable password.

 

Starting Services

As mentioned above, Tomcat should not be run as root, therefore first switch form being the root user to the tomcat user and then start tomcat:

# su tomcat
$ cd /opt/tomcat/bin
$ ./startup.sh

Verify the installation by visiting http://localhost:8080 in your browser.

2.4. Ubuntu/Debian

This document describes how to install GRIA on Ubuntu server. The installation procedure should very similar for Ubuntu desktop and Debian systems too.

Installing Java

Run the following command to install sun-java6-jdk packages:

sudo apt-get install sun-java6-jdk

The system will prompt you to accept the DJK license, reply yes. You can test the installed java version in your system executing the following command:

$ java -version
java version "1.6.0_06"
Java(TM) SE Runtime Environment, Standard Edition (build 1.6.0_06-b02)
Java HotSpot(TM) Client VM (build 1.6.0_06-b22, mixed mode, sharing)

Installing tomcat5

Run the following command to install tomcat5.5 or tomcat6 packages:

$ sudo apt-get install tomcat5.5 tomcat5.5-admin tomcat5.5-webapps

or for tomcat6

$ sudo apt-get install tomcat6 tomcat6-admin tomcat6-webapps

During tomcat installation the system will install automatically an open version of Java as the default system java. In order to make Sun's java the default one run:

sudo update-alternatives --config java

Edit /etc/default/tomcat5.5, 6 to:

  • define JAVA_HOME, e.g.
    JAVA_HOME=/usr/lib/jvm/java-6-sun
  • replace line TOMCAT_SECURITY=yes with the following:
    TOMCAT_SECURITY=no
  • configure JAVA_OPTS to
    JAVA_OPTS="-Djava.awt.headless=true -Xmx512m -Xms128m -XX:MaxPermSize=512m -jvm server"

Edit /var/lib/tomcat5.5/conf/tomcat-users.xml file to add a manager role, e.g.

<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
   ...
   <role rolename="manager"/>
   <role username="manager" password="xxxxxx" roles="manager"/>
   ...
   </tomcat-users>

You need to restart tomcat now:

sudo /etc/init.d/tomcat5.5 restart

At this point refer to the GRIA documentation e.g. GRIA user guide, Deploying the Services to Tomcat.

NOTE: the default port for the tomcat server, for Ubuntu releases up to 8.10, is on 8180 NOT 8080, e.g. http://<servername>:8180

You can change the port number to 8080 if you want by editing /var/lib/tomcat5.5/conf/server.xml and changing the connector port="8180" settings.


Setting the system clock

In order to provide some synchronisation between the clocks on machines that the various GRIA packages are installed on, it is recommended that you run an NTP client service that will synchronise your system with an Internet time server. On Debian and Ubuntu systems, this can be done using the ntpdate or ntp packages, e.g. sudo apt-get install ntp.

2.5. OS X 10.4

OS X 10.4 or more recent

Software Pre-requisites

The Mac OS X installation does not include some of the necessary packages. These are the Xcode Tools that have some optional Java utilities and Tomcat 5.5.x which must be installed. In addition if you are installing the GRIA Basic Application Services then Python is a pre-requisite and, optionally, if you wish to use the demo applications, ImageMagick version 6.0.x or later. The following sections describe how to install and configure these packages for Mac OS X.

Xcode Tools Installation (optional)

Insert the Mac OS X Installation Disc. A new finder window appears with the contents of the disc. Open the Xcode Tools folder and double click to install the XcodeTools.mpkg. During installation use the default options.

Tomcat installation

Download version 5.5.X  of the zip or tar.gz binary distribution.

Export the contents of the archive to the preferred directory.

Using the Terminal.app:

Edit /PathTo/apache-tomcat-5.5.X/conf/tomcat-users.xml file to add a manager role, e.g.

<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
   ...
   <role rolename="manager"/>
   <role username="manager" password="xxxxxx" roles="manager"/>
   ...
   </tomcat-users>
Download commons_io_1.4 package and copy it into lib directory of the manager webapp:
cp /PathTo/commons-io-1.4.jar /PathTo/apache-tomcat-5.5.X/server/webapps/manager/WEB-INF/lib/
Start tomcat now:
/PathTo/apache-tomcat-5.5.X/bin/startup.sh

 

At this point refer to the GRIA documentation e.g. GRIA user guide, Deploying the Services to Tomcat.

 

3. Upgrading

Upgrading an existing installation to a newer version

In general, upgrading is supported only within the same major version of the services. For example, you can upgrade from version 5.0 to 5.1, but not from 3.1 to 5.0 (for which you will have to do a full new installation).

Upgrading can be done via the Tomcat Web Application Manager using the following procedure:

  1. Start up Tomcat and select "Tomcat Manager" from the Administration menu.
  2. Locate the package from the Applications sections.
  3. Select undeploy from the Commands column.
  4. On Windows XP (only) you should now stop and then restart tomcat.
  5. Scroll down to the WAR file to deploy subsection, within the Deploy section. Beside the "Select WAR file to upload" box, click the browse icon and select the WAR file from the unpacked distribution.
  6. Click the Deploy button. An OK message at the top of the page indicates that the WAR has been successfully deployed to Tomcat.

Having successfully deployed the war file, you can invoke it by just clicking on the link in the Applications section.

After deploying a new version and returning to the administration page in your browser, the system will lead you through any remaining upgrade tasks:

  1. You will be asked to select a configuration directory. To upgrade ensure that you select the configuration directory used in the previous installation.
  2. You will be asked to restart tomcat.
  3. You may be informed that your access control policies are out-of-date. Go to the access control page and undeploy the highlighted policies.
    update-pbac.png

    Upgrading access control policies

    When you return to the main administration page, the new default policies will be installed. If you have modified any policies then you will need to merge your changes into the new version.

4. Deploying a Service

How to deploy a GRIA service in your servlet container

4.1. Deploying in Tomcat

Deploying the war file containing the services into the Tomcat container.

Deployment of the war file is based on the standard procedure which should already be familiar to Tomcat users. If, however, this is not the case then this section can be used as a guide on how to deploy and invoke the the web application. The home directory of Tomcat is denoted by <TOMCAT_HOME>

The next steps require the use of a web browser to complete the war file deployment.

  1. Using a web browser, load the main Tomcat server page (e.g. http://<servername>:8080) and select the "Tomcat Manager" link.

    N.B. "<servername>" should be replaced with the IP address or fully qualified hostname of the computer running the Tomcat server.

    You will be prompted for a username and password to be entered before displaying the manager page. Use "admin" as the username and enter the password that was selected either by using the Tomcat installer (WinXP) or by editing the <TOMCAT_HOME>/conf/tomcat-users.xml (Linux) .

  2. The page which loads once login has been successful presents the following sections:
    • Manager - lists the command controls and help functions
    • Applications - lists the applications currently deployed within Tomcat
    • Deploy - options for deploying applications to Tomcat
    • Server Information - lists specific information on Tomcat and the base platform it was installed to

    Scroll down to the WAR file to deploy subsection, within the Deploy section. Beside the "Select WAR file to upload" box, click the browse icon and select the war file, before clicking the "Deploy" button:

  3. An "OK" message at the top of the page indicates that the war has been successfully deployed to Tomcat.

The new webapp should now also be listed within the Applications section. Note here in the last column is where individual applications may be started, stopped, reloaded or if desired undeployed completely from within Tomcat.

This completes the first part of the installation and deployment of the GRIA services.

Having successfully deployed the war file, you can invoke it by just clicking on the webapp's name in the Applications section.

If you get an error page with a message related to the JAVA_HOME environment variable, then this probably means that the Java compiler isn't working. The usual cause of this is trying to run tomcat immediately after installing Java. You must log out and log in again to ensure the JAVA_HOME environment variable is set to the correct location. If you click on the Admin link in the top menu when having this problem you will also get a 401 Not Authorized error without being prompted to log in (check for errors in the catalina.out log file).

4.2. Deploying in JBoss

How to deploy a GRIA service in the JBoss Application Server

Introduction

These instructions are applicable on both Linux and Windows and have been tested on JBoss Application Server 4.0.2 and later.

Procedure

There are two restrictions on deploying a GRIA service in JBoss:

  1. JBoss must be installed in a directory that has no spaces in its path (for instance, not in C:\Program Files).
  2. The GRIA war file must be deployed statically.

To describe how to deploy a GRIA service statically, we will take the example of the GRIA OGSA-DAI service being deployed in the default JBoss server.

GRIA services are supplied as war files. These are actually just zip archives. The service must be unzipped by hand but the directory that results must be renamed to end with the .war file extension:

  1. Stop JBoss
  2. Take the GRIA package, e.g. gria-ogsadai-service.war and place it in server/default/deploy.
  3. Change the file extension from "war" to "zip" and unzip the package.
  4. Rename the new directory from e.g. gria-ogsadai-service to gria-ogsadai-service.war.
  5. Remove the zip file.
  6. Start JBoss

Once the service has been deployed, navigate to the GRIA Service in your web browser (e.g. http://localhost:8080/gria-ogsadai-service). The GRIA installation wizard will then guide you through the rest of the configuration process.

5. Service Administration

Describing how to navigate the web portal and perform the initial general configuration.

The Service Administration Page

The GRIA main administation page gives access to the administration pages of the individual services within the same .war file as well as providing configuration, status reporting and logging control for all services.

You can find the administration page by clicking on the web application's link in the Tomcat manager and then clicking on the "Admin" link in the navigation bar at the top of the web application.

Initial Configuration

When first accessed, the services will be greyed out and the system will lead you to provide the required general configuration information, which is:

  • The location of a configuration directory in which to store the service configuration. This is not stored inside the webapp so that it will not be lost when upgrading.
  • A keystore containing the service's private key. This allows clients to check that they are really using the service they think they are.
  • A location for the database files. GRIA uses hibernate, which allows it to be configured to use a range of database backends. However, the default is to store everything locally in a few files, which saves the need to configure a separate database server.
  • The endpoint address for the service. The default offered should be used in most cases. When users create a new resource, this is the address that the service will tell them to use to access it. If your service is fronted by Apache on another machine, for example, you should give the address of the machine running Apache here.

The Navigation Menu

The navigation menu along the top of the window provides access to various useful pages:

Main
Return to the public page.
Admin
The main administration page.
Check Axis
Check that requires libraries are available for the underlying Axis system.
View logs
View the service log file and edit the logging configuration.
Access control
View the resources and resource types managed by the access control system.
List of services
View the list of services and their operations and WSDL interfaces.
Atom feed
Subscribe to this feed to get notifications of issues or problems with the services.
Send support request
If you have problems or suggestions, please send us a support request.

Service Status Feeds

Each service reports its current status and other important information. Each item is displayed on the main page under the service reporting it. You can also get this information from the Atom feed. This is useful if you have many services to administer, since you can get your news aggregator to subscribe to each one and check them for you.

After the general configuration is done, each service will report that it requires configuration too. Click on any item for more information.

Service specific configuration

For instructions on configuring the specific services, consult the appropriate service manual.

6. Configuring Transport Layer Security

How to configure Tomcat and Apache to use TLS (HTTPS)

6.1. Introduction

What is transport layer security and how to configure it

Transport layer security (TLS) is the term used for encrypting the packets of information sent between the server and the client (and client and server).  It is also used to allow one side to verify the identity of the other party.  In a normal installation it is only the client who verifies the server's identity so that the client is sure that they are communicating with the service they intended to.

In a simple installation, a GRIA service is installed in Tomcat and Tomcat is configured to use TLS.  For extra flexibility and robustness many people want to use the Apache web server as a front end and pass requests on to Tomcat behind.  In this scenario Apache handles the encryption at the transport layer, but will pass requests on to Tomcat for processing.

6.2. Tomcat

General instructions for configuring HTTPS in Tomcat

For full details, see http://tomcat.apache.org/tomcat-5.5-doc/ssl-howto.html.

Edit your Tomcat's conf/server.xml and add the following section (or uncomment and edit the existing one):

<Connector port="8443"
		keystoreFile="/your/location/here/service-keystore.ks"
		keystorePass="your_keystore_password"
		keystoreType="JKS"
		minProcessors="5" maxProcessors="75"
		enableLookups="true" disableUploadTimeout="true"
		acceptCount="100" debug="0" scheme="https" secure="true"
		clientAuth="false" sslProtocol="TLS"/>

Then restart Tomcat.

6.3. JBoss

General instructions for configuring HTTPS in JBoss

The file to edit in JBoss depends on the version. For JBoss 4.0.2 look in server/default/deploy/jbossweb-tomcat55.sar/server.xml file, but for JBoss 4.2.1.GA you must edit server/default/deploy/jboss-web.deployer/server.xml and add the following section (or uncomment and edit the existing one):

<Connector port="8443" address="${jboss.bind.address}"
    maxThreads="100" strategy="ms" maxHttpHeaderSize="8192"
    emptySessionPath="true"
    scheme="https" secure="true" clientAuth="false"
    keystoreFile="/path/to/your/keystore/service-keystore.ks"
    keystorePass="your_keystore_password"
    keystoreType="JKS" SSLEnabled="true"
    sslProtocol="TLS"/>

Then restart JBoss.

6.4. Apache

How to configure Apache to use HTTPS

6.4.1. Exporting Certificates From Tomcat

How to export the certificates from Tomcat's keystore for use in securing Apache

Java stores keys and certificates in a keystore file, whose format is Java-specific. Apache also needs access to the same items, but cannot read the Java keystore format. Therefore, the key and the certificates must be exported to separate files. It is simplest to store the exported files in the configuration directory along with the keystore.

You should have already created a keystore during the configuration of your service. Begin by opening service-keystore.ks in KeyToolGUI (available for download here).

Exporting certificates

To export the server's certificate:

  1. Right click on the server's key (NOT the Certificate Authority's certificate!).
  2. Choose Export from the menu.
  3. Select Head Certificate and PEM Encoded when exporting.
  4. Save with a .crt extension (eg, as server.crt in your configuration directory).

To export the Certificate Authority's own certificate:

  1. Right click on the Certificate Authority's certificate.
  2. Choose Export from the menu.
  3. Select Head Certificate and PEM Encoded when exporting.
  4. Save with a .crt extension (eg: CA.crt).

Exporting the private key

  1. Right click on the server's key.
  2. Choose Export from the menu.
  3. Select Private Key and Certificates and PKCS #12 and click OK.
  4. Enter the keystore password when prompted (use the same password for the exported key).
  5. Save with a .p12 extension (eg: private-key.p12).
  6. Convert from PKCS#12 format to PEM:
    $ openssl pkcs12 -in private-key.p12 -out private-key.pem -nodes

Once you have the three files (server.crt, CA.crt and private-key.pem) and the crl.pem file (which should be obtained from your Certificate Authority), you are ready to continue with the instructions specifi to your Apache version and operating system.

6.4.2. Firewalls

How to configure firewalls for Apache

Ensure that your GRIA server firewall allows access to Apache HTTPS port, for more information see the section "Configure the Firewall" in the GRIA installation documentation relevant to your package and operating system.

Tomcat's own port (8080) should not be accessible from anywhere except for the machine running Apache. Make sure that it is firewalled by attempting to connect to it from another machine.

 

6.4.3. Apache 2

How to configure Apache 2 to use HTTPS

6.4.3.1. Debian 3.x and Ubuntu 6.xx

This section describes how to configure Apache 2.0 for Debian and Ubuntu systems to provide transport layer security for GRIA services.

Firstly install the necessary apache2 packages, e.g. $ sudo apt-get install apache2 libapache2-mod-jk.

Prepare certificate entries for Apache:

Download the sample gria-services.conf file and edit it accordingly, e.g. provide valid entries for the following file which you should have prepared in the previous page:

 

  • SSLCertificateFile
  • SSLCertificateKeyFile
  • SSLCACerticateFile
  • SSLCARevocationFile

Note: do not uncomment any of the ProxyPass lines!

Copy gria-services.conf into /etc/apache2/sites-available.

Edit /etc/apache2/ports.conf, and add the line:

Listen 443

Now you need to enable the new 'site' with the Apache2 enable-site utility, and the SSL and JK2 modules:

  • a2ensite gria-services.conf
  • a2enmod ssl
  • a2enmod jk

NOTE: you may prompted to reload apache for each of these steps e.g.

/etc/init.d/apache2 reload.

 

Configure apache to forward all HTTPS requests to tomcat:

configuring Apache to use mod_jk you need to edit /etc/apache2/mods-available/jk.load to include the following:

LoadModule jk_module /usr/lib/apache2/modules/mod_jk.so
# Where to find workers.properties
JkWorkersFile /etc/apache2/workers.properties
# Where to put jk logs
JkLogFile     /var/log/apache2/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel    info
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# JkOptions indicate to send SSL KEY SIZE,
JkOptions     +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat     "%w %V %T"
# Send everything for context /examples to worker named worker1 (ajp13)
JkMount /gria-basic-app-services worker1
JkMount /gria-basic-app-services/* worker1
JkMount /gria-client-mgt worker1
JkMount /gria-client-mgt/* worker1
JkMount /gria-service-provider-mgt worker1
JkMount /gria-service-provider-mgt/* worker1

To complete the configuration you need to create a workers.properties file in /etc/apache2 with the following contents:

# Define 1 real worker using ajp13
worker.list=worker1
# Set properties for worker1 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
worker.worker1.lbfactor=50
worker.worker1.cachesize=10
worker.worker1.cache_timeout=600
worker.worker1.socket_keepalive=1
worker.worker1.reclycle_timeout=300

Restart Apache

You can now access the GRIA admin pages through HTTPS, e.g. https://localhost/gria-basic-app-services

6.4.3.2. Fedora

How to configure Apache on Fedora to use HTTPS

6.4.3.2.1. Fedora Core 3 and 4

How to configure Apache to use HTTPS on Fedora Core 3 and 4

Apache2 RPM Packages

Make sure the following packages are installed:

  • httpd-manual-2.0.52-3
  • httpd-suexec-2.0.52-3
  • system-config-httpd-1.3.1-1
  • httpd-2.0.52-3
  • mod_ssl-2.0.52-3

e.g. check installed packages using:

# rpm -qa | grep "httpd\|mod_ssl"

Connecting Tomcat with Apache

Install the Apache mod_jk Module

The mod_jk package comes with the Fedora Core 4 operating system. To install it, log in as root and execute this command:

# yum install mod_jk

For Fedora Core 3, the mod_jk module may be obtained from the jpackage site. The required package is called "mod_jk-ap20". The easiest way to download and install the package is to execute the following commands as root:

# cd /tmp
# wget http://mirrors.dotsrc.org/jpackage/1.6/fedora-3/RPMS.free/mod_jk-ap20-1.2.8-1jpp.i386.rpm
# rpm --import http://www.jpackage.org/jpackage.asc
# yum localinstall mod_jk-ap20-1.2.8-1jpp.i386.rpm

wget downloads the file from the primary jpackage mirror site. The rpm command installs the jpackage public key for package verification, and the yum command performs the installation.

Configuring Apache to use mod_jk

To cause Apache to load and use mod_jk, you must create a file in /etc/httpd/conf.d. The file should be called jk.conf and should be similar (if not the same) to this:

# Load mod_jk module
LoadModule    jk_module  /etc/httpd/modules/mod_jk.so
# Where to find workers.properties
JkWorkersFile /etc/httpd/conf/workers.properties
# Where to put jk logs
JkLogFile     /var/log/httpd/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel    info
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# JkOptions indicate to send SSL KEY SIZE, 
JkOptions     +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format 
JkRequestLogFormat     "%w %V %T"
# Send everything for context /examples to worker named worker1 (ajp13)
JkMount /gria-basic-app-services worker1 
JkMount /gria-basic-app-services/* worker1
JkMount /gria-client-mgt worker1 
JkMount /gria-client-mgt/* worker1
JkMount /gria-service-provider-mgt worker1
JkMount /gria-service-provider-mgt/* worker1

As well as configuring the mod_jk module, this also instructs Apache to pass on requests for GRIA to "worker1".

Configuring the Tomcat Worker

To complete the configuration, another file must be created. This is the workers.properties file referenced in the last section. Create the file /etc/httpd/conf/workers.properties with the following contents:

# Define 1 real worker using ajp13
worker.list=worker1
# Set properties for worker1 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
worker.worker1.lbfactor=50
worker.worker1.cachesize=10
worker.worker1.cache_timeout=600
worker.worker1.socket_keepalive=1
worker.worker1.reclycle_timeout=300

This configuration instructs "worker1" to pass on requests to port 8009 using the ajp13 protocol. The default Tomcat installation will already be listening for this sort of communication and as a result, request for the GRIA web application will be passed on to Tomcat.

Securing Apache

Add gria-services.conf File in conf.d

Download the gria-services.conf sample file and place it in /etc/httpd/conf.d.

Edit gria-services.conf so that the file locations of the following settings give the locations of the files you exported from your keystore in the previous page.

  • SSLCertificateFile
  • SSLCertificateKeyFile
  • SSLCACertificateFile
  • SSLCARevocationFile

In addition, replace apache2 by httpd in the ErrorLog and TransferLog lines, i.e.

     ...
     ErrorLog /var/log/httpd/grid-error.log
     ...
     TransferLog /var/log/httpd/grid-access.log
     ...

Edit /etc/httpd/conf.d/ssl.conf

Edit /etc/httpd/conf.d/ssl.conf to contain the following directives only

LoadModule ssl_module modules/mod_ssl.so
Listen 443
AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl    .crl
SSLPassPhraseDialog  builtin
SSLSessionCache         shmcb:/var/cache/mod_ssl/scache(512000)
SSLSessionCacheTimeout  300
SSLMutex default
SSLRandomSeed startup file:/dev/urandom  256
SSLRandomSeed connect builtin
SSLCryptoDevice builtin

Start Apache

Start Apache using the command below. Entering this command may also prompt you for the private key password if it was encrypted:

# service httpd restart

You may also want to configure your system to start Apache if it is rebooted:

# chkconfig httpd on

N.B. Apache will not be able to start automatically if your server's private key is encrypted, as it cannot start without the password being entered.

You can now access the GRIA admin pages through HTTPS, e.g. https://localhost/GRIA.

6.4.3.2.2. Fedora Core 10

How to configure Apache to use HTTPS on Fedora Core 10

Apache2.2 RPM Packages

Make sure the following packages are installed:

  • system-config-httpd.i386
  • httpd.i386
  • mod_ssl.i386

e.g. check installed packages using:

# rpm -qa | grep "httpd\|mod_ssl"

Connecting and Securing Tomcat with Apache

There is no need to install extra Apache modules since Apache 2.2,  Fedora Core  includes module mod_proxy_ajp.

<VirtualHost _default_:443> section

Edit the <VirtualHost _default_.:443> section of /etc/httpd/conf.d/ssl.conf so that you can specify the locations of the files you exported from your keystore in the previous section.

  • SSLCertificateFile
  • SSLCertificateKeyFile
  • SSLCACertificateFile*
  • SSLCARevocationFile (if you have one)
For example:
SSLCertificateFile /etc/gria/server.crt
SSLCertificateKeyFile  /etc/gria/private-key.pem
SSLCACertificateFile /etc/gria/CA.crt
SSLCARevocationFile /etc/gria/crl.pem

Also uncomment and set the SSLVerifyDepth to 1:

SSLVerifyDepth 1

*If you want to request client certificates and leave trust validation to GRIA then comment out the SSLCertificateChainFile directive and replace it with

  • SSLVerifyClient optional_no_ca

 

According to the GRIA package(s) you are installing, also add the appropriate line(s) below, (for FC10 add these lines at the end of proxy_ajp.conf file)

ProxyPass /gria-basic-app-services ajp://localhost:8009/gria-basic-app-services
ProxyPass /gria-client-mgt ajp://localhost:8009/gria-client-mgt
ProxyPass /gria-service-provider-mgt ajp://localhost:8009/gria-service-provider-mgt

Start Apache

Start Apache using the command below. Entering this command may also prompt you for the private key password if it was encrypted:

# service httpd restart

You may also want to configure your system to start Apache if it is rebooted:

# chkconfig httpd on

N.B. Apache will not be able to start automatically if your server's private key is encrypted, as it cannot start without the password being entered.

You can now access the GRIA admin pages through HTTPS, e.g. https://localhost/GRIA.

6.4.3.3. SUSE 9.2-10

Configuring Apache2 for HTTPS in SUSE versions 9.2-10

The goal here is to successfully secure Tomcat with Apache by integrating Tomcat's abilities into an existing Apache installation using the mod_jk and Ajp13Connector.

  1. Download the gria-services.conf sample file and place it in /etc/apache2/vhosts.d
  2. Edit gria-services.conf so that the file locations of the following settings give the locations of the files you exported from your keystore on the previous page.
    • SSLCertificateFile
    • SSLCertificateKeyFile
    • SSLCACertificateFile
    • SSLCARevocationFile
  3. Edit the /etc/sysconfig/apache2 file and do the following:
    • Add "-D SSL" to the APACHE_SERVER_FLAGS variable to allow SSL to be enabled when the Apache Sever is started:
      APACHE_SERVER_FLAGS="-D SSL"
    • Set a reasonable value for the time required to enter the password when starting apache:
      APACHE_START_TIMEOUT="30"
    • Include the module "jk" to the list of apache2 modules within the APACHE_MODULES variable, e.g.:
      APACHE_MODULES="access actions alias auth auth_dbm dir env expires include log_config mime negotiation setenvif ssl jk"
  4. Copy the file /usr/share/doc/packages/mod_jk-ap20/jk.conf to /etc/apache2/conf.d:
    # cp /usr/share/doc/packages/mod_jk-ap20/jk.conf /etc/apache2/conf.d
  5. Copy the file /usr/share/doc/packages/mod_jk-ap20/workers.properties to /etc/tomcat5/base:
    # cp /usr/share/doc/packages/mod_jk-ap20/workers.properties /etc/tomcat5/base
  6. The apache2 configuration must then be updated using the following command:
    # SuSEconfig --module apache2
    
  7. Stop the Tomcat server with the following command:
    # rctomcat5 stop
  8. Edit the file /etc/apache2/conf.d/jk.conf and add the following pieces of code to the file within the <IfModule> tag:
    • For GRIA Basic App Services add the following section:
      # The following line mounts /GRIA basic app services/ uri (and all files) to tomcat
      JkMount /gria-basic-app-services/* ajp13
      	
      Alias /gria-basic-app-services "/srv/www/tomcat5/base/webapps/gria-basic-app-services"
      <Directory "/srv/www/tomcat5/base/webapps/gria-basic-app-services">
       Options Indexes FollowSymLinks
       allow from all
      </Directory>
      #To prevent users from listing contents
      <Location "/gria-basic-app-services/WEB-INF/">
       AllowOverride None
       deny from all
      </Location>
    • For GRIA Service Provider Management add the following section:
      # The following line mounts /GRIA service provider management / uri (and all files) to tomcat
      JkMount /gria-service-provider-mgt/* ajp13
      	
      Alias /gria-service-provider-mgt "/srv/www/tomcat5/base/webapps/gria-service-provider-mgt"
      <Directory "/srv/www/tomcat5/base/webapps/gria-service-provider-mgt">
       Options Indexes FollowSymLinks
       allow from all
      </Directory>
      #To prevent users from listing contents
      <Location "/gria-service-provider-mgt/WEB-INF/">
       AllowOverride None
       deny from all
      </Location>
    • For GRIA Client Management add the following section:
      # The following line mounts /GRIA client management / uri (and all files) to tomcat
      JkMount /gria-client-mgt/* ajp13
      	
      Alias /gria-client-mgt "/srv/www/tomcat5/base/webapps/gria-client-mgt"
      <Directory "/srv/www/tomcat5/base/webapps/gria-client-mgt">
       Options Indexes FollowSymLinks
       allow from all
      </Directory>
      #To prevent users from listing contents
      <Location "/gria-client-mgt/WEB-INF/">
       AllowOverride None
       deny from all
      </Location>

  9. Start the Tomcat server with the command:
    # rctomcat5 start
  10. Restart the apache2 server with the following command:
    # rcapache2 restart
  11. Access the GRIA admin pages through HTTPS, eg using https://localhost/gria-basic-app-services.

6.4.4. Apache 2.2

Configuring HTTPS for Apache 2.2

6.4.4.1. Debian 4.x and Ubuntu 7.xx, 8.xx, 9.04

This section describes how to configure Apache 2.2 for Debian/Ubuntu systems to provide transport layer security for GRIA services.

Install Apache 2.2

Install apache2.2 running the command: sudo apt-get install apache2. This command will try to install additionally the following packages:

  • apache2-mpm-worker
  • apache2-utils
  • apache2.2-common

N.B. for Ubuntu 9.04 installations that use the distribution package for tomcat6, you must edit /etc/tomcat6/server.xml and uncomment the line that defines the AJP 1.3 Connector on port 8009, i.e.

<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

After editing server.xml tomcat should be restarted:

$ sudo /etc/init.d/tomcat6 restart

Apache2.2 Configuration

Edit the default apache configuration as follows:

  1. Enable ssl and proxy_ajp modules by running
    $ sudo a2enmod ssl
    $ sudo a2enmod proxy_ajp
  2. Copy the sample gria5.3.1-services.conf file into /etc/apache2/sites-available, and edit it accordingly, i.e. provide the locations of the certificate files previously created using the following parameters:

    • SSLCertificateFile
    • SSLCertificateKeyFile
    • SSLCACertificateFile*
    • SSLCARevocationFile (if you have one)

    *N.B.For Ubuntu 8.04 installations please change the name of parameter SSLCACertificateFile to SSLCertificateChainFile in gria-services.conf file.

    In addition, according to the GRIA packages you are installing uncomment one or more of the following lines:

    #ProxyPass /gria-basic-app-services ajp://localhost:8009/gria-basic-app-services
    #ProxyPass /gria-client-mgt ajp://localhost:8009/gria-client-mgt
    #ProxyPass /gria-service-provider-mgt ajp://localhost:8009/gria-service-provider-mgt

    Save the changes.

  3. Enable the gria-services.conf virtual host:
    $ sudo a2ensite gria-services.conf
  4. Check /etc/apache2/ports.conf file that includes the following line:
    Listen 443
  5. Edit /etc/apache2/mods-enabled/proxy.conf file and comment out the line:
    Deny from all
  6. Restart apache
    $ sudo /etc/init.d/apache2 force-reload

6.4.4.2. Windows

Configuring Apache 2.2 on Windows
This section describes how to configure Apache 2.2 for Windows systems to provide transport layer security for GRIA services.

Install Apache 2.2

Install Apache 2.2 with OpenSSL by downloading and running the Win32 binary installer from http://httpd.apache.org/download.cgi

Apache2.2 Configuration

Edit the default apache configuration as follows:

  1. Enable ssl and proxy_ajp modules by uncommenting the following lines in httpd.conf
    #LoadModule ssl_module modules/mod_ssl.so
    #LoadModule proxy_module modules/mod_proxy.so
    #LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
    
    #Include conf/extra/httpd-ssl.conf
  2. Edit conf\extra\httpd-ssl.conf to provide the absolute paths to the certificate files previously created using the following parameters (N.B. use forward slashes in paths):
    • SSLCertificateFile (e.g. "C:/gria/server.crt")
    • SSLCertificateKeyFile (e.g. "C:/gria/private-key.pem")
    • SSLCACertificateFile (e.g. "C:/gria/CA.crt")
    • SSLCARevocationFile [if you have one] (e.g. "C:/gria/crl.pem")

    In addition, according to the GRIA packages you are installing add one or more of the following lines to httpd-ssl.conf within the <VirtualHost _default_:443>...</VirtualHost> environment:

    ProxyPass /gria-basic-app-services ajp://localhost:8009/gria-basic-app-services
    ProxyPass /gria-client-mgt ajp://localhost:8009/gria-client-mgt
    ProxyPass /gria-service-provider-mgt ajp://localhost:8009/gria-service-provider-mgt

    Save the changes.

  3. Logging. Add the following lines to http-ssl.conf within the <VirtualHost_default_:443> environment (change the Apache install path if not installed to the default directory):
    ErrorLog "C:/Program Files/Apache Software Foundation/Apache2.2/logs/grid-error.log"
    LogLevel info
    TransferLog "C:/Program Files/Apache Software Foundation/Apache2.2/logs/grid-error.log"
  4. Restart apache
  5. N.B.: Ensure any firewall that is running allows access to the services on port 443.

6.4.4.3. openSUSE 11

Configuring Apache2.2 for HTTPS in openSUSE version 11

The goal here is to successfully secure Tomcat with Apache by integrating Tomcat's abilities into an existing Apache installation using the mod_jk and Ajp13Connector. At this point we assume that apache2, apache2-prefork, and apache2-mod_jk packages are already installed.

  1. Download the gria-services.conf sample file and place it in /etc/apache2/vhosts.d
  2. Edit gria-services.conf so that the file locations of the following settings give the locations of the files you exported from your keystore on the previous page.
    • SSLCertificateFile
    • SSLCertificateKeyFile
    • SSLCACertificateFile
    • SSLCARevocationFile
  3. Edit the /etc/sysconfig/apache2 file and do the following:
    • Add "-D SSL" to the APACHE_SERVER_FLAGS variable to allow SSL to be enabled when the Apache Sever is started:
      APACHE_SERVER_FLAGS="-D SSL"
    • Set a reasonable value for the time required to enter the password when starting apache:
      APACHE_START_TIMEOUT="30"
    • Include the modules "jk", "proxy" and "proxy_ajp" to the list of apache2 modules within the APACHE_MODULES variable, e.g.:
      APACHE_MODULES="access actions alias auth auth_dbm dir env expires include log_config mime negotiation setenvif ssl jk proxy proxy_ajp"
  4. Copy the file /usr/share/doc/packages/apache2-mod_jk/jk.conf to /etc/apache2/conf.d:
    # cp /usr/share/doc/packages/apache2-mod_jk/jk.conf /etc/apache2/conf.d

  5. Copy the file /usr/share/doc/packages/apache2-mod_jk/workers.properties to /etc/tomcat6:
    # cp /usr/share/doc/packages/apache2-mod_jk/workers.properties /etc/tomcat6
  6. Stop the Tomcat server with the following command:
    # rctomcat6 stop
  7. Edit the file /etc/apache2/conf.d/jk.conf and add the following pieces of code to the file within the <IfModule> tag:
    • For GRIA Basic App Services add the following section:
      # The following line mounts /GRIA basic app services/ uri (and all files) to tomcat
      JkMount /gria-basic-app-services/* ajp13
      	
      Alias /gria-basic-app-services "/usr/share/tomcat6/webapps/gria-basic-app-services"
      <Directory "/usr/share/tomcat6/webapps/gria-basic-app-services">
       Options Indexes FollowSymLinks
       allow from all
      </Directory>
      #To prevent users from listing contents
      <Location "/gria-basic-app-services/WEB-INF/">
       AllowOverride None
       deny from all
      </Location>
    • For GRIA Service Provider Management add the following section:
      # The following line mounts /GRIA service provider management / uri (and all files) to tomcat
      JkMount /gria-service-provider-mgt/* ajp13
      	
      Alias /gria-service-provider-mgt "/usr/share/tomcat6/webapps/gria-service-provider-mgt"
      <Directory "/usr/share/tomcat6/webapps/gria-service-provider-mgt">
       Options Indexes FollowSymLinks
       allow from all
      </Directory>
      #To prevent users from listing contents
      <Location "/gria-service-provider-mgt/WEB-INF/">
       AllowOverride None
       deny from all
      </Location>
    • For GRIA Client Management add the following section:
      # The following line mounts /GRIA client management / uri (and all files) to tomcat
      JkMount /gria-client-mgt/* ajp13
      	
      Alias /gria-client-mgt "/usr/share/tomcat6/webapps/gria-client-mgt"
      <Directory "/usr/share/tomcat6/webapps/gria-client-mgt">
       Options Indexes FollowSymLinks
       allow from all
      </Directory>
      #To prevent users from listing contents
      <Location "/gria-client-mgt/WEB-INF/">
       AllowOverride None
       deny from all
      </Location>
  8. Start the Tomcat server with the command:
    # rctomcat6 start
  9. Restart the apache2 server with the following command:
    # rcapache2 restart
  10. Access the GRIA admin pages through HTTPS, eg using https://localhost/gria-basic-app-services.
  11. Ensure that access to port 443 is not blocked by the system's firewall. N.B. the default settings for openSuSE 11 is to run the firewall, which by default blocks acccess for HTTP and HTTPS.