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, you must start wsadmin.sh.
Refer to Protecting system resources and APIs (Java 2 security) for developing applications. 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 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 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.
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 the product security runtime, which implies that filtering is disabled.
To extract the filter.policy file, enter the following command using information from the environment:
(dist)
set obj [$AdminConfig extract cells/cell_name/filter.policy c:/temp/test/filter.policy]
set obj [$AdminConfig extract cells/cell_name/filter.policy /temp/test/filter.policy]
To check in the policy file, enter the following command using information from the environment:
(dist) (dist)
$AdminConfig checkin cells/cell_name/filter.policy c:/temp/test/filter.policy $obj
$AdminConfig checkin cells/cell_name/filter.policy /temp/test/filter.policy $obj
An updated filter.policy file is applied to all of the WAS 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.
(dist)(zos) The filter.policy file supplied by WebSphere Application Server resides at: app_server_root/profiles/profile_name/config/cells/cell_name/filter.policy.
(iseries) The filter.policy file supplied by WebSphere Application Server resides at: profile_root/config/cells/cell_name/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 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, we 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 used by the aforementioned might call the System.exit API and cause the entire WebSphere Application Server 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.
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 we must set a security manager in an application for Remote Method Invocation (RMI) purposes, we also must select the Use Java 2 security to restrict application access to local resources option on the Global security panel within the WAS console. WebSphere Application Server then registers a security manager, which the application code can verify is registered using the System.getSecurityManager (API).
For the updated filter.policy file to take effect, restart related Java processes.
Related tasks
Start the wsadmin scripting client Configure Java 2 security policy files Migrate, coexist, and interoperate - Security considerations Configure the was.policy file for Java 2 security Use PolicyTool to edit policy files for Java 2 security
app.policy file permissions Java 2 security policy files Global security settings