This section discusses the following topics:
WebLogic Server supports the use of Java EE security to protect URL (Web), Enterprise JavaBeans (EJBs), and Connector components. In addition, WebLogic Server extends the connector model of specifying additional security policies in the deployment descriptor to the URL and EJB components.
|Note:||Java EE has requirements for Java 2 security default permissions for different application types (see the Java EE 5.0 specification) as does the Java EE Connector Architecture specification.|
The connector specification provides for deployment descriptors to specify additional security policies using the
<security-permission> tag (see Listing 8-1):
<security-permission>A single grant statement following the syntax of
<description> Optional explanation goes here </description>
http://java.sun.com/j2se/1.4.2/docs/guide/security/PolicyFiles.html#FileSyntaxwithout the “codebase” and “signedBy” clauses goes here. For example:
permission java.net.SocketPermission “*”, “resolve”;
Besides support of the
<security-permission> tag in the
rar.xml file, WebLogic Server adds the
<security-permission> tag to the
weblogic-ejb-jar.xml files. This extends the connector model to the two other application types, Web applications and EJBs, provides a uniform interface to security policies across all component types, and anticipates future Java EE specification changes.
The Java Security Manager can be used with WebLogic Server to provide additional protection for resources running in a Java Virtual Machine (JVM). Using a Java Security Manager is an optional security step. The following sections describe how to use the Java Security Manager with WebLogic Server:
For more information on Java Security Manager, see the Java Security Web page at http://java.sun.com/j2se/1.5.0/docs/guide/security/index.html.
When you run WebLogic Server under Java 2 (SDK 1.2 or later), WebLogic Server can use the Java Security Manager in Java 2, which prevents untrusted code from performing actions that are restricted by the Java security policy file.
The JVM has security mechanisms built into it that allow you to define restrictions to code through a Java security policy file. The Java Security Manager uses the Java security policy file to enforce a set of permissions granted to classes. The permissions allow specified classes running in that instance of the JVM to permit or not permit certain runtime operations. In many cases, where the threat model does not include malicious code being run in the JVM, the Java Security Manager is unnecessary. However, when untrusted third-parties use WebLogic Server and untrusted classes are being run, the Java Security Manager may be useful.
To use the Java Security Manager with WebLogic Server, specify the
-Djava.security.manager arguments when starting WebLogic Server. The
-Djava.security.policy argument specifies a filename (using a relative or fully-qualified pathname) that contains Java 2 security policies.
WebLogic Server provides a sample Java security policy file, which you can edit and use. The file is located at
|Note:||This sample policy file is not complete and is not sufficient to start WebLogic Server without first being modified. In particular, you will need to add various permissions based on your configuration in order for WLS and all applications to work properly.|
For example, to successfully start WLS and deploy an application via the Administration Console, you might need to add permissions such as the following to weblogic.policy:
permission java.util.PropertyPermission '*', 'read';
permission java.lang.RuntimePermission '*';
permission java.io.FilePermission ' <<ALL FILES>>', 'read,write';
permission javax.management.MBeanPermission '*', '*';
If you enable the Java Security Manager but do not specify a security policy file, the Java Security Manager uses the default security policies defined in the
java.policy file in the
Define security policies for the Java Security Manager in one of the following ways:
To use the Java Security Manager security policy file with your WebLogic Server deployment, you must specify the location of the
weblogic.policy file to the Java Security Manager when you start WebLogic Server. To do this, you set the following arguments on the Java command line you use to start the server:
|Note:||Be sure to use
If you have extra directories in your
CLASSPATH or if you are deploying applications in extra directories, add specific permissions for those directories to your
Oracle recommends taking the following precautions when using the
weblogic.policyfile and put the backup copy in a secure location.
weblogic.policyfile via the operating system such that the administrator of the WebLogic Server deployment has write and read privileges and no other users have access to the file.
|Caution:||The Java Security Manager is partially disabled during the booting of Administration and Managed Servers. During the boot sequence, the current Java Security Manager is disabled and replaced with a variation of the Java Security Manager that has the
For more information about the Java Security Manager, see the Javadoc for the
Set default security policies for Servlets, EJBs, and Java EE Connector Resource Adapters in the Java security policy file. The default security policies for Servlets, EJBs, and Resource Adapters are defined in the Java security policy file under the following codebases:
|Note:||These security policies apply to all Servlets, EJBs, and Resource Adapters deployed in the particular instance of WebLogic Server.|
Set security policies for a specific Servlet, EJB, or Resource Adapter by adding security policies to their deployment descriptors. Deployment descriptors are defined in the following files:
|Note:||The security policies for Resource Adapters follow the Java EE standard while the security policies for Servlets and EJBs follow the WebLogic Server extension to the Java EE standard.|
Listing 8-2 shows the syntax for adding a security policy to a deployment descriptor:
Allow getting the J2EEJ2SETest4 property
permission java.util.PropertyPermission "welcome.J2EEJ2SETest4","read";
The Java Authorization Contract for Containers (JACC) is part of Java EE. JACC extends the Java 2 permission-based security model to EJBs and Servlets. JACC is defined by.
JACC provides an alternate authorization mechanism for the EJB and Servlet containers in a WebLogic Server domain. As shown in Table 8-1, when JACC is configured, the WebLogic Security framework access decisions, adjudication, and role mapping functions are not used for EJB and Servlet authorization decisions.
WebLogic Server implements a JACC provider which, although fully compliant with JSR-115, is not as optimized as the WebLogic Authorization provider. The Java JACC classes are used for rendering access decisions. Because JSR-115 does not define how to address role mapping, WebLogic JACC classes are used for role-to-principal mapping. Seefor information on developing a JACC provider.
|Note:||The JACC classes used by WebLogic Server do not include an implementation of a Policy object for rendering decisions but instead rely on the
This section discusses the following topics:
Table 8-1 shows which providers are used for role mapping when JACC is enabled.
|Note:||In a domain, either enable JACC on all servers or on none. The reason is that JACC is server-specific while the WebLogic Security Framework is realm/domain specific. If you enable JACC, either by using the WebLogic JACC provider or (recommended) by creating your own JACC provider, you are responsible for keeping EJB and Servlet authorization policies synchronized across the domain. For example, applications are redeployed each time a server boots. If a server configured for JACC reboots without specifying the JACC options on the command line, the server will use the default WebLogic Authorization provider for EJB and Servlet role mapping and authorization decisions.|
The WebLogic JACC provider fully complies with JSR-115; however, it does not support dynamic role mapping, nor does it address authorization decisions for resources other than EJBs and Servlets. For better performance, and for more flexibility regarding security features, Oracle recommends using SSPI-based providers.
Table 8-2 compares the features provided by the WebLogic JACC provider with those of the WebLogic Authorization provider.
To enable the WebLogic JACC Provider from the command line, you must specify the following system property/value pairs:
java.security.managerNo value required.
weblogic.policyfile, specified using either a relative or an absolute pathname
For example, assuming a properly configured
weblogic.policy file, the following command line will enable the WebLogic JACC provider:
# ./startWebLogic.sh -Djava.security.manager\