Bug 1428746

Summary: NSS should provide a tool to check the validity of a crypto policy configuration file
Product: [Fedora] Fedora Reporter: Nikos Mavrogiannopoulos <nmavrogi>
Component: nssAssignee: Kai Engert (:kaie) (inactive account) <kengert>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 27CC: dueno, kdudka, kengert
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1527033 (view as bug list) Environment:
Last Closed: 2018-10-05 11:14:39 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:
Bug Depends On:    
Bug Blocks: 1179209, 1527033, 1605247    
Attachments:
Description Flags
enhances listsuites to check crypto-policies config file for correctness
emaldona: review-
Changes to nss.spec - in patch format
none
enhances listsuites to check crypto-policies confile file for correctnes
none
Changes to nss.spec - in patch format
none
listsuites output before the patch is applied
none
listsuites output after the patch was applied none

Description Nikos Mavrogiannopoulos 2017-03-03 09:53:30 UTC
Description of problem:
For the purposes of Fedora crypto-policies we generate configuration files for multiple applications/libraries. For the NSS policy however the generated configuration file cannot be tested for correctness, other than by manually inspecting the file. That means that a CI testing infrastructure will not detect any bugs introduced to this generation.

Please provide some way to verify whether a generated configuration is valid, i.e., no typos are present, and the configuration provides at least one valid encryption option.

Comment 3 Elio Maldonado Batiz 2017-03-04 00:26:51 UTC
Created attachment 1259812 [details]
enhances listsuites to check crypto-policies config file for correctness

CAVEAT: this latest version is untested.

Comment 4 Elio Maldonado Batiz 2017-03-04 00:28:36 UTC
Created attachment 1259813 [details]
Changes to nss.spec - in patch format

Comment 5 Elio Maldonado Batiz 2017-03-17 16:31:29 UTC
Comment on attachment 1259812 [details]
enhances listsuites to check crypto-policies config file for correctness

Remove this
+    if (info.cipherSuite == TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA)
+        fprintf (stdout, "foo\n");
How did it get there, I don't know. Also the formatting of extra info leaves a bit to be desired.

Comment 6 Elio Maldonado Batiz 2017-03-17 16:41:33 UTC
Created attachment 1264214 [details]
enhances listsuites to check crypto-policies confile file for correctnes

Checking for policy file for correctness is a bit of an overstatement. It does print extra policy information when available and it's probably a good first step towards the goal.

Comment 7 Elio Maldonado Batiz 2017-03-17 16:42:44 UTC
Created attachment 1264216 [details]
Changes to nss.spec - in patch format

Comment 8 Elio Maldonado Batiz 2017-03-17 16:44:15 UTC
Created attachment 1264217 [details]
listsuites output before the patch is applied

Comment 9 Elio Maldonado Batiz 2017-03-17 16:45:36 UTC
Created attachment 1264218 [details]
listsuites output after the patch was applied

Comment 10 Jan Kurik 2017-08-15 08:09:56 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 27 development cycle.
Changing version to '27'.

Comment 11 Daiki Ueno 2017-10-09 15:25:33 UTC
I took the liberty of filing an upstream bug for this with a subset of the patch provided by Elio.

Comment 12 Kai Engert (:kaie) (inactive account) 2018-01-12 14:17:19 UTC
We discussed this request by email, and the request was clarified, which I'll attempt to summarize below. Nikos, please speak up if the summary is incorrect.

We should implement a tool that checks that:
- the policy file has a correct syntax
- that at least one version or mechanism of each configured category
  is enabled

Checking for inconsistencies between configuration categories is outside the scope of this tool.

Comment 13 Kai Engert (:kaie) (inactive account) 2018-07-11 14:11:40 UTC
I've provided an initial patch upstream:
  https://bugzilla.mozilla.org/show_bug.cgi?id=1474887

This isn't a clear black/white request. IMHO the implementation I'm suggesting accomplishes the request, however, I suggest that you review it. Not a code review, but rather, a review of the approach that is used, of the coverage that is provided, and of the way failures are reported and treated.

The code review should be done later, after we've agreed that the implementation sufficiently implements the requested check.

Comment 14 Kai Engert (:kaie) (inactive account) 2018-07-17 10:33:39 UTC
The new nss-policy-check tool has been checked in upstream and will be available with NSS 3.39, which is expected around mid July.

Comment 15 Nikos Mavrogiannopoulos 2018-10-05 11:14:39 UTC
This is already in fedora. Thank you!