In openjdk, security policies are not taking effect

1.7k views Asked by At

In redhat-openjdk:1.8.0, jvm java.policy and custom.policy file's java.version is being effective on the activeprocess

I've configured the java process to use java security manager and it uses Apache server to run the process. So Apache client look for "java.version" read permission in default and/or custom policy file.

I've included ready property permission, yet i'm getting weird AccessControlException.

Exception i'm seeing is:

java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.security.AccessControlException: access denied ("java.util.PropertyPermission" "java.version" "read")

I've right permissions in place Property permission entry in jvm/secruity/java.policy

permission java.util.PropertyPermission "java.version", "read";

and in custom.policy ( -Djava.security.manager -Djava.security.policy=custom.policy), file path fully-qualified, i just shortened for better understanding):

 permission java.util.PropertyPermission "java.version", "read";

Expectation is to run java process with out issues, but that's not happening.

Edit 1:

I've also tried enforcing all permission using below line:

grant{ permission java.security.AllPermission; };

But seems like it is still not working. I've also tried using '==' while setting up policy file, which mean `If you use

java -Djava.security.manager -Djava.security.policy==someURL SomeApp

(note the double equals) then just the specified policy file will be used; all the ones indicated in the security properties file will be ignored.`

As per jdk 8 doc

Any help is much appreciated.

1

There are 1 answers

2
martin_uy On

Looks to me that the policy is not in effect. In case you have multiple JDK releases installed, are you sure that you've modified the default policy for the same release that you are running with? I'd start by granting AllPermissions just to make sure that the policy is in effect, and then focus on the permission line itself.