Blame SOURCES/pr3183-rh1340845-support_fedora_rhel_system_crypto_policy.patch

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

Additional default values of security properties are read from a

cadfac
+ * system-specific location, if available.

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