filter.policy file permissions

Java 2 security uses several policy files to determine the granted permission for each Java program. Java 2 security policy filtering is only in effect when Java 2 security is enabled. Before modifying the filter.policy file, start the wsadmin tool. See the Starting the wsadmin scripting client article for more information.

Refer to Protecting system resources and APIs (Java 2 security) . The filtering policy defined in the filter.policy file is cell wide. The filter.policy file is the only policy file that is used when restricting the permission instead of granting permission. The permissions that are listed in the filter policy file are filtered out from app.policy and the was.policy file. Permissions that are defined in the other policy files are not affected by the filter.policy file.

When a permission is filtered out, an audit message is logged. However, if the permissions that are defined in app.policy and the was.policy file are compound permissions like the java.security.AllPermission permission, for example, the permission is not removed. A warning message is logged. If the Issue Permission Warning flag is enabled (default) and if app.policy and the was.policy file contain custom permissions (non-Java API permission, the permission package name begins with characters other than java or javax), a warning message is logged and the permission is not removed. You can change the value of the Issue permission warning option on the Global Security panel. It is not recommended that you use the AllPermission permission for the enterprise application.

Some default permissions that are defined in the filter.policy file. These permissions are the minimal ones that are recommended by the product. If more permissions are added to the filter.policy file, certain operations can fail for enterprise applications. Add permissions to the filter.policy file carefully.

You cannot use the Policy Tool to edit the filter.policy file. Editing must be completed in a text editor. Be careful and verify that no syntax errors exist in the filter.policy file. If any syntax errors exist in the filter.policy file, the file is not loaded by the product security runtime, which implies that filtering is disabled.

To extract the filter.policy file, enter the following command using information from your environment:

set obj [$AdminConfig extract cells/cell/filter.policy c:/temp/test/filter.policy]

To check in the policy file, enter the following command using information from your environment:

$AdminConfig checkin cells/cell/filter.policy c:/temp/test/filter.policy $obj

An updated filter.policy file is applied to all of the WebSphere Application Server enterprise applications after the servers are restarted. The filter.policy file is managed by configuration and file replication services.

Changes made in the file are replicated to other nodes in the cell.

The filter.policy file that is supplied by WAS resides at: app_server_root/profiles/profile/config/cells/cell/filter.policy.

This fill contains these permissions as defaults:

filterMask {
permission java.lang.RuntimePermission "exitVM";
permission java.lang.RuntimePermission "setSecurityManager";
permission java.security.SecurityPermission "setPolicy";
permission javax.security.auth.AuthPermission "setLoginConfiguration"; };
runtimeFilterMask {
permission java.lang.RuntimePermission "exitVM";
permission java.lang.RuntimePermission "setSecurityManager";
permission java.security.SecurityPermission "setPolicy";
permission javax.security.auth.AuthPermission "setLoginConfiguration"; };

The permissions that are defined in filterMask filter are for static policy filtering. The security runtime tries to remove the permissions from applications during application startup. Compound permissions are not removed, but are issued with a warning, and application deployment is stopped if applications contain permissions that are defined in the filterMask filter, and if scripting is used. The runtimeFilterMask filter defines permissions that are used by the security runtime to deny access to those permissions to application thread. Do not add more permissions to the runtimeFilterMask filter. Application start failure or incorrect functioning might result. Be careful when adding more permissions to the runtimeFilterMask filter. Usually, you only need to add permissions to the filterMask stanza.

WebSphere Application Server relies on the filter policy file to restrict or disallow certain permissions that can compromise the integrity of the system. For instance, WebSphere Application Server considers the exitVM and setSecurityManager permissions as those permissions that most applications never have. If these permissions are granted, the following scenarios are possible:

exitVM

A servlet, JSP file, enterprise bean, or other library that is used by the aforementioned might call the System.exit API and cause the entire WAS process to terminate.

setSecurityManager

An application might install its own security manager and either grant more permissions or bypass the default policy that the WebSphere Application Server security manager enforces.

Important: In application code, do not use the setSecurityManager permission to set a security manager. When an application uses the setSecurityManager permission, a conflict exists with the internal security manager within WebSphere Application Server. If set a security manager in an application for Remote Method Invocation (RMI) purposes, you also must select the Enforce Java 2 Security option on the Global security settings page within the WebSphere Application Server administrative console. WAS then registers a security manager, which the application code can verify is registered by using the System.getSecurityManager application programming interface (API).

For the updated filter.policy file to take effect, restart related Java processes.


Related tasks
Migrating, coexisting, and interoperating – Security considerations Configuring the was.policy file Using PolicyTool to edit policy files Configuring Java 2 security policy files Related reference
app.policy file permissions Global security settings

 



 

 

WebSphere is a trademark of the IBM Corporation in the United States, other countries, or both.
IBM is a trademark of the IBM Corporation in the United States, other countries, or both.