Blame PR3183.patch

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

Additional default values of security properties are read from a

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

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