6.7. Protecting the IPsec NSS database with a password
By default, only the root user can access the IPsec Network Security Services (NSS) database in the /var/lib/ipsec/nss/ directory. You can additionally protect the database with a password. This is required if you run RHEL in Federal Information Processing Standard (FIPS) mode.
Prerequisites
-
The
/var/lib/ipsec/nss/directory contains the NSS database.
Procedure
Enable password protection for the Libreswan NSS database:
# certutil -W -d /var/lib/ipsec/nss/Enter the current password:
Enter Password or Pin for "NSS Certificate DB": <password>If the database is currently not protected by a password, press Enter.
Enter the new password:
Enter new password: <new_password> Re-enter password: <new_password>To unlock the database, the
ipsecservice requires the/etc/ipsec.d/nsspasswordfile. Create the file with the following content:If the host does not run in FIPS mode:
NSS Certificate DB:<password>If the host runs in FIPS mode:
NSS FIPS 140-2 Certificate DB:<password>
Set secure permissions on the
/etc/ipsec.d/nsspasswordfile:# chmod 600 /etc/ipsec.d/nsspassword # chown root:root /etc/ipsec.d/nsspasswordRestart the
ipsecservice:# systemctl restart ipsec
Verification
Verify that the
ipsecservice is running:# systemctl is-active ipsecIf the command returns
active, the service successfully uses the password file to unlock the NSS database.Perform an action on the NSS database that requires the password. For example, display the private keys:
# certutil -K -d /var/lib/ipsec/nss/ certutil: Checking token "NSS Certificate DB" in slot "NSS User Private Key and Certificate Services" Enter Password or Pin for "NSS Certificate DB":Verify that the command prompts for the password.