|
|
b6221f |
|
|
|
b6221f |
# HG changeset patch
|
|
|
b6221f |
# User andrew
|
|
|
b6221f |
# Date 1478057514 0
|
|
|
b6221f |
# Node ID 1c4d5cb2096ae55106111da200b0bcad304f650c
|
|
|
b6221f |
# Parent 3d53f19b48384e5252f4ec8891f7a3a82d77af2a
|
|
|
b6221f |
PR3694: Support Fedora/RHEL system crypto policy
|
|
|
b6221f |
diff -r 3d53f19b4838 -r 1c4d5cb2096a src/java.base/share/classes/java/security/Security.java
|
|
|
b6221f |
--- a/src/java.base/share/classes/java/security/Security.java Wed Oct 26 03:51:39 2016 +0100
|
|
|
b6221f |
+++ b/src/java.base/share/classes/java/security/Security.java Wed Nov 02 03:31:54 2016 +0000
|
|
|
b6221f |
@@ -43,6 +43,9 @@
|
|
|
b6221f |
* implementation-specific location, which is typically the properties file
|
|
|
b6221f |
* {@code conf/security/java.security} in the Java installation directory.
|
|
|
b6221f |
*
|
|
|
b6221f |
+ * Additional default values of security properties are read from a
|
|
|
b6221f |
+ * system-specific location, if available.
|
|
|
b6221f |
+ *
|
|
|
b6221f |
* @author Benjamin Renaud
|
|
|
b6221f |
* @since 1.1
|
|
|
b6221f |
*/
|
|
|
b6221f |
@@ -52,6 +55,10 @@
|
|
|
b6221f |
private static final Debug sdebug =
|
|
|
b6221f |
Debug.getInstance("properties");
|
|
|
b6221f |
|
|
|
b6221f |
+ /* System property file*/
|
|
|
b6221f |
+ private static final String SYSTEM_PROPERTIES =
|
|
|
b6221f |
+ "/etc/crypto-policies/back-ends/java.config";
|
|
|
b6221f |
+
|
|
|
b6221f |
/* The java.security properties */
|
|
|
b6221f |
private static Properties props;
|
|
|
b6221f |
|
|
|
b6221f |
@@ -93,6 +100,7 @@
|
|
|
b6221f |
if (sdebug != null) {
|
|
|
b6221f |
sdebug.println("reading security properties file: " +
|
|
|
b6221f |
propFile);
|
|
|
b6221f |
+ sdebug.println(props.toString());
|
|
|
b6221f |
}
|
|
|
b6221f |
} catch (IOException e) {
|
|
|
b6221f |
if (sdebug != null) {
|
|
|
b6221f |
@@ -114,6 +122,31 @@
|
|
|
b6221f |
}
|
|
|
b6221f |
|
|
|
b6221f |
if ("true".equalsIgnoreCase(props.getProperty
|
|
|
b6221f |
+ ("security.useSystemPropertiesFile"))) {
|
|
|
b6221f |
+
|
|
|
b6221f |
+ // now load the system file, if it exists, so its values
|
|
|
b6221f |
+ // will win if they conflict with the earlier values
|
|
|
b6221f |
+ try (BufferedInputStream bis =
|
|
|
b6221f |
+ new BufferedInputStream(new FileInputStream(SYSTEM_PROPERTIES))) {
|
|
|
b6221f |
+ props.load(bis);
|
|
|
b6221f |
+ loadedProps = true;
|
|
|
b6221f |
+
|
|
|
b6221f |
+ if (sdebug != null) {
|
|
|
b6221f |
+ sdebug.println("reading system security properties file " +
|
|
|
b6221f |
+ SYSTEM_PROPERTIES);
|
|
|
b6221f |
+ sdebug.println(props.toString());
|
|
|
b6221f |
+ }
|
|
|
b6221f |
+ } catch (IOException e) {
|
|
|
b6221f |
+ if (sdebug != null) {
|
|
|
b6221f |
+ sdebug.println
|
|
|
b6221f |
+ ("unable to load security properties from " +
|
|
|
b6221f |
+ SYSTEM_PROPERTIES);
|
|
|
b6221f |
+ e.printStackTrace();
|
|
|
b6221f |
+ }
|
|
|
b6221f |
+ }
|
|
|
b6221f |
+ }
|
|
|
b6221f |
+
|
|
|
b6221f |
+ if ("true".equalsIgnoreCase(props.getProperty
|
|
|
b6221f |
("security.overridePropertiesFile"))) {
|
|
|
b6221f |
|
|
|
b6221f |
String extraPropFile = System.getProperty
|
|
|
b6221f |
diff -r 3d53f19b4838 -r 1c4d5cb2096a src/java.base/share/conf/security/java.security
|
|
|
b6221f |
--- a/src/java.base/share/conf/security/java.security Wed Oct 26 03:51:39 2016 +0100
|
|
|
b6221f |
+++ b/src/java.base/share/conf/security/java.security Wed Nov 02 03:31:54 2016 +0000
|
|
|
b6221f |
@@ -276,6 +276,13 @@
|
|
|
b6221f |
security.overridePropertiesFile=true
|
|
|
b6221f |
|
|
|
b6221f |
#
|
|
|
b6221f |
+# Determines whether this properties file will be appended to
|
|
|
b6221f |
+# using the system properties file stored at
|
|
|
b6221f |
+# /etc/crypto-policies/back-ends/java.config
|
|
|
b6221f |
+#
|
|
|
b6221f |
+security.useSystemPropertiesFile=true
|
|
|
b6221f |
+
|
|
|
b6221f |
+#
|
|
|
b6221f |
# Determines the default key and trust manager factory algorithms for
|
|
|
b6221f |
# the javax.net.ssl package.
|
|
|
b6221f |
#
|