647f8de
647f8de
# HG changeset patch
647f8de
# User andrew
647f8de
# Date 1478057514 0
647f8de
# Node ID 1c4d5cb2096ae55106111da200b0bcad304f650c
647f8de
# Parent  3d53f19b48384e5252f4ec8891f7a3a82d77af2a
647f8de
PR3183: Support Fedora/RHEL system crypto policy
647f8de
647f8de
diff -r 3d53f19b4838 -r 1c4d5cb2096a src/share/classes/java/security/Security.java
647f8de
--- openjdk/jdk/src/share/classes/java/security/Security.java	Wed Oct 26 03:51:39 2016 +0100
647f8de
+++ openjdk/jdk/src/share/classes/java/security/Security.java	Wed Nov 02 03:31:54 2016 +0000
647f8de
@@ -43,6 +43,9 @@
647f8de
  * implementation-specific location, which is typically the properties file
647f8de
  * {@code lib/security/java.security} in the Java installation directory.
647f8de
  *
647f8de
+ * 

Additional default values of security properties are read from a

647f8de
+ * system-specific location, if available.

647f8de
+ *
647f8de
  * @author Benjamin Renaud
647f8de
  */
647f8de
 
647f8de
@@ -52,6 +55,10 @@
647f8de
     private static final Debug sdebug =
647f8de
                         Debug.getInstance("properties");
647f8de
 
647f8de
+    /* System property file*/
647f8de
+    private static final String SYSTEM_PROPERTIES =
647f8de
+        "/etc/crypto-policies/back-ends/java.config";
647f8de
+
647f8de
     /* The java.security properties */
647f8de
     private static Properties props;
647f8de
 
647f8de
@@ -93,6 +100,7 @@
647f8de
                 if (sdebug != null) {
647f8de
                     sdebug.println("reading security properties file: " +
647f8de
                                 propFile);
647f8de
+                    sdebug.println(props.toString());
647f8de
                 }
