Skip to content

Rebuild JRI11.0.6 for Debian repositories with CAcert fixes #731

Open

Description

@JakubVanek

Reference: ev3dev-lang-java/openjdk-ev3#64 (comment)

Currently the jri-11-ev3 package in ev3dev does not install properly, it leaves itself half-configured and with a damaged trust store (this unfortunately ships in the ev3dev image). I think that it would be a good idea to:

I want to rebuild the JRI11.0.6 locally after one of the fixes above is merged and then upload the fixed package as a new package revision (-2).

Using Mozilla's certificates (ev3dev-lang-java/openjdk-ev3#62) seems somewhat orthogonal to this. Without that PR, the following cacerts file will be (and currently are) used: https://github.com/AdoptOpenJDK/openjdk-build/blob/master/security/cacerts. While they're not the most up-to-date, they seem to work fine for GitHub as discovered in #728.

Progress:

  • Decide on the way forward
  • Merge the chosen fix
  • Rebuild tarpkgs for JRI11.0.6
  • Build fixes debpkgs for JRI11.0.6
  • Upload fixed debpkgs

Activity

  1. JakubVanek commented on May 26, 2020

    @JakubVanek
    ContributorAuthor

    Clean Java installation equals to running the following:

    sudo apt update
    sudo apt autoremove --purge jri-11-ev3 ca-certificates-java
    sudo apt install jri-11-ev3

    This is (as far as I remember) quite slow on EV3, so this solution is not ideal.

  2. JakubVanek commented on May 26, 2020

    @JakubVanek
    ContributorAuthor

    On the other hand, the minimal upgrade command to install fixed JRI with its own CA certificates is not that different; we only get away from the need to purge the packages.

    sudo apt update
    sudo apt install jri-11-ev3 # this works as a single-package update too
    
  3. JakubVanek commented on May 26, 2020

    @JakubVanek
    ContributorAuthor

    Hmm, it seems that the cert store could be fixed also by the following command:

    sudo dpkg --purge --force-all ca-certificates-java
    sudo apt-get download ca-certificates-java
    sudo dpkg -i ./ca-certificates-java*
    

    This sways my opinion towards going with ev3dev-lang-java/openjdk-ev3#64 instead of ev3dev-lang-java/openjdk-ev3#61

    • new installations will ship with working system Java trust store
    • old installations can be fixed with the commands above

    That would keep the cacerts split between tarpkg and debpkg:

    • JDK/JRI tarpkg will have its own bundled cacerts, be it from OpenJDK or Mozilla,
    • JRI debpkg will use the system cacerts provided by ca-certificates-java (~ nice integration with Debian).
  4. JakubVanek commented on May 26, 2020

    @JakubVanek
    ContributorAuthor

    Countering the previous argument, now that JRI debpkgs are available from Jenkins, the update by an end-user to a newer version can also be made like this:

    wget https://ci.adoptopenjdk.net/view/ev3dev/job/eljbuild/job/stretch-14/lastSuccessfulBuild/artifact/build/pkg/jri-14-ev3_14.0.0~36-1_armel.deb
    sudo dpkg -i jri-14-ev3_14.0.0~36-1_armel.deb

    When installing on an ev3dev system with damaged system trust store, the clean reinstallation of ca-certificates-java would have to be done separately with ev3dev-lang-java/openjdk-ev3#64. With ev3dev-lang-java/openjdk-ev3#61, the system trust store would not be used anymore, instead the Mozilla/OpenJDK cacerts would be used.

  5. JakubVanek commented on May 26, 2020

    @JakubVanek
    ContributorAuthor

    Summary:
    ev3dev-lang-java/openjdk-ev3#61 drop dependency on ca-certificates-java

    • drops Debian-style integration with system CA certificate store
      • integration = Java keystore is automatically generated from CA certificates stored in /etc/ssl/certs
      • this could confuse some users that would rely on this
      • instead of storing the CA certificates in the system and running update-ca-certificates, users would have to update the /usr/lib/jvm/jri-N-ev3/lib/security/cacerts file manually via keytool/other util
    • but it fixes new and existing installations with new packages by ignoring the damaged /etc/ssl/certs/java/cacerts and instead shipping with a separate non-automatically-generated trust store (the one that ships with JDK/JRI tarpkg)

    ev3dev-lang-java/openjdk-ev3#64 add jri-N-ev3 self-dep to fix ca-certificates-java

    • maintains Debian-style integration and fixes it so that it works properly
    • it can only fix new installations; for existing installations, the ca-certificates-java package has to be removed and then reinstalled
  6. JakubVanek commented on May 26, 2020

    @JakubVanek
    ContributorAuthor

    Java is not the only runtime that can use autogenerated key/trust stores, Mono/C# does this too.

    Mechanism: http://manpages.ubuntu.com/manpages/xenial/man8/update-ca-certificates.8.html (Java puts a hook in /etc/ca-certificates/update.d)

  7. JakubVanek commented on May 27, 2020

    @JakubVanek
    ContributorAuthor

    Summary of the 61, 62 & 63 64 PRs: ev3dev-lang-java/openjdk-ev3#61 (comment)

  8. JakubVanek commented on May 27, 2020

    @JakubVanek
    ContributorAuthor

    Current status:

    • JRI debpkg
      • it trusts SSL certificates stored in /etc/ssl/certs/java/cacerts truststore/keystore by default
        • these are auto-generated by the ca-certificates-java package from certificates configured in the system
        • the certs that are in there usually come from Mozilla's CA certificate list
      • this does not currently work because of buggy integration between ca-certificates-java and jri-11-ev3 EDIT: that causes an issue during the ca-certificates-java installation and keystore creation
        • ca-certificates-java includes a Java utility for generating the keystore
          • this requires a configured JRI package to be present
          • but the JRI package is marked as Depends on ca-certificates-java too
          • → there needs to be a self-dependency specified for the JRI package so that DPKG configures it first and so /usr/bin/java is available
        • unfortunately, the bug triggers creation of a broken keystore
          • it "appears" to be working, but file command reports it as "data", not as "Java Keystore" and it seems that Java programs using TLS/SSL cannot use it
          • the keystore is created only during clean installation of ca-certificates-java, not on update/simple reinstall
          • this means that without adding some custom bug-detection and fixup scripts, we are not able to fix the system keystore without removing ca-certificates-java and installing it back manually
    • JDK/JRI tarpkg
      • it trusts SSL certificates in a file embedded in the tarball
      • it works, but we need to choose which certificate database to use
      • the database is currently downloaded from https://github.com/AdoptOpenJDK/openjdk-build/blob/master/security/cacerts
        • however, it seems that this file is not used anymore by AdoptOpenJDK builds, they probably use OpenJDK CA certificates directly, so this area should be changed in our builds anyways
      • OpenJDK CA certificates
        • they are the standard
        • they are similar but different from the browser ones
        • it seems that AdoptOpenJDK may move to Mozilla's CA certificates as they are updated more often
  9. JakubVanek commented on May 27, 2020

    @JakubVanek
    ContributorAuthor

    How the PRs relate to the current status:

    JRI debpkg problems:

    • [pkg] fix: drop dependency on ca-certificates-java openjdk-ev3#61 drop dependency on ca-certificates-java
      • this fixes CA certificates in JRI debpkg by not using system-managed /etc/ssl/certs/java/cacerts and rather shipping and using the same cacerts as the ones in JDK/JRI tarpkg
        • we lose Debian-style integration with system CA certificate store
          • this may confuse some users if they relied on it
          • instead of storing the CA certificates in the system and running update-ca-certificates, users would have to update the /usr/lib/jvm/jri-N-ev3/lib/security/cacerts file manually via keytool/other util
        • on the other hand, simple upgrade of jri-N-ev3 to any newer major or minor version would fix the problem directly, although _ only for that version_
          • this can be done by downloading JRI debpkg from Jenkins and installing it via DPKG
          • alternatively apt-get update && apt-get dist-upgrade would work too
    • [pkg] fix: add jri-N-ev3 self-dep to fix ca-certificates-java openjdk-ev3#64 add jri-N-ev3 self-dep to fix ca-certificates-java
      • this fixes CA certificates in JRI debpkg by ensuring that /etc/ssl/certs/java/cacerts gets generated correctly, but it cannot (yet) fix the broken state
        • it keeps the Debian-style integration and fixes it so that it works properly
        • this can only fix new installation (= ev3dev images because JRI is pre-installed)
        • users can fix the existing trust stores in old versions by running the following commands (even without any of the PRs being merged)
          sudo dpkg --purge --force-all ca-certificates-java
          sudo apt-get download ca-certificates-java
          sudo dpkg -i ./ca-certificates-java*

    Source of CA certificates (these change the CA certificates that ship with JDK/JRI tarpkg and that would ship with JRI debpkg if ev3dev-lang-java/openjdk-ev3#61 is picked):

  10. jabrena commented on May 28, 2020

    @jabrena
    Member

    Hi @JakubVanek, I will do a short summary:

    • Current build doesn´t have SSL support

    So, we need to build again the package. Is it possible to create a build to add the certificates inside? I read your comments and JRI has some issues linking with ca-certificates-java, so add the same certificates that from OpenJDK on the JRI. I am not sure if Mozilla CA certificates but we could begin with that certificates and evolve later. In the solution, we need to add few test to guarantee that we solved the issue.

    I will close tomorrow, previous PR. We only need one PR with the solution, not multiple PR.
    https://github.com/ev3dev-lang-java/openjdk-ev3/pulls

    Juan Antonio

  11. JakubVanek commented on May 28, 2020

    @JakubVanek
    ContributorAuthor

    Hi @jabrena,

    Hi @JakubVanek, I will do a short summary:

    • Current build doesn´t have SSL support

    If "current build" == jri-11-ev3 package/debpkg currently uploaded to ev3dev repository, then yes, it doesn't support SSL out of the box.

    So, we need to build again the package.

    Yes. For this, I'd locally force the OpenJDK source version to jdk-11.0.6+10 (last version in ev3dev repository) and with that I would locally perform a new full openjdk-ev3 build and then I would package that into a new JRI debpkg.

    Is it possible to create a build to add the certificates inside?

    Yup, this is what ev3dev-lang-java/openjdk-ev3#61 should enable. Any build done after the pull request is merged should support SSL properly.

    I read your comments and JRI has some issues linking with ca-certificates-java, so add the same certificates that from OpenJDK on the JRI.

    I assume that OpenJDK == JDK/JRI tarpkg. In that case, the ev3dev-lang-java/openjdk-ev3#61 should be merged and ev3dev-lang-java/openjdk-ev3#64 should be closed.

    I am not sure if Mozilla CA certificates but we could begin with that certificates and evolve later.

    I agree, at worst we can revert such a change. To go this way, ev3dev-lang-java/openjdk-ev3#62 should be merged and ev3dev-lang-java/openjdk-ev3#65 should be closed.

    In the solution, we need to add few test to guarantee that we solved the issue.

    There is currently no mechanism for this, but I suppose as a stop-gap measure for short tests like this we could add a new phase to the Jenkins build job. To do this properly, a separate Jenkins job with tests should be chained after the build succeeds (this was the idea behind the "Pipelines" folder, although that route is not necessary). By doing it like so, we allow jobs doing testing to be scheduled on a less-powerful Jenkins node so that computing resources are not wasted. AdoptOpenJDK Jenkins has a test/ci.role.test node tag for this purpose.

    I will close tomorrow, previous PR.
    We only need one PR with the solution, not multiple PR.
    https://github.com/ev3dev-lang-java/openjdk-ev3/pulls

    If you want to close all pull requests there, then that is in my opinion adding extra unnecessary work.

    As far as the current decision goes, you'd only need to close ev3dev-lang-java/openjdk-ev3#64 and ev3dev-lang-java/openjdk-ev3#65 (rejected solutions for two different issues) and merge ev3dev-lang-java/openjdk-ev3#61 and ev3dev-lang-java/openjdk-ev3#62 (accepted solutions for two different issues).

    Juan Antonio

    Jakub

  12. jabrena commented on May 28, 2020

    @jabrena
    Member

    Hi @JakubVanek,

    close the PR that we are not going to merge and merge 2 pending PR into one to analyse better the change. Include tests for the support. Later, we will do together the publication on ev3dev repository

  13. JakubVanek commented on May 28, 2020

    @JakubVanek
    ContributorAuthor

    Hi @JakubVanek,

    close the PR that we are not going to merge and merge 2 pending PR into one to analyse better the change. Include tests for the support. Later, we will do together the publication on ev3dev repository

    ev3dev-lang-java/openjdk-ev3#66 created, but I will not add the tests yet.

  14. jabrena commented on May 28, 2020

    @jabrena
    Member

    Try to review if OpenJDK has some tests for SSH. This is the reason that the software add tests in the software life cycle. Meanwhile, I will review the rest of commits.

  15. JakubVanek commented on May 29, 2020

    @JakubVanek
    ContributorAuthor

    I have decided to go with a minimum viable testing, it is now added to the PR.

  16. 1 remaining item

  17. jabrena commented on May 29, 2020

    @jabrena
    Member

    Hi @JakubVanek,

    OpenJDK has a specific test suite:
    https://github.com/AdoptOpenJDK/openjdk-tests

    What is the stopper to not use the official OpenJDK test suite with SSL support out of the box?

    Juan Antonio

  18. jabrena commented on May 29, 2020

    @jabrena
    Member

    image

  19. JakubVanek commented on May 29, 2020

    @JakubVanek
    ContributorAuthor

    I am sorry, but I will not add full testing support to openjdk-ev3. I do not want to resume my activities in it, I just wanted to help with one issue where the cause was unknown.

  20. JakubVanek commented on May 29, 2020

    @JakubVanek
    ContributorAuthor

    Hi @JakubVanek,

    OpenJDK has a specific test suite:
    https://github.com/AdoptOpenJDK/openjdk-tests

    What is the stopper to not use the official OpenJDK test suite with SSL support out of the box?

    Juan Antonio

    One is that I have given up write rights in AdoptOpenJDK Jenkins and I do not want to gain them back.

  21. JakubVanek commented on May 29, 2020

    @JakubVanek
    ContributorAuthor

    One is that I have given up write rights in AdoptOpenJDK Jenkins and I do not want to gain them back.

    To clarify: full testing suite would take a long time to run and thus it would likely require new jobs in Jenkins.

  22. jabrena commented on May 29, 2020

    @jabrena
    Member

    This project was created to develop robots with Java.
    When you develop software with Java, the creation of software includes code + testing.
    The same with the JVM.

    Try to add in the build an initial testing support, TRY IT @JakubVanek
    I did for OpenJDK10.

    Today it is the SSL, tomorrow will be another stuff because the build itself is not enough.

  23. JakubVanek commented on May 29, 2020

    @JakubVanek
    ContributorAuthor

    There is still the Azul's Zulu Community build which now advertises ARMv5 support and it undergoes extensive testing: https://www.azul.com/downloads/zulu-community/?architecture=arm-32-bit-sf&package=jdk

    Disclaimer: I did not communicate with anyone from Azul or anyone related to their JVM in the past year.

  24. jabrena commented on May 29, 2020

    @jabrena
    Member

    Sorry @JakubVanek,

    That distribution only supports LTS versions and and we build all versions. This is the key difference, so it is not an alternative for this issue.

  25. JakubVanek commented on May 29, 2020

    @JakubVanek
    ContributorAuthor

    Oki, however I still do not plan to engage in the project actively.

  26. jabrena commented on May 30, 2020

    @jabrena
    Member

    It is a pity to hear it.

    I am not sure how many commits do you need to learn the importance about testing but I gave you 3 years to learn that value so now, the tolerance is zero.

    You are welcome to return if you want to help and this is your real intention but here, exist some Engineering rules. I try to be clear in this aspect.

    I recommend another article to read:
    https://martinfowler.com/bliki/TechnicalDebt.html

    Juan Antonio

  27. JakubVanek commented on Jun 15, 2020

    @JakubVanek
    ContributorAuthor

    Hi,

    I've thought about the concept a little today and I don't think that it would bring much value currently anyway. If the tests are added, some of them will certainly fail. Then there are two possibilities - either suppressing the problematic ones or fixing them. The first option reduces the value of the tests to only regression detection. That may indeed be useful, but it only stops the quality from getting lower. The second option brings more benefits, but it requires a commitment to fix the failing tests and an active maintainership. I do not want to take up such a commitment to this project, so a third party would have to do the fixing and that does not seem very likely.

    Best regards,

    Jakub

  28. jabrena commented on Jun 16, 2020

    @jabrena
    Member

    Hi @JakubVanek,

    if you remember in OpenJDK10 the infra was emulated but now we are compiling in a better environment so the test should pass. The previous comment is about the second option. Try to add the execution.

    Here existed the previous work:

    Try to execute only make jdk_math only as a Pilot and later, we will review the results.

    Note: I celebrate that you review the case, you are doing a good job in this area. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions