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

Additional default values of security properties are read from a

Alex Kashchenko 03a9057
+ * system-specific location, if available.

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