[SRU] backport ca-certificates-java from cosmic (20180516ubuntu1)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ca-certificates-java (Ubuntu) |
Invalid
|
Undecided
|
Unassigned | ||
Bionic |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
[Impact]
Any user doing a new install - or upgrading if openjdk was not installed - can be affected as soon as they install any openjdk-11 package.
[Cause]
The ca-certificate-java version 20170930 (or earlier) used the default keystore to create /etc/ssl/
type.
From openjdk-9 upwards the default keystore type changed from 'jks' to 'pkcs12' [1] by means of JEP 229 [2]. A JKS keystore can be read without supplying a password (or by supplying an empty one) while a PKCS12 keystore requires a password to be set.
Thus a /etc/ssl/
Ubuntu does *not* set the javax.net.
thus any user that got a cacerts generated in JKCS12 won't be able
to use any secure connections from java.
[Test Case with cacerts 20170930ubuntu1 or earlier]
Start on a new bionic install/chroot without openjdk
1. Install openjdk-11
$ sudo apt-get install openjdk-11-jdk
2. Test the keystore with an empty password (optional) and make sure it is a PKCS12
$ keytool -list -cacerts
Enter keystore password: <leave empty>
***************** WARNING WARNING WARNING *****************
* The integrity of the information stored in your keystore *
* has NOT been verified! In order to verify its integrity, *
* you must provide your keystore password. *
***************** WARNING WARNING WARNING *****************
Keystore type: PKCS12
Keystore provider: SUN
Your keystore contains 0 entries
3. Test with the "changeit" password
$ keytool -list -cacerts
Enter keystore password: changeit
Keystore type: PKCS12
Keystore provider: SUN
Your keystore contains 133 entries
<snipped various certs>
4. Create the java test file
$ cat <<EOF >HttpsTester.java
import java.net.URL;
import javax.net.
public class HttpsTester {
public static void main(String[] args) throws java.io.IOException {
HttpsURLConnection connection = (HttpsURLConnec
System.
System.
}
}
EOF
5. Compile it
$ javac HttpsTester.java
6. Call it
$ /usr/lib/
7. Call it again, this time set the store password
$ /usr/lib/
-Djavax.
Response code: 200
It worked!
8. Install the newer ca-certificates
migrate cacerts from PKCS12 to JKS. Check that by running step #2
again
$ keytool -list -cacerts
Enter keystore password: <leave empty>
***************** WARNING WARNING WARNING *****************
* The integrity of the information stored in your keystore *
* has NOT been verified! In order to verify its integrity, *
* you must provide your keystore password. *
***************** WARNING WARNING WARNING *****************
Keystore type: JKS
Keystore provider: SUN
Your keystore contains 133 entries
<snipped various certs>
9. The old keystore should be saved in
/etc/ssl/
$ keytool -list -keystore /etc/ssl/
Enter keystore password: <leave empty>
***************** WARNING WARNING WARNING *****************
* The integrity of the information stored in your keystore *
* has NOT been verified! In order to verify its integrity, *
* you must provide your keystore password. *
***************** WARNING WARNING WARNING *****************
Keystore type: PKCS12
Keystore provider: SUN
Your keystore contains 0 entries
[Test Case with cacerts 20180516 or later]
Start on a new bionic install/chroot without openjdk
1. Install openjdk-11
$ sudo apt-get install openjdk-11-jdk
2. Test the keystore with an empty password (optional) and make sure it is a JKS
$ keytool -list -cacerts
Enter keystore password:
***************** WARNING WARNING WARNING *****************
* The integrity of the information stored in your keystore *
* has NOT been verified! In order to verify its integrity, *
* you must provide your keystore password. *
***************** WARNING WARNING WARNING *****************
Keystore type: JKS
Keystore provider: SUN
Your keystore contains 133 entries
<snipped various certs>
3. Test with the "changeit" password
keytool -list -cacerts
Enter keystore password: changeit
Keystore type: JKS
Keystore provider: SUN
Your keystore contains 133 entries
<snipped various certs>
4. Create the java test file
$ cat <<EOF >HttpsTester.java
import java.net.URL;
import javax.net.
public class HttpsTester {
public static void main(String[] args) throws java.io.IOException {
HttpsURLConnection connection = (HttpsURLConnec
System.
System.
}
}
EOF
5. Compile it
$ javac HttpsTester.java
6. Call it
$ /usr/lib/
Response code: 200
It worked!
7. Call it again, this time set the store password
$ /usr/lib/
-Djavax.
Response code: 200
It worked!
[Regression Potential]
* If a user has manually set his own JKCS12 cacerts and didn't update
/etc/default/
of "cacerts_
/etc/ssl/
[Other Info]
The cacerts keystore fix is related to 2 bugs:
1) bug #1739631, fixed by ca-certificates
2) bug #1771363, fixed by ca-certificates
cacerts keystore previously generated in PKCS12 to the correct JKS keystore type.
[References]
[1] The default keystore is defined by the keystore.type in the
/etc/java-
http://
[2] JEP 229: Create PKCS12 Keystores by Default
http://
summary: |
- [SRU] backport ca-certificates-java from cosmic (20180413ubuntu1) + [SRU] backport ca-certificates-java from cosmic (20180516ubuntu1) |
description: | updated |
tags: | added: bionic |
Changed in ca-certificates-java (Ubuntu Bionic): | |
status: | New → Confirmed |
Changed in ca-certificates-java (Ubuntu): | |
status: | Confirmed → Invalid |
Changed in ca-certificates-java (Ubuntu Bionic): | |
status: | Confirmed → In Progress |
tags: |
added: verification-done verification-done-bionic removed: verification-needed verification-needed-bionic |
Status changed to 'Confirmed' because the bug affects multiple users.