-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Java Restricted Security Mode #544
Conversation
@keithc-ca Java Restricted Security Mode PR for JDKnext, please help to review and advice. |
e8258e1
to
1b0d87c
Compare
The pushes in last two days are for git rebase the branch, because the head had new commits, so I rebase the branch to accept the new commits from the head to make sure there is no any conflict. Right now, the PR is ready for review. Please help to review and advice. |
Please stop doing that. I'll let you know if it needs to be rebased or otherwise updated. |
@keithc-ca Ok, sure. Right now the codes are ready for review. |
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurityConfigurator.java
Outdated
Show resolved
Hide resolved
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurityConfigurator.java
Outdated
Show resolved
Hide resolved
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurityProperties.java
Outdated
Show resolved
Hide resolved
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurityProperties.java
Outdated
Show resolved
Hide resolved
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurityProperties.java
Outdated
Show resolved
Hide resolved
d88c5df
to
4be5f40
Compare
Changed the class name from “RestrictedSecurityConfigurator” to “RestrictedSecurity”. And also update class “RestrictedSecurityProperties” as a nested class of “RestrictedSecurity”. The PR is ready for review. Please help to review and advice. |
src/java.base/share/classes/sun/security/jca/ProviderConfig.java
Outdated
Show resolved
Hide resolved
src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/SunPKCS11.java
Outdated
Show resolved
Hide resolved
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java
Show resolved
Hide resolved
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java
Outdated
Show resolved
Hide resolved
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java
Outdated
Show resolved
Hide resolved
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java
Outdated
Show resolved
Hide resolved
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java
Outdated
Show resolved
Hide resolved
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java
Outdated
Show resolved
Hide resolved
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java
Outdated
Show resolved
Hide resolved
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java
Outdated
Show resolved
Hide resolved
1b3aa92
to
d390f48
Compare
@keithc-ca The PR is ready for review. Please help to review and advice. |
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java
Show resolved
Hide resolved
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java
Outdated
Show resolved
Hide resolved
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java
Outdated
Show resolved
Hide resolved
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java
Outdated
Show resolved
Hide resolved
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java
Show resolved
Hide resolved
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java
Outdated
Show resolved
Hide resolved
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java
Outdated
Show resolved
Hide resolved
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java
Outdated
Show resolved
Hide resolved
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java
Outdated
Show resolved
Hide resolved
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java
Outdated
Show resolved
Hide resolved
3139105
to
ab1f279
Compare
@keithc-ca |
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java
Outdated
Show resolved
Hide resolved
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java
Show resolved
Hide resolved
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java
Show resolved
Hide resolved
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java
Show resolved
Hide resolved
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java
Outdated
Show resolved
Hide resolved
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java
Outdated
Show resolved
Hide resolved
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java
Outdated
Show resolved
Hide resolved
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java
Outdated
Show resolved
Hide resolved
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java
Outdated
Show resolved
Hide resolved
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java
Outdated
Show resolved
Hide resolved
5ec82f9
to
7cee3e2
Compare
@keithc-ca The PR is ready for review. Please help to review and advice. Thanks so much. |
ef57803
to
953d4d7
Compare
As we talked in slack, I added the checks in three methods of ProviderList.java. In the ProviderList.insertAt() method, even we had the provider checks in ServiceLoader.java and ProviderConfig.java, to stop the non-FIPS provider loading. But adding the isProviderAllowed() checks in insertAt() will avoid NPE, when the customer try to add their own provider by calling ProviderList.insertAt() or ProviderList.add() methods, and then calling ProviderList.remove() to remove it. Because the provider will be added into the list but it can not be loaded, so the provider in the list will be as null. When running the extended.openjdk tests, I can see the test case failure changed from NPE to “java.lang.Exception: Provider not added” which is more readable, in those test cases which add and remove the test dummy providers. In the ProviderList.newList(), add the similar checks with the same reason as ProviderList.insertAt() method. In the getService() method, and the inner class ServiceList’s tryGet() method, add the isServiceAllowed() check, to stop the non-FIPS services returned. Right now, the PR is ready for review. Please help to review and advice. Thanks so much. @jasonkatonica @WilburZjh FYI. |
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java
Outdated
Show resolved
Hide resolved
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java
Outdated
Show resolved
Hide resolved
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java
Outdated
Show resolved
Hide resolved
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java
Outdated
Show resolved
Hide resolved
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java
Outdated
Show resolved
Hide resolved
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java
Outdated
Show resolved
Hide resolved
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java
Outdated
Show resolved
Hide resolved
f9d6771
to
0d40250
Compare
@keithc-ca @jasonkatonica @WilburZjh |
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java
Outdated
Show resolved
Hide resolved
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java
Outdated
Show resolved
Hide resolved
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java
Outdated
Show resolved
Hide resolved
734165e
to
6410bbf
Compare
@keithc-ca @jasonkatonica @WilburZjh |
I think this looks good. I want to convince myself that the updated |
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java
Outdated
Show resolved
Hide resolved
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java
Outdated
Show resolved
Hide resolved
closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurity.java
Outdated
Show resolved
Hide resolved
Yes, I listed and compared all the security providers and their algorithms, between the Java Restricted Security Mode by using FIPS policy (-Dsemeru.restrictedsecurity=1) and the current released Semeru FIPS by using “-Dsemeru.fips=true”. The listed security providers are in the same order, offering the same algorithms. And I also compared the 5 OpenJDK and JCK test results (sanity.openjdk, extended.openjdk, sanity.jck, extended.jck and special.jck) between the Java Restricted Security Mode by using FIPS policy (-Dsemeru.restrictedsecurity=1) and the current released Semeru FIPS by using “-Dsemeru.fips=true”. There are more expected failures since the test cases are trying to create its own providers which is not allowed in Java Restricted Security Mode FIPS. Except these expected failures, other test results are same as before. So, the tests look good. @jasonkatonica @WilburZjh FYI. |
Signed-off-by: Tao Liu <[email protected]>
Jenkins compile alinux64 jdknext |
Will this be backported to jdk8? |
@pshipton Yes, I am working on the backport to OpenJDK8. |
Signed-off-by: Tao Liu [email protected]
This PR is for adding the codes of Java Restricted Security Mode.
The Java Restricted Security Mode is used to restrict the providers and algorithms, by the properties configured in the java.security file.
The properties will be of the following format:
The new runtime command line arguments:
The options can be combined: e.g. -Dsemeru.restrictedsecurity=1,trace,audit
During the process of reading the java.security properties file, the JDK will detect if Restricted Security mode as selected and the selected policy. This detection will be done as a check in the JCA code to see if the flag "semeru.restrictedsecurity" was used, if it is used, the specific policy number will be extracted, the code will then check the properties file to see if such a policy number exist. If a valid policy is selected, two configuration steps will occur:
JSSE Configuration during start up. If a valid policy was selected, the properties in java.security file will be read and mapped during the start up.
Cryptography available. The existing providers will be removed and only the compliant providers (defined by “SecurityRestrict(n).jce.provider”) will be added. And also, a list of permitted services that each provider may provide. A provider without any additional constraints will have all its services enabled. A provider with the constraints will only register the allowed constraints. For example: