Skip to content

Commit cbee774

Browse files
author
Zainab Fatmi
committed
Add a restricted security policy for CRIU
Signed-off-by: Zainab Fatmi <[email protected]>
1 parent 8a57641 commit cbee774

File tree

2 files changed

+46
-2
lines changed

2 files changed

+46
-2
lines changed

closed/src/java.base/share/classes/openj9/internal/security/RestrictedSecurityConfigurator.java

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@
3737

3838
import sun.security.util.Debug;
3939

40+
/*[IF CRIU_SUPPORT]*/
41+
import openj9.internal.criu.InternalCRIUSupport;
42+
/*[ENDIF] CRIU_SUPPORT*/
43+
4044
/**
4145
* Configures the security providers when in restricted security mode.
4246
*/
@@ -72,8 +76,18 @@ public String[] run() {
7276
}
7377
});
7478
userEnabledFIPS = Boolean.parseBoolean(props[0]);
79+
String securitySetting = props[1];
7580
// If semeru.fips is true, then ignore semeru.restrictedsecurity, use userSecurityNum 1.
76-
userSecuritySetting = userEnabledFIPS ? "1" : props[1];
81+
if (Boolean.parseBoolean(props[0])) {
82+
securitySetting = "1";
83+
}
84+
/*[IF CRIU_SUPPORT]*/
85+
// If CRIU checkpoint mode is enabled, use the 2nd restricted security policy.
86+
if (InternalCRIUSupport.isCheckpointAllowed()) {
87+
securitySetting = "2";
88+
}
89+
/*[ENDIF] CRIU_SUPPORT*/
90+
userSecuritySetting = securitySetting;
7791
userEnabledSecurity = !isNullOrBlank(userSecuritySetting);
7892
isSecuritySupported = "Linux".equalsIgnoreCase(props[2])
7993
&& supportPlatforms.contains(props[3]);
@@ -86,14 +100,24 @@ private RestrictedSecurityConfigurator() {
86100

87101
/**
88102
* Restricted security mode will be enabled only if the semeru.fips system
89-
* property is true (default as false).
103+
* property is true (default as false), or semeru.restrictedsecurity is set,
104+
* or CRIU checkpoint mode is enabled.
90105
*
91106
* @return true if restricted security is enabled
92107
*/
93108
public static boolean isEnabled() {
94109
return securityEnabled;
95110
}
96111

112+
/*[IF CRIU_SUPPORT]*/
113+
/**
114+
* Disables the restricted security mode.
115+
*/
116+
public static void disable() {
117+
securityEnabled = false;
118+
}
119+
/*[ENDIF] CRIU_SUPPORT*/
120+
97121
/**
98122
* Remove the security providers and only add the restricted security providers.
99123
*

src/java.base/share/conf/security/java.security

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,26 @@ RestrictedSecurity1.javax.net.ssl.keyStore = NONE
135135

136136
RestrictedSecurity1.securerandom.provider = SunPKCS11-NSS-FIPS
137137
RestrictedSecurity1.securerandom.algorithm = PKCS11
138+
139+
RestrictedSecurity2.desc.name = CRIU
140+
RestrictedSecurity2.desc.number = 1
141+
RestrictedSecurity2.desc.policy = Security
142+
RestrictedSecurity2.desc.sunsetDate = 2030-01-01
143+
144+
RestrictedSecurity2.tls.disabledNamedCurves =
145+
RestrictedSecurity2.tls.disabledAlgorithms =
146+
RestrictedSecurity2.tls.ephemeralDHKeySize =
147+
RestrictedSecurity2.tls.legacyAlgorithms =
148+
149+
RestrictedSecurity2.jce.certpath.disabledAlgorithms =
150+
RestrictedSecurity2.jce.legacyAlgorithms =
151+
RestrictedSecurity2.jce.provider.1 = openj9.internal.criu.CRIUSECProvider
152+
153+
RestrictedSecurity2.keystore.type =
154+
RestrictedSecurity2.javax.net.ssl.keyStore =
155+
156+
RestrictedSecurity2.securerandom.provider = CRIUSEC
157+
RestrictedSecurity2.securerandom.algorithm = SHA1PRNG
138158
#endif
139159

140160
#

0 commit comments

Comments
 (0)