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 1020395 - Allow Level 1 FIPS mode if the nss db has no password
Summary: Allow Level 1 FIPS mode if the nss db has no password
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: nss-softokn
Version: 7.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Elio Maldonado Batiz
QA Contact: Ondrej Moriš
URL:
Whiteboard:
Depends On:
Blocks: 852023
TreeView+ depends on / blocked
 
Reported: 2013-10-17 15:10 UTC by Elio Maldonado Batiz
Modified: 2014-06-18 05:26 UTC (History)
5 users (show)

Fixed In Version: nss-softokn-3.15.2-2.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-06-16 08:23:39 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Allows level 1 operations if primnary nssdb has no password (1.24 KB, patch)
2013-10-17 15:10 UTC, Elio Maldonado Batiz
no flags Details | Diff

Description Elio Maldonado Batiz 2013-10-17 15:10:15 UTC
Created attachment 813388 [details]
Allows level 1 operations if primnary nssdb has no password

Description of problem: nss-softokn needs to allow level 1 operations if the primary database doesn't have a password.  

Version-Release number of selected component (if applicable): nss-softoken-3.15.1-3


How reproducible: 

Steps to Reproduce: 

See Bug 852023 for details.

Actual results:

Expected results:

Additional info:

Comment 3 Kamil Dudka 2013-10-25 12:46:15 UTC
See attachment #662399 [details] for a testing script

... and the following comments for its expected output:

    bug #852023 comment #83

    bug #852023 comment #84

Comment 6 Ondrej Moriš 2014-04-02 10:55:34 UTC
Unfortunately I really cannot reproduce the issue -

* Should it fail with empty password?