647f8de
             } catch (IOException e) {
647f8de
                 if (sdebug != null) {
647f8de
@@ -114,6 +122,31 @@
647f8de
         }
647f8de
 
647f8de
         if ("true".equalsIgnoreCase(props.getProperty
647f8de
+                ("security.useSystemPropertiesFile"))) {
647f8de
+
647f8de
+            // now load the system file, if it exists, so its values
647f8de
+            // will win if they conflict with the earlier values
647f8de
+            try (BufferedInputStream bis =
647f8de
+                 new BufferedInputStream(new FileInputStream(SYSTEM_PROPERTIES))) {
647f8de
+                props.load(bis);
647f8de
+                loadedProps = true;
647f8de
+
647f8de
+                if (sdebug != null) {
647f8de
+                    sdebug.println("reading system security properties file " +
647f8de
+                                   SYSTEM_PROPERTIES);
647f8de
+                    sdebug.println(props.toString());
647f8de
+                }
647f8de
+            } catch (IOException e) {
647f8de
+                if (sdebug != null) {
647f8de
+                    sdebug.println
647f8de
+                        ("unable to load security properties from " +
647f8de
+                         SYSTEM_PROPERTIES);
647f8de
+                    e.printStackTrace();
647f8de
+                }
647f8de
+            }
647f8de
+        }
647f8de
+
647f8de
+        if ("true".equalsIgnoreCase(props.getProperty
647f8de
                 ("security.overridePropertiesFile"))) {
647f8de
 
647f8de
             String extraPropFile = System.getProperty
647f8de
diff -r 3d53f19b4838 -r 1c4d5cb2096a src/share/lib/security/java.security-aix
647f8de
--- openjdk/jdk/src/share/lib/security/java.security-aix	Wed Oct 26 03:51:39 2016 +0100
647f8de
+++ openjdk/jdk/src/share/lib/security/java.security-aix	Wed Nov 02 03:31:54 2016 +0000
647f8de
@@ -276,6 +276,13 @@
647f8de
 security.overridePropertiesFile=true
647f8de
 
647f8de
 #
647f8de
+# Determines whether this properties file will be appended to
647f8de
+# using the system properties file stored at
647f8de
+# /etc/crypto-policies/back-ends/java.config
647f8de
+#
647f8de
+security.useSystemPropertiesFile=false
647f8de
+
647f8de
+#
647f8de
 # Determines the default key and trust manager factory algorithms for
647f8de
 # the javax.net.ssl package.
647f8de
 #
647f8de
diff -r 3d53f19b4838 -r 1c4d5cb2096a src/share/lib/security/java.security-linux
647f8de
--- openjdk/jdk/src/share/lib/security/java.security-linux	Wed Oct 26 03:51:39 2016 +0100
647f8de
+++ openjdk/jdk/src/share/lib/security/java.security-linux	Wed Nov 02 03:31:54 2016 +0000
647f8de
@@ -276,6 +276,13 @@
647f8de
 security.overridePropertiesFile=true
647f8de
 
647f8de
 #
647f8de
+# Determines whether this properties file will be appended to
647f8de
+# using the system properties file stored at
647f8de
+# /etc/crypto-policies/back-ends/java.config
647f8de
+#
647f8de
+security.useSystemPropertiesFile=true
647f8de
+
647f8de
+#
647f8de
 # Determines the default key and trust manager factory algorithms for
647f8de
 # the javax.net.ssl package.
647f8de
 #
647f8de
diff -r 3d53f19b4838 -r 1c4d5cb2096a src/share/lib/security/java.security-macosx
647f8de
--- openjdk/jdk/src/share/lib/security/java.security-macosx	Wed Oct 26 03:51:39 2016 +0100
647f8de
+++ openjdk/jdk/src/share/lib/security/java.security-macosx	Wed Nov 02 03:31:54 2016 +0000
647f8de
@@ -279,6 +279,13 @@
647f8de
 security.overridePropertiesFile=true
647f8de
 
647f8de
 #
647f8de
+# Determines whether this properties file will be appended to
647f8de
+# using the system properties file stored at
647f8de
+# /etc/crypto-policies/back-ends/java.config
647f8de
+#
647f8de
+security.useSystemPropertiesFile=false
647f8de
+
647f8de
+#
647f8de
 # Determines the default key and trust manager factory algorithms for
647f8de
 # the javax.net.ssl package.
647f8de
 #
647f8de
diff -r 3d53f19b4838 -r 1c4d5cb2096a src/share/lib/security/java.security-solaris
647f8de
--- openjdk/jdk/src/share/lib/security/java.security-solaris	Wed Oct 26 03:51:39 2016 +0100
647f8de
+++ openjdk/jdk/src/share/lib/security/java.security-solaris	Wed Nov 02 03:31:54 2016 +0000
647f8de
@@ -278,6 +278,13 @@
647f8de
 security.overridePropertiesFile=true
647f8de
 
647f8de
 #
647f8de
+# Determines whether this properties file will be appended to
647f8de
+# using the system properties file stored at
647f8de
+# /etc/crypto-policies/back-ends/java.config
647f8de
+#
647f8de
+security.useSystemPropertiesFile=false
647f8de
+
647f8de
+#
647f8de
 # Determines the default key and trust manager factory algorithms for
647f8de
 # the javax.net.ssl package.
647f8de
 #
647f8de
diff -r 3d53f19b4838 -r 1c4d5cb2096a src/share/lib/security/java.security-windows
647f8de
--- openjdk/jdk/src/share/lib/security/java.security-windows	Wed Oct 26 03:51:39 2016 +0100
647f8de
+++ openjdk/jdk/src/share/lib/security/java.security-windows	Wed Nov 02 03:31:54 2016 +0000
647f8de
@@ -279,6 +279,13 @@
647f8de
 security.overridePropertiesFile=true
647f8de
 
647f8de
 #
647f8de
+# Determines whether this properties file will be appended to
647f8de
+# using the system properties file stored at
647f8de
+# /etc/crypto-policies/back-ends/java.config
647f8de
+#
647f8de
+security.useSystemPropertiesFile=false
647f8de
+
647f8de
+#
647f8de
 # Determines the default key and trust manager factory algorithms for
647f8de
 # the javax.net.ssl package.
647f8de
 #
647f8de