GT4 Java WS A&A User's Guide

Introduction

Authorization. Users who run clients can programmatically set up the authorization scheme to be enforced on a per invocation basis. The properties and configuration information required depends on the configured authorization scheme.

Authentication & message-level security. Typical user configuration deals with configuring authentication mechanisms and credentials for the clients. These could be client applications, including command line clients or client configuration within services that contact other services. There are multiple mechanisms for doing this:

  • Command line options (these are application-specific)
  • Client security descriptors
  • CoG properties
  • Environment variables
  • Relying on default behavior. The only default behaviors available concern the proxy file and trusted certificates locations.

More information on these mechanisms can be found in the public interface guide.


Chapter 1. Client-side authorization

The client side authorization can be configured for each invocation.

To write and configure custom authorization mechanism refer to Section 2.2, “Writing custom client-side authorization scheme”.

If no authorization mechanism has been specified, HostOrSelf authorization is used. In this scheme host authorization is tried first, if it fails, self authorization is attempted

Chapter 2. Configuring client authentication and message/transport security

1. Interface introduction

Client-side security is set up by either setting individual properties on the javax.xml.rpc.Stub object used for the web service method invocation or by setting properties on a client-side security descriptor object, which in turn is propagated to client-side security handlers by making it available as a stub object property. Here are examples of the two approaches:

  • Setting a property on the stub:

    // Create endpoint reference
    EndpointReferenceType endpoint = new EndpointReferenceType();
    // Set address of service
    String counterAddr = 
       "http://localhost:8080/wsrf/services/CounterService";
    // Get handle to port 
    CounterPortType port = 
       locator.getCounterPortTypePort(endpoint);
    // set client authorization to self 
      ((Stub)port)._setProperty(Constants.AUTHORIZATION, 
                   SelfAuthorization.getInstance());
  • Setting properties using a client descriptor:

    // Client security descriptor file 
    String CLIENT_DESC = 
       "org/globus/wsrf/samples/counter/client/client-security-config.xml"; 
    // Create endpoint reference
    EndpointReferenceType endpoint = new EndpointReferenceType();
    // Set address of service
    String counterAddr = 
       "http://localhost:8080/wsrf/services/CounterService";
    // Get handle to port 
    CounterPortType port = 
       locator.getCounterPortTypePort(endpoint);
    //Set descriptor on Stub 
    ((Stub)port)._setProperty(Constants.CLIENT_DESCRIPTOR_FILE, CLIENT_DESC);

The descriptor file is described in detail in Chapter 1, Introduction.

[Note]Note

If the client needs to use transport security, the following API must be used to register the Axis transport handler for https:

import org.globus.axis.util.Util;
static {
        Util.registerTransport();
    }

2. Syntax of the interface

Table 2.1. Client side security properties

NumberTask Stub Configuration Descriptor Configuration
1.Allows for configuration of credentials for authentication.

Property:

org.globus.axis.gsi.GSIConstants.GSI_CREDENTIALS

Value equals the Instance of org.ietf.jgss.GSSCredential.

Section 2, “Credentials”

2.Allows for configuring client-side authorization.

Property:

org.globus.wsrf.security.Constants.AUTHORIZATION

Value equals the Instance of org.globus.wsrf.security.authorization.Authorization

If GSI Secure Transport or GSI Secure Conversation is used, the value should be an instance of org.globus.gsi.gssapi.auth.Authorization. But this translation is done automatically by the toolkit.

Refer to Section 3, “Authorization policy”
3.Enable GSI Secure Conversation with specified message protection level.

1. Property:

org.globus.wsrf.security.Constants.GSI_SEC_CONV

Values equal one of the following:

  • Constants.ENCRYPTION
  • Constants.SIGNATURE

2. Property:

org.globus.wsrf.security.Constants.GSI_SEC_CONV_SECREPLY_UNNECESSARY

If the value is set to Boolean.TRUE, the GSI Secure conversation protection is not required in the reply message. By default, if the request was secured with GSI Secure Conversation, the response is also required to have the same protection.

3. Property:

You can set the SOAP Actor of the GSI signed/encrypted SOAP message by using the gssActor property. We recommend that you not do this unless you really know what you are doing.

Refer Section 4, “GSI Secure Conversation”.

4.Sets the GSI delegation mode. Used for GSI Secure Conversation only. If limited or full delegation is chosen, then some form of client-side authorization needs to be done (i.e client-side authorization cannot be set to none).

Property:

