+

Search Tips   |   Advanced Search

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 wsadmin. See the Start wsadmin 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 used when restricting the permission instead of granting permission. The permissions that are listed in the filter.policy file are filtered out from the app.policy file and the was.policy file. Permissions 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 defined in the app.policy file 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 the app.policy file 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. We can change the value of the Warn if applications are granted custom permissions option on the Global security panel. It is not recommended that you use the AllPermission permission for the enterprise application.

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

We 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 WAS ND security runtime, which implies that filtering is disabled.

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

set obj [$AdminConfig extract cells/mycell/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/mycell/filter.policy c:/temp/test/filter.policy $obj

An updated filter.policy file is applied to all of the WAS enterprise apps 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_ROOT/profiles/profile_name/config/cells/mycell/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 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 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. WAS relies on the filter.policy file to restrict or disallow certain permissions that can compromise the integrity of the system. For instance, WAS 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, JSPs file, enterprise bean, or other library 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 WAS security manager enforces.

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 WAS. If we must set a security manager in an application for RMI purposes, you also must select the Use Java 2 security to restrict application access to local resources option on the Global security panel within the WAS admin console. WAS then registers a security manager, which the application code can verify is registered by using the System.getSecurityManager API.

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



 

Related tasks


Migrating, coexisting, and interoperating – Security considerations
Set the was.policy file for Java 2 security
Use PolicyTool to edit policy files for Java 2 security
Set Java 2 security policy files

 

Related


app.policy file permissions
Java 2 security policy files
Global security settings