3737
3838import 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 *
0 commit comments