org.globus.axis.gsi.GSIConstants.GSI_MODE 

Value equals one of following:

  1. GSIConstants.GSI_MODE_NO_DELEG: No delegation is performed.
  2. GSIConstants.GSI_MODE_LIMITED_DELEG: Limited delegation is performed.
  3. GSIConstants.GSI_MODE_FULL_DELEG: Full delegation is performed.

Refer Section 4, “GSI Secure Conversation”

5.Enables GSI Secure Transport with some protection level.

Property:

org.globus.gsi.GSIConstants.GSI_TRANSPORT

Values equal one of the following:

  • Constants.ENCRYPTION
  • Constants.SIGNATURE

Refer Section 6, “GSI Secure Transport”

6.Enables anonymous authentication. This option only applies to GSI Secure Conversation and GSI Transport.

Property:

org.globus.wsrf.security.Constants.GSI_ANONYMOUS 

Value equals one of following:

  1. Boolean.FALSE: Anonymous authentication is disabled.
  2. Boolean.TRUE: Anonymous authentication is enabled.

Refer Section 4, “GSI Secure Conversation” and Section 6, “GSI Secure Transport”

7.Enable GSI Secure Message with specified message protection level.

1. Property:

org.globus.wsrf.security.Constants.GSI_SEC_MSG

Values equal one of the following:

  • Constants.ENCRYPTION
  • Constants.SIGNATURE

2. Property:

org.globus.wsrf.security.Constants.GSI_SEC_MSG_SECREPLY_UNNECESSARY

If the value is set to Boolean.TRUE, the GSI Secure Message protection is not required in the reply message. By default, if the request was secured with GSI Secure Message, the response is also required to have the same protection.

3. Property:

org.globus.wsrf.security.Constants.GSI_SEC_MSG_SINGLECERT

If the value is set to Boolean.TRUE, only a single certificate is used for the GSI Secure Message request. By default, the whole certificate chain is sent.

4. Property:

You can set the SOAP Actor of the signed message using the x509Actor property, but we do not recommend this unless you know what you are doing.

Refer Section 5, “GSI Secure Message”.

8.Enable WS-Security username/password authentication.

Properties:

org.globus.wsrf.security.Constants.USERNAME

Value equals the username.

org.globus.wsrf.security.Constants.PASSWORD

Value equals the password.

Refer Section 7, “Username/Password”

