Bug 1861360

Summary: authby=rsasig must not imply usage of rsa-pss
Product: Red Hat Enterprise Linux 8 Reporter: Ondrej Moriš <omoris>
Component: libreswanAssignee: Paul Wouters <pwouters>
Status: CLOSED ERRATA QA Contact: Ondrej Moriš <omoris>
Severity: high Docs Contact:
Priority: high    
Version: 8.3CC: ssorce
Target Milestone: rcKeywords: Triaged
Target Release: 8.0Flags: pm-rhel: mirror+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: libreswan-3.32-6.el8 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-11-04 03:18:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ondrej Moriš 2020-07-28 12:01:39 UTC
Description of problem:

A connections using authby=rsa-sha2_512 cannot be established.


Version-Release number of selected component (if applicable):

libreswan-3.29 as well as libreswan-3.32
nss-3.44 as well as nss-3.53

How reproducible:

100%

Steps to Reproduce:

1. Configure connection using authby=rsa-sha2_512
2. Initial connection from the client

Actual results:

# ipsec auto --up test-rsasig
002 "test-rsasig" #1: initiating v2 parent SA
133 "test-rsasig" #1: initiate
002 "test-rsasig": constructed local IKE proposals for test-rsasig (IKE SA initiator selecting KE): 1:IKE:ENCR=AES_GCM_C_256;PRF=HMAC_SHA2_512,HMAC_SHA2_256;INTEG=NONE;DH=MODP2048,MODP3072,MODP4096,MODP8192,ECP_256,ECP_384,ECP_521,CURVE25519 2:IKE:ENCR=AES_GCM_C_128;PRF=HMAC_SHA2_512,HMAC_SHA2_256;INTEG=NONE;DH=MODP2048,MODP3072,MODP4096,MODP8192,ECP_256,ECP_384,ECP_521,CURVE25519 3:IKE:ENCR=AES_CBC_256;PRF=HMAC_SHA2_512,HMAC_SHA2_256;INTEG=HMAC_SHA2_512_256,HMAC_SHA2_256_128;DH=MODP2048,MODP3072,MODP4096,MODP8192,ECP_256,ECP_384,ECP_521,CURVE25519 4:IKE:ENCR=AES_CBC_128;PRF=HMAC_SHA2_512,HMAC_SHA2_256;INTEG=HMAC_SHA2_512_256,HMAC_SHA2_256_128;DH=MODP2048,MODP3072,MODP4096,MODP8192,ECP_256,ECP_384,ECP_521,CURVE25519 (default)
133 "test-rsasig" #1: STATE_PARENT_I1: sent v2I1, expected v2R1
003 "test-rsasig" #1: RSA_sign_hash: sign function failed (-8189)
003 "test-rsasig" #1: DigSig: failed to find our RSA key

Connection does not work.

Expected results:

Connection works.

Additional info:

Connection works when

 * authby=rsa-sha1 is used
 * authby=rsa-sha2_256 is used
 * authby=rsa-sha2_384 is used

Unfortunately on 3.32 for connection with authby=rsasig rsa-sha2_512 is tried first and fails and therefore authby=rsasig on 3.32 does not work anymore. 

I am not sure if this is a bug in libreswan or nss. If it is nss issue and we won't fix it int 8.3 then authby=rsasig should be modified to imply rsa-sha1 again as it was in 3.29.

Comment 1 Ondrej Moriš 2020-07-28 12:13:06 UTC
I forgot to add one very important detail - it is only broken with 1024 bit RSA keys. It works fined with bigger keys.

Comment 2 Ondrej Moriš 2020-07-28 19:41:10 UTC
We realized that 1024 bit RSA keys are actually too small for SHA-512. I am changing bug summary to reflect that. Currently when authby is set to rsasig it implies usage of rsa-sha2_512, rsa-sha2_384, rsa-sha2_256, rsa-sha1. However, for RSA keys of size 1024 bits the first option in that ordering fails (correctly). Previously (in 3.29), rsasig implied rsa-sha1 only for which 1024 bits RSA keys are fine. We have to switch back to this solution to prevent issues for customers using rsasig authby setting with 1024 bit keys. If anyone wants to use SHA2, authby must be set to it explicitly (ie. authby=rsa-sha2).

Comment 9 errata-xmlrpc 2020-11-04 03:18:00 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (libreswan bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2020:4722