-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to write cacerts on read-only file system with Java 21 #355
Comments
This may be related to #344. It could also be related to a recent change in the underlying certificate loading to support Java 18+. Previously, we just did not load CA certificates if you were on Java 18+. This is because the keystore format changed and we had trouble with the new format and libraries being used. Those have all been resolved, and so it should be importing system CA certs into the JVM's default trust store now. This is the behavior that allows you to add your own trusted CA certs to your container (see the ca-certificates buildpack). It is possible that previously it was just skipping this since we couldn't write to the keystore, and now it's writing and so you're seeing the error. This ability to import ca certs should work so long as you have a writable Thanks for this report. |
Also related: #359 |
Hi all. Just wondering if there's an update on this issue. Cheers |
I haven't had time to dig and try reproducing it myself, but looking at the error and tracing it through the code. I think this is the spot that's triggering the error. https://github.com/paketo-buildpacks/libjvm/blob/main/keystore.go#L168 Oddly, the previous lines check for write access and must succeed, otherwise it would return and not trigger the error.
I suspect that we need to handle this differently because it's a read-only file system, not a write access issue. Again, I haven't had the time to reproduce to investigate possible fixes. @c0d1ngm0nk3y or @modulo11 I think you've been in this part of the code base. Have you seen any issues like this? Thanks |
I can reproduce the issue. @AndersClausen you need to provide a writable |
@modulo11 I thought this was supposed to skip, even if there is no writable temp dir. This PR is even adding warnings to indicate when that happens. |
I did some additional tests and it's working properly (without any writable folders) with the latest release of libjvm or Bellsoft etc. However, the latest builder does include a version of the Java buildpack which does not include the fix. |
@AndersClausen I apologize. There was a problem with the Paketo builder distribution and it had not picked up the latest buildpacks. This has been fixed. If you make sure to pull the latest builder, are you still seeing issues with it? |
Hi @dmikusa - thanks for the update. I'll try and get it tested within the next few days and get back to you with an update. |
I think this has been resolved, so I'm going to close this out. Please open a new issue if you're still seeing issues. |
After upgrading a simple Spring Boot service (v. 3.2.1) to use Java 21, we experience an error at deployment time that didn't occur when using Java 17 (Liberica distribution).
Expected Behavior
The service should start up as normal after deployment.
Current Behavior
After upgrading a simple Spring Boot service (v. 3.2.1) to use Java 21, we experience the following error at deployment time:
The OCI image was created using spring-boot-maven-plugin with the following settings:
and running the
mvn spring-boot:build-image
command.The service does not have any custom configuration with certificates and worked perfectly well with Java 17.
It's deployed to Kubernetes and the OCI image is running in a read-only file system mode specified by setting the readOnlyRootFilesystem property of the Kubernetes SecurityContext to
true
. This is something our Cyber Security team has advised us to do and worked with Java 17.Possible Solution
Not sure but puzzled to why it's trying to write certificates to the filesystem using Java 21 when that didn't happen with Java 17.
Steps to Reproduce
Motivations
In order to make the deployment successful, we have to set the readOnlyRootFilesystem to
false
which means we're less secure and goes against our company's cyber security recommendations.The text was updated successfully, but these errors were encountered: