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 2176248 - authby=rsasig fails in FIPS policy
Summary: authby=rsasig fails in FIPS policy
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: libreswan
Version: 8.8
Hardware: All
OS: Linux
urgent
unspecified
Target Milestone: rc
: ---
Assignee: Daiki Ueno
QA Contact: Ondrej Moriš
Jan Fiala
URL:
Whiteboard:
Depends On:
Blocks: 2187647
TreeView+ depends on / blocked
 
Reported: 2023-03-07 18:59 UTC by Ondrej Moriš
Modified: 2023-06-20 11:58 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
.Libreswan no longer rejects SHA-1 signature verification in the `FUTURE` and `FIPS` cryptographic policies Previously, from update to 4.9, Libreswan rejected SHA-1 signature verification in the `FUTURE` and `FIPS` cryptographic policies, and peer authentication failed when `authby=rsasig` or `authby=rsa-sha1` connection options were used. This update reverts this behavior by relaxing how Libreswan handles the `crypto-policies` settings. As a consequence, you can now use the `authby=rsasig` and `authby=rsa-sha1` connection options using SHA-1 signature verification.
Clone Of:
: 2187647 (view as bug list)
Environment:
Last Closed: 2023-05-25 07:01:38 UTC
Type: Bug
Target Upstream Version:
Embargoed:
jafiala: needinfo+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker CRYPTO-9876 0 None None None 2023-03-14 12:49:12 UTC
Red Hat Issue Tracker RHELPLAN-150974 0 None None None 2023-03-07 18:59:47 UTC

Description Ondrej Moriš 2023-03-07 18:59:14 UTC
Description of problem:

Libreswan rebase to 4.9 in RHEL-8.8 introduces change (specific only for RHEL-8) that might affect the customers. In RHEL-8.3.0 we introduced bugfix for BZ#1861360. The idea to was keep 1024 bit RSA key working for authby=rsasig. We still the patch for this in RHEL-8.8 [1]. With this patch authby=rsasig is equivalent to authby=rsa-sha1 - PKCS#1 1.5 RSA with SHA1 is used during peer authentication. SHA1 is disabled in RHEL-8, it wasn't a problem until now because until version 4.6 (we had 4.5 in RHEL-8.6.0 and RHEL-8.7.0) libreswan used SHA1 directly through low level NSS API (PK11_SignWithMechanism). But since version 4.7 libreswan uses high level API instead (SGN_Digest) that takes crypto-policy into consideration. And hence SHA1 is rejected (based on the DEFAULT policy). Therefore using authby=rsasig on RHEL-8.8 in DEFAULT policy leads to the following error during peer authentication:

NSS: SGN_Digest(SHA-1) function failed: SEC_ERROR_SIGNATURE_ALGORITHM_DISABLED: Could not create or verify a signature using a signature algorithm that is disabled because it is not secure.

I don't think this is a regression. It only worked before because using SHA1 through the low level API in the previous version bypassed the policy.

I think we should remove this patch and align behavior with upstream and RHEL-9 so that RSA-PSS with SHA2 is used instead of PKCS#1 1.5 RSA with SHA1 for authby=rsasig. If someone needs to keep 1024 bit keys working for some reason it can be done using authby=rsa-sha1. 

[1] https://pkgs.devel.redhat.com/cgit/rpms/libreswan/tree/libreswan-3.32-1861360-nodefault-rsa-pss.patch?h=rhel-8.8.0

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

libreswan-4.9-1.el8

How reproducible:

100%

Steps to Reproduce:

1. Use authby=rsasig peer authencation with RSA keys 

Actual results:

# ipsec auto --up test
181 "test" #1: initiating IKEv2 connection
181 "test" #1: sent IKE_SA_INIT request to 10.16.56.104:500
003 "test" #1: NSS: SGN_Digest(SHA-1) function failed: SEC_ERROR_SIGNATURE_ALGORITHM_DISABLED: Could not create or verify a signature using a signature algorithm that is disabled because it is not secure.
182 "test" #1: sent IKE_AUTH request {cipher=AES_CBC_128 integ=HMAC_SHA2_256_128 prf=HMAC_SHA2_256 group=MODP2048}
003 "test" #1: IKE SA authentication request rejected by peer: AUTHENTICATION_FAILED
036 "test" #1: encountered fatal error in state STATE_V2_PARENT_I2
002 "test" #1: deleting state (STATE_V2_PARENT_I2) aged 0.045762s and NOT sending notification
002 "test" #1: deleting IKE SA but connection is supposed to remain up; schedule EVENT_REVIVE_CONNS

Expected results:

# ipsec auto --up test
181 "test" #1: initiating IKEv2 connection
181 "test" #1: sent IKE_SA_INIT request to 10.0.139.82:500
182 "test" #1: sent IKE_AUTH request {cipher=AES_CBC_128 integ=HMAC_SHA2_512_256 prf=HMAC_SHA2_512 group=MODP2048}
003 "test" #1: initiator established IKE SA; authenticated peer '2048-bit RSASSA-PSS with SHA2_512' digital signature using peer certificate '10.0.139.82' issued by CA 'C=US, ST=NC, O=Foo, CN=CA'
004 "test" #2: initiator established Child SA using #1; IPsec transport [10.0.136.88-10.0.136.88:0-65535 0] -> [10.0.139.82-10.0.139.82:0-65535 0] {ESP/ESN=>0x43eef360 <0x866d012c xfrm=AES_GCM_16_256-NONE DPD=passive}

Additional info:

 * This issues only relevant for RHEL-8, in RHEL-9 we don't have this patch

 * Not fixing this problem will most likely break all configurations using 
   authby=rsasig (in DEFAULT policy)

 * Workaround is simple: 
   - either allow SHA1 using crypto-policy subpolicy
   - or use authby=rsa-sha2 to enforce use of SHA2 instead of SHA1

Comment 1 Ondrej Moriš 2023-03-08 07:14:59 UTC
Correction - the problem is only in FIPS policy and not DEFAULT. In RHEL-8 we allow SHA1 in the DEFAULT policy, we don't allow it in FIPS and FUTURE.

Comment 2 Ondrej Moriš 2023-03-08 07:19:31 UTC
Also, please notice that on RHEL-8 we only allow RSA keys of 1024 bit size in LEGACY and hence I think it is one more reason to drop the patch mentioned in the description that was specifically intended to keep 1024 bit RSA keys working for authby=rsasig.

Comment 3 Ondrej Moriš 2023-03-10 16:16:22 UTC
DocText proposal:

Cause: 

Rebase of Libreswan to version 4.9 in RHEL-8 (2128672) uses high-level NSS API during peer authentication. It takes into consideration the system-wide cryptographic policy. 

Consequence: 

As a result, SHA1 is rejected in the FUTURE and FIPS cryptographic policies and peer authentication fails when `authby=rsasig` or `authby=rsa-sha1` connection options are used. 

Workaround (if any): 

To work around this problem, use the `authby=rsa-sha2` option to use SHA2 instead of SHA1. Or customize your cryptographic policy to allow SHA1 if you rely on 1024 bit RSA keys.

Result:


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