* What is meant by 'no password'? 
  Empty password (ie. typing enter twice during nss db creation? 
  Empty password file?

I am using the following packages:

nss-softokn-3.15.1-3.el7.x86_64
nss-softokn-devel-3.15.1-3.el7.x86_64
nss-util-3.15.1-2.el7.x86_64
nss-softokn-freebl-3.15.1-3.el7.x86_64
nss-util-devel-3.15.1-2.el7.x86_64
nss-pam-ldapd-0.8.13-8.el7.x86_64
nss-sysinit-3.15.1-3.el7.x86_64
nss-softokn-freebl-devel-3.15.1-3.el7.x86_64
nss-devel-3.15.1-3.el7.x86_64
nss-tools-3.15.1-3.el7.x86_64
nss-3.15.1-3.el7.x86_64
nss-pkcs11-devel-3.15.1-3.el7.x86_64

From what I understand the following steps should fail in the end (in fips mode):

# mkdir /tmp/tnssdb
# touch /tmp/foo
# certutil -N -d /tmp/tnssdb -f /tmp/foo
password file contains no data
# ls /tmp/tnssdb/
cert8.db  key3.db  secmod.db
# certutil -L -d /tmp/tnssdb

Certificate Nickname                                         Trust Attributes
                                                             SSL,S/MIME,JAR/XPI
# modutil -dbdir /tmp/tnssdb/ -fips true

WARNING: Performing this operation while the browser is running could cause
corruption of your security databases. If the browser is currently running,
you should exit browser before continuing this operation. Type 
'q <enter>' to abort, or <enter> to continue: 

FIPS mode enabled.
# certutil -S -k rsa -n mycaaa -m "0" -s "CN=mycaaa" -t "C,C,C" -v 13 -x -d /tmp/tnssdb/
Enter Password or Pin for "NSS FIPS 140-2 Certificate DB":

A random seed must be generated that will be used in the
creation of your key.  One of the easiest ways to create a
random seed is to use the timing of keystrokes on a keyboard.

To begin, type keys on the keyboard until this progress meter
is full.  DO NOT USE THE AUTOREPEAT FUNCTION ON YOUR KEYBOARD!


Continue typing until the progress meter is full:

|************************************************************|

Finished.  Press enter to continue: 


Generating key.  This may take a few moments...

# echo $?
0

Comment 7 Elio Maldonado Batiz 2014-04-02 17:05:59 UTC
Ondrej, Could it be because you are using nss-softokn-3.15.1-3.el7.x86_64 but this is marked as Fixed in Version: nss-softokn-3.15.2-2.el7?

Comment 8 Ondrej Moriš 2014-04-07 09:01:31 UTC
No, I am using the old version intentionally to reproduce the problem. With the fixed version of nss-softokn (nss-softokn-3.15.2-2.el7 or higher) it should be possible to operate on L1 FIPS mode with and empty password (is that equal to have "no password"?). It works but...

It also works with older versions of nss-softokn (nss-softokn-3.15.1-3.el7), even with this old version I can easily switch nss db into FIPS mode, generate keypairs and so on with an empty nss db password. 

Therefore I am not sure what was not working actually? Elio, do you have any scenario which was failing before this issue was fixed? May be "empty password" != "no password" or I am using wrong nss db operation to test the issue...?

Comment 9 Karel Srot 2014-05-14 06:11:56 UTC
Elio, could you please reply on #c8?

Comment 10 Elio Maldonado Batiz 2014-05-14 16:15:35 UTC
(In reply to Ondrej Moriš from comment #8)
> should be possible to operate on L1 FIPS mode with and empty password (is
> that equal to have "no password"?). It works but...

No password should be equivalent to empty password according to what I have seen tn the code where NULL strings get tranformed into empty strings.

> 
> It also works with older versions of nss-softokn (nss-softokn-3.15.1-3.el7),
> even with this old version I can easily switch nss db into FIPS mode,
> generate keypairs and so on with an empty nss db password. 
> 
> Therefore I am not sure what was not working actually? Elio, do you have any
> scenario which was failing before this issue was fixed? May be "empty
> password" != "no password" or I am using wrong nss db operation to test the
> issue...?
The only thing is what was provides in Bug 852023. 

One problem I have is that in my rhel-7.0 VM I can no longer downgrade nss-softoken to old nss-softokn-3.15.1-3.el7 version to try and reproduce it.

Comment 11 Elio Maldonado Batiz 2014-05-15 16:10:04 UTC
I was able to reproduce it using the simple reproducer from Bug 852023. 
I had to use a VM based on rhel-7 Alpha3 so the nss-softoke version was old enough. To set the sytem in fips mode I follow the steps from https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security_Guide/sect-Security_Guide-Federal_Standards_And_Regulations-Federal_Information_Processing_Standard.html and modify them for rhel 7.
Installing dracut-fips was tricky so I had use an internal rhel-7 nightly repo as this is a pre-beta system.

[root@fipstest emaldona]# cd /home/emaldona/fipsmode/
[root@fipstest fipsmode]# ls
fipsmode  fipsmode.c  Makefile

[root@fipstest fipsmode]# rpm -q nss nss-softokn nss-util
nss-3.14.1-3.el7.x86_64
nss-softokn-3.14-5.el7.x86_64
nss-util-3.14.1-2.el7.x86_64

Method 1:
[root@fipstest fipsmode]# cat /proc/sys/crypto/fips_enabled 
1

Method2:
[root@fipstest fipsmode]# ./fipsmode 
FIPS mode is disabled.

Contradicts the previous answer.

Comment 12 Elio Maldonado Batiz 2014-05-15 17:19:08 UTC
Sorry, I should have run the steps on Comment 6.

Comment 13 Bob Relyea 2014-05-15 18:33:21 UTC
So there is always a password on the database. Sometimes that password is the NULL string "". Here's the chart on how softoken treats the NULL string.

------------------
old softoken, non-fips mode: Softoken reports no password is it has a NULL string "".
old softoken, fips mode: Softoken reports the need for a password. You must explicitly login in using "" as a password.
------------------
new softoken, non-fips mode: Softoken reports no password is it has a NULL string "".
new softoken, fips mode: Softoken reports no password is it has a NULL string "".
------------------


Old apps using new softoken will either 1) start working when they didn't before, or 2) no change.

Comment 14 Ondrej Moriš 2014-05-16 14:28:02 UTC
Thank you both. 

OK, I can confirm that NSS DB with empty password (ie. NULL string) with:

A: new nss-softokn in non-fips system[1] with non-fips db[2] does not require login
B: new nss-softokn in non-fips system    with     fips db    does not require login

but

C: new nss-softokn in     fips system    with     fips db    does     require login

[1] fips-system <=> booted with fips=0 kernel parameter and other steps from [*].
[2] fips db <=> modutil -fips true <DB>
[*] https://access.redhat.com/site/solutions/137833

Details of C follows:

# rm /tmp/tnssdb/ -rf
# mkdir /tmp/tnssdb
# certutil -N -d /tmp/tnssdb -f /tmp/foo 
password file contains no data
# modutil -list -dbdir /tmp/tnssdb/

Listing of PKCS #11 Modules
-----------------------------------------------------------
  1. NSS Internal PKCS #11 Module
	 slots: 1 slot attached
	status: loaded

	 slot: NSS FIPS 140-2 User Private Key Services
	token: NSS FIPS 140-2 Certificate DB
-----------------------------------------------------------
# modutil -list "NSS Internal PKCS #11 Module" -dbdir /tmp/tnssdb/

-----------------------------------------------------------
Name: NSS Internal PKCS #11 Module
Library file: **Internal ONLY module**
Manufacturer: Mozilla Foundation              
Description: NSS Internal Crypto Services    
PKCS #11 Version 2.20
Library Version: 3.15
Cipher Enable Flags: None
Default Mechanism Flags: None

  Slot: NSS FIPS 140-2 User Private Key Services
  Slot Mechanism Flags: None
  Manufacturer: Mozilla Foundation              
  Type: Software
  Version Number: 3.15
  Firmware Version: 0.0
  Status: Enabled
  Token Name: NSS FIPS 140-2 Certificate DB   
  Token Manufacturer: Mozilla Foundation              
  Token Model: NSS 3           
  Token Serial Number: 0000000000000000
  Token Version: 0.0
  Token Firmware Version: 0.0
  Access: NOT Write Protected
  Login Type: Login required
  User Pin: NOT Initialized

-----------------------------------------------------------
# modutil -fips true -dbdir /tmp/tnssdb/

WARNING: Performing this operation while the browser is running could cause
corruption of your security databases. If the browser is currently running,
you should exit browser before continuing this operation. Type 
'q <enter>' to abort, or <enter> to continue: 

FIPS mode already enabled.

(^^^ just to make sure that DB is in fips mode)

nss-3.15.4-2.el7.x86_64
nss-util-3.15.4-2.el7.x86_64
nss-softokn-freebl-3.15.4-2.el7.x86_64
nss-sysinit-3.15.4-2.el7.x86_64
nss-tools-3.15.4-2.el7.x86_64
nss-softokn-3.15.4-2.el7.x86_64

In other words, if a system is not in FIPS mode (ie. no fips=1 kernel paramater in particular), it works as expected but in FIPS mode, it still requires login even with an empty password which is not correct as far as I can understand.

What do you think?

Comment 16 Bob Relyea 2014-05-27 21:02:38 UTC
> OK, I can confirm that NSS DB with empty password (ie. NULL string) with:

> A: new nss-softokn in non-fips system[1] with non-fips db[2] does not require login
> B: new nss-softokn in non-fips system    with     fips db    does not require login

but

> C: new nss-softokn in     fips system    with     fips db    does     require login

That is very weird, but there shouldn't be any difference between a new nss-softokn in FIPS mode because the db is in fips mode and a new nss-softokn in FIPS mode because the system is in FIPS mode. What happens if the new nss-softoken is in fips system and the database is non-fips? That's the main case we care about in RHEL-7.0.

bob

Comment 17 Ondrej Moriš 2014-06-02 12:25:30 UTC
(In reply to Bob Relyea from comment #16)
> ...What happens if
> the new nss-softoken is in fips system and the database is non-fips? That's
> the main case we care about in RHEL-7.0.

Hi Bob, that combination is not possible AFAIK, once one has "fips-system" (booted with fips=1 boot=... kernel parameters), db is always is true-fips, isn't it?

# cat /proc/sys/crypto/fips_enabled
1
# rm /tmp/tnssdb/ -rf
# mkdir /tmp/tnssdb
# touch /tmp/foo
# certutil -N -d /tmp/tnssdb -f /tmp/foo 
password file contains no data
# modutil -list -dbdir /tmp/tnssdb/

Listing of PKCS #11 Modules
-----------------------------------------------------------
  1. NSS Internal PKCS #11 Module
	 slots: 1 slot attached
	status: loaded

	 slot: NSS FIPS 140-2 User Private Key Services
	token: NSS FIPS 140-2 Certificate DB
-----------------------------------------------------------
#  modutil -list "NSS Internal PKCS #11 Module" -dbdir /tmp/tnssdb/

-----------------------------------------------------------
Name: NSS Internal PKCS #11 Module
Library file: **Internal ONLY module**
Manufacturer: Mozilla Foundation              
Description: NSS Internal Crypto Services    
PKCS #11 Version 2.20
Library Version: 3.15
Cipher Enable Flags: None
Default Mechanism Flags: None

  Slot: NSS FIPS 140-2 User Private Key Services
  Slot Mechanism Flags: None
  Manufacturer: Mozilla Foundation              
  Type: Software
  Version Number: 3.15
  Firmware Version: 0.0
  Status: Enabled
  Token Name: NSS FIPS 140-2 Certificate DB   
  Token Manufacturer: Mozilla Foundation              
  Token Model: NSS 3           
  Token Serial Number: 0000000000000000
  Token Version: 0.0
  Token Firmware Version: 0.0
  Access: NOT Write Protected
  Login Type: Login required
  User Pin: NOT Initialized

-----------------------------------------------------------
# modutil -fips false -dbdir /tmp/tnssdb/

WARNING: Performing this operation while the browser is running could cause
corruption of your security databases. If the browser is currently running,
you should exit browser before continuing this operation. Type 
'q <enter>' to abort, or <enter> to continue: 

PKCS #11 module could not be removed because it is still in use.
ERROR: Unable to switch FIPS modes.

# rpm -qa | grep "^nss"
nss-softokn-freebl-3.15.4-2.el7.x86_64
nss-tools-3.15.4-6.el7.x86_64
nss-3.15.4-6.el7.x86_64
nss-util-3.15.4-2.el7.x86_64
nss-softokn-3.15.4-2.el7.x86_64
nss-sysinit-3.15.4-6.el7.x86_64

In other words, in "fips-system", db is "true-fips" and that state cannot be changed - which is perfectly fine from my point of view. But unfortunately login is required (see above).

Comment 18 Bob Relyea 2014-06-09 21:30:14 UTC
The database has fips and non-fips fips mode. The Tools will always see fips mode when the system is in fips mode.

I've very confused on why this happens because there should be no difference (there isn't any different code path).

Anyway it looks like you've identified an issue. Elio is setting up a test machine now for me to dig into it.

bob

Comment 19 Bob Relyea 2014-06-09 21:47:05 UTC
OK, this is RHEL-6 not RHEL-5. The patch appears to have been added simply to deal with running local tests inside nss and not in any code that actually ships.
Upstream has updated softoken so it's not necessary to explicitly turn it off (though we should get back to wtc and suggest that we still want to be able to do it). 

Turning off AES_HW is fine because it's just the NSS tests, not the softoken tests (which run separately).

The confusion seems to come because we still have a full softoken in the tree even though we don't ship with it.

bob

Comment 20 Elio Maldonado Batiz 2014-06-09 22:09:01 UTC
Bob, I suspect you intended this comment to be added to Bug 1099619.

Comment 21 Bob Relyea 2014-06-09 22:31:30 UTC
yes...

Comment 22 Ludek Smid 2014-06-16 08:23:39 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.


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