RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1882168 - java-11-openjdk / rhel-8: system crypto policy fails to increase DH key size
Summary: java-11-openjdk / rhel-8: system crypto policy fails to increase DH key size
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: java-11-openjdk
Version: 8.3
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: 8.0
Assignee: Andrew John Hughes
QA Contact: OpenJDK QA
URL:
Whiteboard:
Depends On: 1882178 1883312
Blocks: 1882185
TreeView+ depends on / blocked
 
Reported: 2020-09-24 00:49 UTC by zzambers
Modified: 2022-03-24 07:27 UTC (History)
0 users

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1882185 (view as bug list)
Environment:
Last Closed: 2022-03-24 07:27:24 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description zzambers 2020-09-24 00:49:01 UTC
Problem:
System crypto policy fails to increase DH key size [1], based on crypto policy requirements [2].

Seems like crypto-policies are actually trying to increase DH key size using jdk.tls.ephemeralDHKeySize property:
cat /etc/crypto-policies/back-ends/java.config | grep DHKeySize
jdk.tls.ephemeralDHKeySize=2048

However this property is not applied since this property ends up in Security properties [3], but it needs to be in System properties [4] to be applied.

Issue was discovered wile running ssl-tests [5] in FIPS mode, where crypto policy fails to set bigger key size, but constrains on key size as enforced by nss (used by pkcs11 provider) are causing this exception:

Caused by: java.security.ProviderException: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_ARGUMENTS_BAD
    at sun.security.pkcs11.P11KeyPairGenerator.generateKeyPair(P11KeyPairGenerator.java:424)
    at java.security.KeyPairGenerator$Delegate.generateKeyPair(KeyPairGenerator.java:697)
    at sun.security.ssl.DHKeyExchange$DHEPossession.generateDHKeyPair(DHKeyExchange.java:181)
    at sun.security.ssl.DHKeyExchange$DHEPossession.<init>(DHKeyExchange.java:139)
    at sun.security.ssl.DHKeyExchange$DHEPossessionGenerator.createPossession(DHKeyExchange.java:389
...
FAILED: SunJSSE/Default: TLSv1.2 + TLS_DHE_RSA_WITH_AES_256_CBC_SHA256

(This one was thrown on servers side, I am not sure if exception can also be thrown on client side.)


Workaround:
Set this property manually using command line argument, eg.:
java -Djdk.tls.ephemeralDHKeySize=2048 ...


[1] https://hg.openjdk.java.net/jdk-updates/jdk11u/file/e16ef8c081c6/src/java.base/share/classes/sun/security/ssl/DHKeyExchange.java#l318
[2] https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/security_hardening/using-the-system-wide-cryptographic-policies_security-hardening
[3] https://docs.oracle.com/javase/8/docs/api/java/security/Security.html
[4] https://docs.oracle.com/javase/8/docs/api/java/lang/System.html
[5] https://github.com/zzambers/ssl-tests

Comment 1 zzambers 2020-09-24 01:01:15 UTC
But it seems there is also bug in LEGACY crypto policy (invalid key size of 1023):

cat /usr/share/crypto-policies/LEGACY/java.txt | grep DHKeySize
jdk.tls.ephemeralDHKeySize=1023

which would cause this exception, if it was actually used:

Exception in thread "Thread-0" java.lang.ExceptionInInitializerError
	at sun.security.ssl.DHKeyExchange.<clinit>(DHKeyExchange.java:57)
	at sun.security.ssl.SSLKeyExchange$T12KeyAgreement.<clinit>(SSLKeyExchange.java:348)
	at sun.security.ssl.SSLKeyExchange$1.<clinit>(SSLKeyExchange.java:411)
	at sun.security.ssl.SSLKeyExchange.valueOf(SSLKeyExchange.java:203)
	at sun.security.ssl.ServerHello$T12ServerHelloProducer.chooseCipherSuite(ServerHello.java:421)
	at sun.security.ssl.ServerHello$T12ServerHelloProducer.produce(ServerHello.java:295)
	at sun.security.ssl.SSLHandshake.produce(SSLHandshake.java:421)
	at sun.security.ssl.ClientHello$T12ClientHelloConsumer.consume(ClientHello.java:1020)
	at sun.security.ssl.ClientHello$ClientHelloConsumer.onClientHello(ClientHello.java:727)
	at sun.security.ssl.ClientHello$ClientHelloConsumer.consume(ClientHello.java:693)
	at sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:377)
	at sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:444)
	at sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:422)
	at sun.security.ssl.TransportContext.dispatch(TransportContext.java:182)
	at sun.security.ssl.SSLTransport.decode(SSLTransport.java:149)
	at sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1143)
	at sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1054)
	at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:394)
	at sun.security.ssl.SSLSocketImpl.ensureNegotiated(SSLSocketImpl.java:708)
	at sun.security.ssl.SSLSocketImpl.access$100(SSLSocketImpl.java:72)
	at sun.security.ssl.SSLSocketImpl$AppInputStream.read(SSLSocketImpl.java:791)
	at sun.security.ssl.SSLSocketImpl$AppInputStream.read(SSLSocketImpl.java:750)
	at SSLSocketServer.serverLoop(SSLSocketServer.java:132)
	at SSLSocketServer$1.run(SSLSocketServer.java:74)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalArgumentException: Unsupported customized DH key size: 1023. The key size must be multiple of 64, and range from 1024 to 8192 (inclusive)
	at sun.security.ssl.DHKeyExchange$DHEPossessionGenerator.<clinit>(DHKeyExchange.java:280)
	... 25 more

[1] https://hg.openjdk.java.net/jdk-updates/jdk11u/file/e16ef8c081c6/src/java.base/share/classes/sun/security/ssl/DHKeyExchange.java#l280

Comment 2 Andrew John Hughes 2020-09-28 17:48:23 UTC
This would need a companion bug against crypto-policies, so they can:

a) supply us with a separate file containing system properties
b) correct the issue with the legacy value

Only when those are in place can we make adjustments in OpenJDK.

Comment 3 Andrew John Hughes 2020-09-28 18:11:19 UTC
Filed bug 1883312 for the crypto-policies correction.

Comment 7 RHEL Program Management 2022-03-24 07:27:24 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.


Note You need to log in before you can comment on or make changes to this bug.