Blame SOURCES/pr3694-rh1340845-support_fedora_rhel_system_crypto_policy.patch

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

Additional default values of security properties are read from a

660215
+ * system-specific location, if available.

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