Blame SOURCES/pr3183-rh1340845-support_fedora_rhel_system_crypto_policy.patch

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

Additional default values of security properties are read from a

dee830
+ * system-specific location, if available.

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