summaryrefslogtreecommitdiffstats
path: root/recipes-core/ca-certificates-java/ca-certificates-java/0001-UpdateCertificates-handle-SYSROOT-environment-variab.patch
diff options
context:
space:
mode:
authorAndré Draszik <andre.draszik@jci.com>2018-04-02 07:43:44 +0100
committerRichard Leitner <richard.leitner@skidata.com>2018-06-12 21:11:05 +0200
commit27e4ffb925cc60f18a4062098ed63d0826812249 (patch)
tree8f189a52328cde0ecde0cfca8c802e2aa080ffee /recipes-core/ca-certificates-java/ca-certificates-java/0001-UpdateCertificates-handle-SYSROOT-environment-variab.patch
parent9f31b5f201ee4c08fec29bd0b91b8071e30a7d49 (diff)
downloadmeta-java-27e4ffb925cc60f18a4062098ed63d0826812249.tar.gz
ca-certificates-java: add recipe to generate trustStore
The OpenJDK-8 package currently comes with a trustStore that was generated at OpenJDK-8-native build time from *all* certificates available in the system, not just from those that are marked as trusted. This isn't right... So this recipe hooks into the ca-certificates package and (re-) creates the Java trustStore based on the certificates trusted by the system, whenever they are updated. This works both at image build time, as well as during runtime on the target. It works by installing a hook into ca-certificates' $SYSROOT/etc/ca-certificates/update.d/ that is passed the added/removed certificates as arguments. That hook is then updating the Java trustStore and storing it in $SYSROOT/etc/ssl/certs/java/cacerts. The whole idea as well as the implementation of the hook is borrowed from debian's ca-certificate-java package, version 20170930 (the latest as of this commit). Looking at the debian package, it appears like the same binary trustStore ($SYSROOT/etc/ssl/certs/java/cacerts) can be used by different versions of Java: * OpenJDK-7, 8, 9 * Oracle Java 7, 8, 9 The Java sources here can be compiled by any compatible Java compiler, but the resulting jar file should only be run by one of the compatible Java versions mentioned above, so as to create a trustStore that can be read by any of the Java versions mentioned above. We try to ensure this using PACKAGE_WRITE_DEPS during image build time, and by trying to find a compatible Java version inside ${libdir_jvm} at runtime both during image build time and on the target. Given there is nothing that we can RDEPENDS on that would satisfy any of the above Java versions (either JDK or JRE), we simply RDEPENDS on java2-runtime, and test PREFERRED_RPROVIDER_java2-runtime to be satisfactory. Given I can only test OpenJDK/OpenJRE 8 at the moment, only those are actually allowed at the moment, though. This can easily be extended upon confirmation. Final note - as per the debian package, there are three cases when we can be called: 1) as part of update-ca-certificates -> add / remove certs as instructed 2) if first time install -> add all certs 3) package update -> do nothing We have no way to easily distinguish between first time install and package update in OE, so the distinction between cases 2) and 3) isn't perfect. Signed-off-by: André Draszik <andre.draszik@jci.com> Signed-off-by: Maxin B. John <maxin.john@intel.com>
Diffstat (limited to 'recipes-core/ca-certificates-java/ca-certificates-java/0001-UpdateCertificates-handle-SYSROOT-environment-variab.patch')
-rw-r--r--recipes-core/ca-certificates-java/ca-certificates-java/0001-UpdateCertificates-handle-SYSROOT-environment-variab.patch43
1 files changed, 43 insertions, 0 deletions
diff --git a/recipes-core/ca-certificates-java/ca-certificates-java/0001-UpdateCertificates-handle-SYSROOT-environment-variab.patch b/recipes-core/ca-certificates-java/ca-certificates-java/0001-UpdateCertificates-handle-SYSROOT-environment-variab.patch
new file mode 100644
index 0000000..ca052ab
--- /dev/null
+++ b/recipes-core/ca-certificates-java/ca-certificates-java/0001-UpdateCertificates-handle-SYSROOT-environment-variab.patch
@@ -0,0 +1,43 @@
1From 70cd9999d3c139230aa05816e98cdc3e50ead713 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <andre.draszik@jci.com>
3Date: Tue, 27 Mar 2018 16:50:39 +0100
4Subject: [PATCH] UpdateCertificates: handle SYSROOT environment variable for
5 cacerts
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
10We can now pass in the sysroot, so that the trustStore
11is written to /etc/ssl/certs/java/cacerts below $SYSROOT.
12
13Upstream-Status: Inappropriate [OE specific]
14Signed-off-by: André Draszik <andre.draszik@jci.com>
15---
16 src/main/java/org/debian/security/UpdateCertificates.java | 6 +++++-
17 1 file changed, 5 insertions(+), 1 deletion(-)
18
19diff --git a/src/main/java/org/debian/security/UpdateCertificates.java b/src/main/java/org/debian/security/UpdateCertificates.java
20index e4f8205..dba9a7b 100644
21--- a/src/main/java/org/debian/security/UpdateCertificates.java
22+++ b/src/main/java/org/debian/security/UpdateCertificates.java
23@@ -40,15 +40,19 @@ public class UpdateCertificates {
24
25 public static void main(String[] args) throws IOException, GeneralSecurityException {
26 String passwordString = "changeit";
27+ String sysroot;
28 if (args.length == 2 && args[0].equals("-storepass")) {
29 passwordString = args[1];
30 } else if (args.length > 0) {
31 System.err.println("Usage: java org.debian.security.UpdateCertificates [-storepass <password>]");
32 System.exit(1);
33 }
34+ sysroot = System.getenv("SYSROOT");
35+ if (sysroot == null)
36+ sysroot = "";
37
38 try {
39- UpdateCertificates uc = new UpdateCertificates("/etc/ssl/certs/java/cacerts", passwordString);
40+ UpdateCertificates uc = new UpdateCertificates(sysroot + "/etc/ssl/certs/java/cacerts", passwordString);
41 // Force reading of inputstream in UTF-8
42 uc.processChanges(new InputStreamReader(System.in, "UTF8"));
43 uc.finish();