-
Notifications
You must be signed in to change notification settings - Fork 114
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
Add a restricted security policy for CRIU #592
base: openj9
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,10 @@ | |
|
||
import sun.security.util.Debug; | ||
|
||
/*[IF CRIU_SUPPORT]*/ | ||
import openj9.internal.criu.InternalCRIUSupport; | ||
/*[ENDIF] CRIU_SUPPORT*/ | ||
JasonFengJ9 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/** | ||
* Configures the security providers when in restricted security mode. | ||
*/ | ||
|
@@ -72,8 +76,18 @@ public String[] run() { | |
} | ||
}); | ||
userEnabledFIPS = Boolean.parseBoolean(props[0]); | ||
String securitySetting = props[1]; | ||
// If semeru.fips is true, then ignore semeru.restrictedsecurity, use userSecurityNum 1. | ||
userSecuritySetting = userEnabledFIPS ? "1" : props[1]; | ||
if (Boolean.parseBoolean(props[0])) { | ||
securitySetting = "1"; | ||
} | ||
/*[IF CRIU_SUPPORT]*/ | ||
// If CRIU checkpoint mode is enabled, use the 2nd restricted security policy. | ||
if (InternalCRIUSupport.isCheckpointAllowed()) { | ||
securitySetting = "2"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this mean the |
||
} | ||
/*[ENDIF] CRIU_SUPPORT*/ | ||
userSecuritySetting = securitySetting; | ||
userEnabledSecurity = !isNullOrBlank(userSecuritySetting); | ||
isSecuritySupported = "Linux".equalsIgnoreCase(props[2]) | ||
&& supportPlatforms.contains(props[3]); | ||
|
@@ -86,14 +100,24 @@ private RestrictedSecurityConfigurator() { | |
|
||
/** | ||
* Restricted security mode will be enabled only if the semeru.fips system | ||
* property is true (default as false). | ||
* property is true (default as false), or semeru.restrictedsecurity is set, | ||
* or CRIU checkpoint mode is enabled. | ||
* | ||
* @return true if restricted security is enabled | ||
*/ | ||
public static boolean isEnabled() { | ||
return securityEnabled; | ||
} | ||
|
||
/*[IF CRIU_SUPPORT]*/ | ||
/** | ||
* Disables the restricted security mode. | ||
*/ | ||
public static void disable() { | ||
JasonFengJ9 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
securityEnabled = false; | ||
} | ||
/*[ENDIF] CRIU_SUPPORT*/ | ||
|
||
/** | ||
* Remove the security providers and only add the restricted security providers. | ||
* | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -135,6 +135,26 @@ RestrictedSecurity1.javax.net.ssl.keyStore = NONE | |
|
||
RestrictedSecurity1.securerandom.provider = SunPKCS11-NSS-FIPS | ||
RestrictedSecurity1.securerandom.algorithm = PKCS11 | ||
|
||
RestrictedSecurity2.desc.name = CRIU | ||
RestrictedSecurity2.desc.number = 1 | ||
RestrictedSecurity2.desc.policy = Security | ||
RestrictedSecurity2.desc.sunsetDate = 2030-01-01 | ||
JasonFengJ9 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
RestrictedSecurity2.tls.disabledNamedCurves = | ||
RestrictedSecurity2.tls.disabledAlgorithms = | ||
RestrictedSecurity2.tls.ephemeralDHKeySize = | ||
RestrictedSecurity2.tls.legacyAlgorithms = | ||
|
||
RestrictedSecurity2.jce.certpath.disabledAlgorithms = | ||
RestrictedSecurity2.jce.legacyAlgorithms = | ||
RestrictedSecurity2.jce.provider.1 = openj9.internal.criu.CRIUSEC | ||
|
||
RestrictedSecurity2.keystore.type = | ||
RestrictedSecurity2.javax.net.ssl.keyStore = | ||
|
||
RestrictedSecurity2.securerandom.provider = CRIUSEC | ||
RestrictedSecurity2.securerandom.algorithm = SHA1PRNG | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @taoliult SecureRandom is still iterating through the provider list, instead of only instantiating this specified provider. |
||
#endif | ||
|
||
# | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: The provider name needs to be the same as the class name, since the class name is used by the restrictive mode configurator to determine if a provider is allowed or not.