9.Sets the credential that is used to encrypt the message (typically, the recipient's public key). Used for GSI Secure Message only.

Property:

org.globus.wsrf.impl.security.authentication
                          .Constants.PEER_SUBJECT        

Value equals the instance of javax.security.auth.Subject.

The credential object needs to be wrapped in org.globus.wsrf.impl.security.authentication.encryption and added to the set of public credentials of the Subject object.

For example, if publicKeyFilename was the file that had the recipient's public key:

Subject subject = new Subject();
X509Certificate serverCert = 
    CertUtil.loadCertificate(publicKeyFilename);
EncryptionCredentials encryptionCreds = 
    new EncryptionCredentials(
        new X509Certificate[] { serverCert });
subject.getPublicCredentials().add(encryptionCreds);
stub._setProperty(Constants.PEER_SUBJECT, subject);
              

Refer Section 5, “GSI Secure Message”

10.Sets the trusted certificates location.

Property:

org.globus.wsrf.security.TRUSTED_CERTIFICATES

Value should be a comma-separated list of directories and file names.

Refer Section 8, “Trusted credentials”
11.Sets the SAML Authorization Assertion to embed in SOAP Header.

Property:

org.globus.wsrf.impl.security.authentication.Constants.SAML_AUTHZ_ASSERTION

Value should be an instance of org.opensaml.SAMLAssertion.

Cannot be configured using descriptors.

Chapter 3. Debugging

1. Logging in Java WS Core

The following information applies to Java WS Core and all services built on Java WS Core.

Java WS Core server side has two types of loggers. One logger is used for development logging and by default writes to standard out. The other logger includes system administration information and is CEDPs best practices compliant.

On client side, only developer logging is available and is configured using log4j.properties.

1.1. Development Logging in Java WS Core

The following information applies to Java WS Core and those services built on it.

Logging in the Java WS Core is based on the Jakarta Commons Logging API. Commons Logging provides a consistent interface for instrumenting source code while at the same time allowing the user to plug-in a different logging implementation. Currently we use Log4j as a logging implementation. Log4j uses a separate configuration file to configure itself. Please see Log4j documentation for details on the configuration file format.

1.1.1. Configuring server side developer logs

Server side logging can be configured in $GLOBUS_LOCATION/container-log4j.properties, when the container is stand alone container. For tomcat level logging, refer to Logging for Tomcat, . The logger log4j.appender.A1 is used for developer logging and by default writes output to the system output. By default it is set for all warnings in the Globus Toolkit package to be displayed.

Additional logging can be enabled for a package by adding a new line to the configuration file. Example:

   #for debug level logging from org.globus.package.FooClass 
   log4j.category.org.globus.package.name.FooClass=DEBUG
   #for warnings from org.some.warn.package
   log4j.category.org.some.warn.package=WARN
   

1.1.2. Configuring client side developer logs

Client side logging can be configured in $GLOBUS_LOCATION/log4j.properties. The logger log4j.appender.A1 is used for developer logging and by default writes output to the system output. By default it is set for all warnings in the Globus Toolkit package to be displayed.

1.2. Configuring system administration logs

The specific logger to edit will be log4j.logger.sysadmin in $GLOBUS_LOCATION/container-log4j.properties. There you can configure the following properties:

log4j.appender.infoCategory=org.apache.log4j.RollingFileAppender
   log4j.appender.infoCategory.Threshold=INFO
   log4j.appender.infoCategory.File=var/containerLog
   log4j.appender.infoCategory.MaxFileSize=10MB
   log4j.appender.infoCategory.MaxBackupIndex=2

Above implies the logging file is rolling with each file size limited to 10MB and the logging information is stored in $GLOBUS_LOCATION/var/containerLog.

1.3. Sample log file

The sample log file contains many log entries for various scenarios in the Java WS container.

Chapter 4. Troubleshooting

For a list of common errors in GT, see Error Codes.

For information about system administrator logs, see Chapter 7, Troubleshooting.

1. Credential Troubleshooting

1.1. Credential Errors

The following are some common problems that may cause clients or servers to report that credentials are invalid:

For a list of common errors in GT, see Error Codes.

Table 4.1. Credential Errors

Error CodeDefinitionPossible Solutions
Your proxy credential may have expiredYour proxy credential may have expired.Use grid-proxy-info to check whether the proxy credential has actually expired. If it has, generate a new proxy with grid-proxy-init.
The system clock on either the local or remote system is wrong.This may cause the server or client to conclude that a credential has expired.Check the system clocks on the local and remote system.
Your end-user certificate may have expiredYour end-user certificate may have expiredUse grid-cert-info to check your certificate's expiration date. If it has expired, follow your CA's procedures to get a new one.
The permissions may be wrong on your proxy fileIf the permissions on your proxy file are too lax (for example, if others can read your proxy file), Globus Toolkit clients will not use that file to authenticate.You can "fix" this problem by changing the permissions on the file or by destroying it (with grid-proxy-destroy) and creating a new one (with grid-proxy-init).

Important: However, it is still possible that someone else has made a copy of that file during the time that the permissions were wrong. In that case, they will be able to impersonate you until the proxy file expires or your permissions or end-user certificate are revoked, whichever happens first.

The permissions may be wrong on your private key fileIf the permissions on your end user certificate private key file are too lax (for example, if others can read the file), grid-proxy-init will refuse to create a proxy certificate.You can "fix" this by changing the permissions on the private key file.

Important: However, you will still have a much more serious problem: it is possible that someone has made a copy of your private key file. Although this file is encrypted, it is possible that someone will be able to decrypt the private key, at which point they will be able to impersonate you as long as your end user certificate is valid. You should contact your CA to have your end-user certificate revoked and get a new one.

The remote system may not trust your CAThe remote system may not trust your CAVerify that the remote system is configured to trust the CA that issued your end-entity certificate. See Installing GT 4.2.1 for details.
You may not trust the remote system's CAYou may not trust the remote system's CAVerify that your system is configured to trust the remote CA (or that your environment is set up to trust the remote CA). See Installing GT 4.2.1 for details.
There may be something wrong with the remote service's credentialsThere may be something wrong with the remote service's credentialsIt is sometimes difficult to distinguish between errors reported by the remote service regarding your credentials and errors reported by the client interface regarding the remote service's credentials. If you cannot find anything wrong with your credentials, check for the same conditions on the remote system (or ask a remote administrator to do so) .

1.2. Some tools to validate certificate setup

1.2.1. grid-cert-diagnostics

The grid-cert-diagnostics program checks prints diagnostics about the user's certificates, and host security environment.

% grid-cert-diagnostics -p

1.2.2. Check that the user certificate is valid

openssl verify -CApath /etc/grid-security/certificates
  -purpose sslclient ~/.globus/usercert.pem

1.2.3. Connect to the server using s_client

openssl s_client -ssl3 -cert ~/.globus/usercert.pem -key 
  ~/.globus/userkey.pem -CApath /etc/grid-security/certificates 
  -connect <host:port>

Here <host:port> denotes the server and port you connect to.

If it prints an error and puts you back at the command prompt, then it typically means that the server has closed the connection, i.e. that the server was not happy with the client's certificate and verification. Check the SSL log on the server.

If the command "hangs" then it has actually opened a telnet style (but secure) socket, and you can "talk" to the server.

You should be able to scroll up and see the subject names of the server's verification chain:

depth=2 /DC=net/DC=ES/O=ESnet/OU=Certificate Authorities/CN=ESnet Root CA 1
verify return:1
depth=1 /DC=org/DC=DOEGrids/OU=Certificate Authorities/CN=DOEGrids CA 1
verify return:1
depth=0 /DC=org/DC=doegrids/OU=Services/CN=wiggum.mcs.anl.gov
verify return:1
    

In this case, there were no errors. Errors would give you an extra line next to the subject name of the certificate that caused the error.

1.2.4. Check that the server certificate is valid

Requires root login on server:

    openssl verify -CApath /etc/grid-security/certificates -purpose sslserver 
     /etc/grid-security/hostcert.pem

2. Error Messages For Java WS A&A

Table 4.2. Java WS A&A Errors

Error CodeDefinitionPossible Solutions
[JWSSEC-248] Secure container requires valid credentialsThis error occurs when globus-start-container is run without any valid credentials. Either a proxy certificate or service/host certificate needs to be configured for the container to start up.
  1. If you are not looking to start up a container that uses GSI Secure Transport, which is used by the container by default, use globus-start-container -nosec. You will be able to use insecure clients and services. However, this also implies that if you have not configured individual services with credentials, you will not be able to securely access the service.

  2. If you are running a personal container, generate a proxy certificate with grid-proxy-init. If the proxy certificate is not in the default location, configure the container security descriptor as described in Configuring Container Security Descriptor.

  3. If you want to use host certificates, configure the container security descriptor as described Configuring Credentials.

Failed to start container: Container failed to initialize [Caused by: [JWSSEC-250] Failed to load certificate/key file]This error occurs if the file path to the container certificate and key configured are invalid.
  1. The path to the container certificate and key are configured in $GLOBUS_LOCATION/etc/globus_wsrf_core/ global_security_descriptor.xml. This file is loaded as described [here - fixme link]. Ensure that the path is correct.

Failed to start container: Container failed to initialize [Caused by: [JWSSEC-249] Failed to load proxy file]This error occurs if container proxy file configured is invalid.
  1. The path to the container proxy certificates are configured in $GLOBUS_LOCATION/etc/globus_wsrf_core/ global_security_descriptor.xml. This file is loaded as described [here - fixme link]. Ensure that the path is correct.

Failed to start container: Container failed to initialize [Caused by: [JWSSEC-245] Error parsing file: "etc/globus_wsrf_core/ global_security_descriptor.xml" [Caused by: ...]This error occurs if the container security descriptor configured is invalid.
  1. The container security descriptor should conform to the Container Security Descriptor Schema.

  2. Refer to the "Caused by: " section for details on the specific element that is not correct.

[JGLOBUS-77] Unknown CAThis error occurs if the CA certificate for the credentials being used is not installed correctly.
  1. If this issue occurs on the server side, the container is not configured with CA certificates. The container looks for trusted certificates in the default location as described Java CoG Toolkit FAQ

  2. On the server side, the trusted certificates can be configured as described in Trusted Certificates

  3. On the client side, trusted certificates can be configured as described in Configuring Trusted Credentials

Glossary

P

public key

The public part of a key pair used for cryptographic operations (e.g. signing, encrypting).

S

scheduler

Term used to describe a job scheduler mechanism to which GRAM interfaces. It is a networked system for submitting, controlling, and monitoring the workload of batch jobs in one or more computers. The jobs or tasks are scheduled for execution at a time chosen by the subsystem according to an available policy and availability of resources. Popular job schedulers include Portable Batch System (PBS), Platform LSF, and IBM LoadLeveler.