gecko-dev/security/nss/doc/modutil.xml

762 строки
39 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
<!ENTITY date SYSTEM "date.xml">
<!ENTITY version SYSTEM "version.xml">
]>
<refentry id="modutil">
<refentryinfo>
<date>&date;</date>
<title>NSS Security Tools</title>
<productname>nss-tools</productname>
<productnumber>&version;</productnumber>
</refentryinfo>
<refmeta>
<refentrytitle>MODUTIL</refentrytitle>
<manvolnum>1</manvolnum>
</refmeta>
<refnamediv>
<refname>modutil</refname>
<refpurpose>Manage PKCS #11 module information within the security module database.</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>modutil</command>
<arg><replaceable>options</replaceable></arg>
<arg>[<replaceable>arguments</replaceable>]</arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsection>
<title>STATUS</title>
<para>This documentation is still work in progress. Please contribute to the initial review in <ulink url="https://bugzilla.mozilla.org/show_bug.cgi?id=836477">Mozilla NSS bug 836477</ulink>
</para>
</refsection>
<refsection id="description">
<title>Description</title>
<para>The Security Module Database Tool, <command>modutil</command>, is a command-line utility for managing PKCS #11 module information both within <filename>secmod.db</filename> files and within hardware tokens. <command>modutil</command> can add and delete PKCS #11 modules, change passwords on security databases, set defaults, list module contents, enable or disable slots, enable or disable FIPS 140-2 compliance, and assign default providers for cryptographic operations. This tool can also create certificate, key, and module security database files.</para>
<para>The tasks associated with security module database management are part of a process that typically also involves managing key databases and certificate databases.</para>
</refsection>
<refsection id="options">
<title>Options</title>
<para>
Running <command>modutil</command> always requires one (and only one) option to specify the type of module operation. Each option may take arguments, anywhere from none to multiple arguments.
</para>
<para><command>Options</command></para>
<variablelist>
<varlistentry>
<term>-add modulename</term>
<listitem><para>Add the named PKCS #11 module to the database. Use this option with the <option>-libfile</option>, <option>-ciphers</option>, and <option>-mechanisms</option> arguments.</para></listitem>
</varlistentry>
<varlistentry>
<term>-changepw tokenname</term>
<listitem><para>Change the password on the named token. If the token has not been initialized, this option initializes the password. Use this option with the <option>-pwfile</option> and <option>-newpwfile</option> arguments. A <emphasis>password</emphasis> is equivalent to a personal identification number (PIN).</para></listitem>
</varlistentry>
<varlistentry>
<term>-chkfips</term>
<listitem><para>Verify whether the module is in the given FIPS mode. <command>true</command> means to verify that the module is in FIPS mode, while <command>false</command> means to verify that the module is not in FIPS mode.</para></listitem>
</varlistentry>
<varlistentry>
<term>-create</term>
<listitem><para>Create new certificate, key, and module databases. Use the <option>-dbdir</option> directory argument to specify a directory. If any of these databases already exist in a specified directory, <command>modutil</command> returns an error message.</para></listitem>
</varlistentry>
<varlistentry>
<term>-default modulename</term>
<listitem><para>Specify the security mechanisms for which the named module will be a default provider. The security mechanisms are specified with the <option>-mechanisms</option> argument.</para></listitem>
</varlistentry>
<varlistentry>
<term>-delete modulename</term>
<listitem><para>Delete the named module. The default NSS PKCS #11 module cannot be deleted.</para></listitem>
</varlistentry>
<varlistentry>
<term>-disable modulename</term>
<listitem><para>Disable all slots on the named module. Use the <option>-slot</option> argument to disable a specific slot.</para><para>The internal NSS PKCS #11 module cannot be disabled.</para></listitem>
</varlistentry>
<varlistentry>
<term>-enable modulename</term>
<listitem><para>Enable all slots on the named module. Use the <option>-slot</option> argument to enable a specific slot.</para></listitem>
</varlistentry>
<varlistentry>
<term>-fips [true | false]</term>
<listitem><para>Enable (true) or disable (false) FIPS 140-2 compliance for the default NSS module.</para></listitem>
</varlistentry>
<varlistentry>
<term>-force</term>
<listitem><para>Disable <command>modutil</command>'s interactive prompts so it can be run from a script. Use this option only after manually testing each planned operation to check for warnings and to ensure that bypassing the prompts will cause no security lapses or loss of database integrity.</para></listitem>
</varlistentry>
<varlistentry>
<term>-jar JAR-file</term>
<listitem><para>Add a new PKCS #11 module to the database using the named JAR file. Use this command with the <option>-installdir</option> and <option>-tempdir</option> arguments. The JAR file uses the NSS PKCS #11 JAR format to identify all the files to be installed, the module's name, the mechanism flags, and the cipher flags, as well as any files to be installed on the target machine, including the PKCS #11 module library file and other files such as documentation. This is covered in the JAR installation file section in the man page, which details the special script needed to perform an installation through a server or with <command>modutil</command>. </para></listitem>
</varlistentry>
<varlistentry>
<term>-list [modulename]</term>
<listitem><para>Display basic information about the contents of the <filename>secmod.db</filename> file. Specifying a <emphasis>modulename</emphasis> displays detailed information about a particular module and its slots and tokens.</para></listitem>
</varlistentry>
<varlistentry>
<term>-rawadd</term>
<listitem><para>Add the module spec string to the <filename>secmod.db</filename> database.</para></listitem>
</varlistentry>
<varlistentry>
<term>-rawlist</term>
<listitem><para>Display the module specs for a specified module or for all loadable modules.</para></listitem>
</varlistentry>
<varlistentry>
<term>-undefault modulename</term>
<listitem><para>Specify the security mechanisms for which the named module will not be a default provider. The security mechanisms are specified with the <option>-mechanisms</option> argument.</para></listitem>
</varlistentry>
</variablelist>
<para><command>Arguments</command></para>
<variablelist>
<varlistentry>
<term>MODULE</term>
<listitem><para>Give the security module to access.</para></listitem>
</varlistentry>
<varlistentry>
<term>MODULESPEC</term>
<listitem><para>Give the security module spec to load into the security database.</para></listitem>
</varlistentry>
<varlistentry>
<term>-ciphers cipher-enable-list</term>
<listitem><para>Enable specific ciphers in a module that is being added to the database. The <emphasis>cipher-enable-list</emphasis> is a colon-delimited list of cipher names. Enclose this list in quotation marks if it contains spaces.</para></listitem>
</varlistentry>
<varlistentry>
<term>-dbdir [sql:]directory</term>
<listitem><para>Specify the database directory in which to access or create security module database files.</para>
<para><command>modutil</command> supports two types of databases: the legacy security databases (<filename>cert8.db</filename>, <filename>key3.db</filename>, and <filename>secmod.db</filename>) and new SQLite databases (<filename>cert9.db</filename>, <filename>key4.db</filename>, and <filename>pkcs11.txt</filename>). If the prefix <command>sql:</command> is not used, then the tool assumes that the given databases are in the old format.</para></listitem>
</varlistentry>
<varlistentry>
<term>--dbprefix prefix</term>
<listitem><para>Specify the prefix used on the database files, such as <filename>my_</filename> for <filename>my_cert8.db</filename>. This option is provided as a special case. Changing the names of the certificate and key databases is not recommended.</para></listitem>
</varlistentry>
<varlistentry>
<term>-installdir root-installation-directory</term>
<listitem><para>Specify the root installation directory relative to which files will be installed by the <option>-jar</option> option. This directory should be one below which it is appropriate to store dynamic library files, such as a server's root directory.</para></listitem>
</varlistentry>
<varlistentry>
<term>-libfile library-file</term>
<listitem><para>Specify a path to a library file containing the implementation of the PKCS #11 interface module that is being added to the database.</para></listitem>
</varlistentry>
<varlistentry>
<term>-mechanisms mechanism-list</term>
<listitem><para>Specify the security mechanisms for which a particular module will be flagged as a default provider. The <emphasis>mechanism-list</emphasis> is a colon-delimited list of mechanism names. Enclose this list in quotation marks if it contains spaces.</para>
<para>The module becomes a default provider for the listed mechanisms when those mechanisms are enabled. If more than one module claims to be a particular mechanism's default provider, that mechanism's default provider is undefined.</para>
<para><command>modutil</command> supports several mechanisms: RSA, DSA, RC2, RC4, RC5, AES, DES, DH, SHA1, SHA256, SHA512, SSL, TLS, MD5, MD2, RANDOM (for random number generation), and FRIENDLY (meaning certificates are publicly readable).</para></listitem>
</varlistentry>
<varlistentry>
<term>-newpwfile new-password-file</term>
<listitem><para>Specify a text file containing a token's new or replacement password so that a password can be entered automatically with the <option>-changepw</option> option.</para></listitem>
</varlistentry>
<varlistentry>
<term>-nocertdb</term>
<listitem><para>Do not open the certificate or key databases. This has several effects:</para>
<itemizedlist>
<listitem>
<para>With the <option>-create</option> command, only a module security file is created; certificate and key databases are not created.</para>
</listitem>
<listitem>
<para>With the <option>-jar</option> command, signatures on the JAR file are not checked.</para>
</listitem>
<listitem>
<para>With the <option>-changepw</option> command, the password on the NSS internal module cannot be set or changed, since this password is stored in the key database.</para></listitem>
</itemizedlist>
</listitem>
</varlistentry>
<varlistentry>
<term>-pwfile old-password-file</term>
<listitem><para>Specify a text file containing a token's existing password so that a password can be entered automatically when the <option>-changepw</option> option is used to change passwords.</para></listitem>
</varlistentry>
<varlistentry>
<term>-secmod secmodname</term>
<listitem><para>Give the name of the security module database (like <filename>secmod.db</filename>) to load.</para></listitem>
</varlistentry>
<varlistentry>
<term>-slot slotname</term>
<listitem><para>Specify a particular slot to be enabled or disabled with the <option>-enable</option> or <option>-disable</option> options.</para></listitem>
</varlistentry>
<varlistentry>
<term>-string CONFIG_STRING</term>
<listitem><para>Pass a configuration string for the module being added to the database.</para></listitem>
</varlistentry>
<varlistentry>
<term>-tempdir temporary-directory</term>
<listitem><para>Give a directory location where temporary files are created during the installation by the <option>-jar</option> option. If no temporary directory is specified, the current directory is used.</para></listitem>
</varlistentry>
</variablelist>
</refsection>
<refsection id="usage-and-examples">
<title>Usage and Examples</title>
<para><command>Creating Database Files</command></para>
<para>Before any operations can be performed, there must be a set of security databases available. <command>modutil</command> can be used to create these files. The only required argument is the database that where the databases will be located.</para>
<programlisting>modutil -create -dbdir [sql:]directory</programlisting>
<para><command>Adding a Cryptographic Module</command></para>
<para>Adding a PKCS #11 module means submitting a supporting library file, enabling its ciphers, and setting default provider status for various security mechanisms. This can be done by supplying all of the information through <command>modutil</command> directly or by running a JAR file and install script. For the most basic case, simply upload the library:</para>
<programlisting>modutil -add modulename -libfile library-file [-ciphers cipher-enable-list] [-mechanisms mechanism-list] </programlisting>
<para>For example:
<programlisting>modutil -dbdir sql:/home/my/sharednssdb -add "Example PKCS #11 Module" -libfile "/tmp/crypto.so" -mechanisms RSA:DSA:RC2:RANDOM
Using database directory ...
Module "Example PKCS #11 Module" added to database.</programlisting>
</para>
<para><command>Installing a Cryptographic Module from a JAR File</command></para>
<para>PKCS #11 modules can also be loaded using a JAR file, which contains all of the required libraries and an installation script that describes how to install the module. The JAR install script is described in more detail in <xref linkend="jar-install-file" />.</para>
<para>The JAR installation script defines the setup information for each platform that the module can be installed on. For example:</para>
<programlisting>Platforms {
Linux:5.4.08:x86 {
ModuleName { "Example PKCS #11 Module" }
ModuleFile { crypto.so }
DefaultMechanismFlags{0x0000}
CipherEnableFlags{0x0000}
Files {
crypto.so {
Path{ /tmp/crypto.so }
}
setup.sh {
Executable
Path{ /tmp/setup.sh }
}
}
}
Linux:6.0.0:x86 {
EquivalentPlatform { Linux:5.4.08:x86 }
}
} </programlisting>
<para>Both the install script and the required libraries must be bundled in a JAR file, which is specified with the <option>-jar</option> argument.</para>
<programlisting>modutil -dbdir sql:/home/mt"jar-install-filey/sharednssdb -jar install.jar -installdir sql:/home/my/sharednssdb
This installation JAR file was signed by:
----------------------------------------------
**SUBJECT NAME**
C=US, ST=California, L=Mountain View, CN=Cryptorific Inc., OU=Digital ID
Class 3 - Netscape Object Signing, OU="www.verisign.com/repository/CPS
Incorp. by Ref.,LIAB.LTD(c)9 6", OU=www.verisign.com/CPS Incorp.by Ref
. LIABILITY LTD.(c)97 VeriSign, OU=VeriSign Object Signing CA - Class 3
Organization, OU="VeriSign, Inc.", O=VeriSign Trust Network **ISSUER
NAME**, OU=www.verisign.com/CPS Incorp.by Ref. LIABILITY LTD.(c)97
VeriSign, OU=VeriSign Object Signing CA - Class 3 Organization,
OU="VeriSign, Inc.", O=VeriSign Trust Network
----------------------------------------------
Do you wish to continue this installation? (y/n) y
Using installer script "installer_script"
Successfully parsed installation script
Current platform is Linux:5.4.08:x86
Using installation parameters for platform Linux:5.4.08:x86
Installed file crypto.so to /tmp/crypto.so
Installed file setup.sh to ./pk11inst.dir/setup.sh
Executing "./pk11inst.dir/setup.sh"...
"./pk11inst.dir/setup.sh" executed successfully
Installed module "Example PKCS #11 Module" into module database
Installation completed successfully </programlisting>
<para><command>Adding Module Spec</command></para>
<para>Each module has information stored in the security database about its configuration and parameters. These can be added or edited using the <option>-rawadd</option> command. For the current settings or to see the format of the module spec in the database, use the <option>-rawlist</option> option.</para>
<programlisting>modutil -rawadd modulespec</programlisting>
<para><command>Deleting a Module</command></para>
<para>A specific PKCS #11 module can be deleted from the <filename>secmod.db</filename> database:</para>
<programlisting>modutil -delete modulename -dbdir [sql:]directory </programlisting>
<para><command>Displaying Module Information</command></para>
<para>The <filename>secmod.db</filename> database contains information about the PKCS #11 modules that are available to an application or server to use. The list of all modules, information about specific modules, and database configuration specs for modules can all be viewed. </para>
<para>To simply get a list of modules in the database, use the <option>-list</option> command.</para>
<programlisting>modutil -list [modulename] -dbdir [sql:]directory </programlisting>
<para>Listing the modules shows the module name, their status, and other associated security databases for certificates and keys. For example:</para>
<programlisting>modutil -list -dbdir sql:/home/my/sharednssdb
Listing of PKCS #11 Modules
-----------------------------------------------------------
1. NSS Internal PKCS #11 Module
slots: 2 slots attached
status: loaded
slot: NSS Internal Cryptographic Services
token: NSS Generic Crypto Services
slot: NSS User Private Key and Certificate Services
token: NSS Certificate DB
-----------------------------------------------------------</programlisting>
<para>Passing a specific module name with the <option>-list</option> returns details information about the module itself, like supported cipher mechanisms, version numbers, serial numbers, and other information about the module and the token it is loaded on. For example:</para>
<programlisting> modutil -list "NSS Internal PKCS #11 Module" -dbdir sql:/home/my/sharednssdb
-----------------------------------------------------------
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.11
Cipher Enable Flags: None
Default Mechanism Flags: RSA:RC2:RC4:DES:DH:SHA1:MD5:MD2:SSL:TLS:AES
Slot: NSS Internal Cryptographic Services
Slot Mechanism Flags: RSA:RC2:RC4:DES:DH:SHA1:MD5:MD2:SSL:TLS:AES
Manufacturer: Mozilla Foundation
Type: Software
Version Number: 3.11
Firmware Version: 0.0
Status: Enabled
Token Name: NSS Generic Crypto Services
Token Manufacturer: Mozilla Foundation
Token Model: NSS 3
Token Serial Number: 0000000000000000
Token Version: 4.0
Token Firmware Version: 0.0
Access: Write Protected
Login Type: Public (no login required)
User Pin: NOT Initialized
Slot: NSS User Private Key and Certificate Services
Slot Mechanism Flags: None
Manufacturer: Mozilla Foundation
Type: Software
Version Number: 3.11
Firmware Version: 0.0
Status: Enabled
Token Name: NSS Certificate DB
Token Manufacturer: Mozilla Foundation
Token Model: NSS 3
Token Serial Number: 0000000000000000
Token Version: 8.3
Token Firmware Version: 0.0
Access: NOT Write Protected
Login Type: Login required
User Pin: Initialized</programlisting>
<para>A related command, <option>-rawlist</option> returns information about the database configuration for the modules. (This information can be edited by loading new specs using the <option>-rawadd</option> command.)</para>
<programlisting> modutil -rawlist -dbdir sql:/home/my/sharednssdb
name="NSS Internal PKCS #11 Module" parameters="configdir=. certPrefix= keyPrefix= secmod=secmod.db flags=readOnly " NSS="trustOrder=75 cipherOrder=100 slotParams={0x00000001=[slotFlags=RSA,RC4,RC2,DES,DH,SHA1,MD5,MD2,SSL,TLS,AES,RANDOM askpw=any timeout=30 ] } Flags=internal,critical"</programlisting>
<para><command>Setting a Default Provider for Security Mechanisms</command></para>
<para>Multiple security modules may provide support for the same security mechanisms. It is possible to set a specific security module as the default provider for a specific security mechanism (or, conversely, to prohibit a provider from supplying those mechanisms).</para>
<programlisting>modutil -default modulename -mechanisms mechanism-list </programlisting>
<para>To set a module as the default provider for mechanisms, use the <option>-default</option> command with a colon-separated list of mechanisms. The available mechanisms depend on the module; NSS supplies almost all common mechanisms. For example:</para>
<programlisting>modutil -default "NSS Internal PKCS #11 Module" -dbdir -mechanisms RSA:DSA:RC2
Using database directory c:\databases...
Successfully changed defaults.</programlisting>
<para>Clearing the default provider has the same format:</para>
<programlisting>modutil -undefault "NSS Internal PKCS #11 Module" -dbdir -mechanisms MD2:MD5</programlisting>
<para><command>Enabling and Disabling Modules and Slots</command></para>
<para>Modules, and specific slots on modules, can be selectively enabled or disabled using <command>modutil</command>. Both commands have the same format:</para>
<programlisting>modutil -enable|-disable modulename [-slot slotname] </programlisting>
<para>For example:</para>
<programlisting>modutil -enable "NSS Internal PKCS #11 Module" -slot "NSS Internal Cryptographic Services " -dbdir .
Slot "NSS Internal Cryptographic Services " enabled.</programlisting>
<para>Be sure that the appropriate amount of trailing whitespace is after the slot name. Some slot names have a significant amount of whitespace that must be included, or the operation will fail.</para>
<para><command>Enabling and Verifying FIPS Compliance</command></para>
<para>The NSS modules can have FIPS 140-2 compliance enabled or disabled using <command>modutil</command> with the <option>-fips</option> option. For example:</para>
<programlisting>modutil -fips true -dbdir sql:/home/my/sharednssdb/
FIPS mode enabled.</programlisting>
<para>To verify that status of FIPS mode, run the <option>-chkfips</option> command with either a true or false flag (it doesn't matter which). The tool returns the current FIPS setting.</para>
<programlisting>modutil -chkfips false -dbdir sql:/home/my/sharednssdb/
FIPS mode enabled.</programlisting>
<para><command>Changing the Password on a Token</command></para>
<para>Initializing or changing a token's password:</para>
<programlisting>modutil -changepw tokenname [-pwfile old-password-file] [-newpwfile new-password-file] </programlisting>
<programlisting>modutil -dbdir sql:/home/my/sharednssdb -changepw "NSS Certificate DB"
Enter old password:
Incorrect password, try again...
Enter old password:
Enter new password:
Re-enter new password:
Token "Communicator Certificate DB" password changed successfully.</programlisting>
</refsection>
<refsection id="jar-install-file"><title>JAR Installation File Format</title>
<para>When a JAR file is run by a server, by <command>modutil</command>, or by any program that does not interpret JavaScript, a special information file must be included to install the libraries. There are several things to keep in mind with this file:</para>
<itemizedlist>
<listitem>
<para>
It must be declared in the JAR archive's manifest file.
</para>
</listitem>
<listitem>
<para>
The script can have any name.
</para>
</listitem>
<listitem>
<para>
The metainfo tag for this is <command>Pkcs11_install_script</command>. To declare meta-information in the manifest file, put it in a file that is passed to <command>signtool</command>.</para>
</listitem>
</itemizedlist>
<para><command>Sample Script</command></para>
<para>For example, the PKCS #11 installer script could be in the file pk11install. If so, the metainfo file for <command>signtool</command> includes a line such as this:</para>
<programlisting>+ Pkcs11_install_script: pk11install</programlisting>
<para>The script must define the platform and version number, the module name and file, and any optional information like supported ciphers and mechanisms. Multiple platforms can be defined in a single install file.</para>
<programlisting>ForwardCompatible { IRIX:6.2:mips SUNOS:5.5.1:sparc }
Platforms {
WINNT::x86 {
ModuleName { "Example Module" }
ModuleFile { win32/fort32.dll }
DefaultMechanismFlags{0x0001}
DefaultCipherFlags{0x0001}
Files {
win32/setup.exe {
Executable
RelativePath { %temp%/setup.exe }
}
win32/setup.hlp {
RelativePath { %temp%/setup.hlp }
}
win32/setup.cab {
RelativePath { %temp%/setup.cab }
}
}
}
WIN95::x86 {
EquivalentPlatform {WINNT::x86}
}
SUNOS:5.5.1:sparc {
ModuleName { "Example UNIX Module" }
ModuleFile { unix/fort.so }
DefaultMechanismFlags{0x0001}
CipherEnableFlags{0x0001}
Files {
unix/fort.so {
RelativePath{%root%/lib/fort.so}
AbsolutePath{/usr/local/netscape/lib/fort.so}
FilePermissions{555}
}
xplat/instr.html {
RelativePath{%root%/docs/inst.html}
AbsolutePath{/usr/local/netscape/docs/inst.html}
FilePermissions{555}
}
}
}
IRIX:6.2:mips {
EquivalentPlatform { SUNOS:5.5.1:sparc }
}
}</programlisting>
<para><command>Script Grammar</command></para>
<para>The script is basic Java, allowing lists, key-value pairs, strings, and combinations of all of them.</para>
<programlisting>--> valuelist
valuelist --> value valuelist
&lt;null>
value ---> key_value_pair
string
key_value_pair --> key { valuelist }
key --> string
string --> simple_string
"complex_string"
simple_string --> [^ \t\n\""{""}"]+
complex_string --> ([^\"\\\r\n]|(\\\")|(\\\\))+ </programlisting>
<para>Quotes and backslashes must be escaped with a backslash. A complex string must not include newlines or carriage returns.Outside of complex strings, all white space (for example, spaces, tabs, and carriage returns) is considered equal and is used only to delimit tokens.</para>
<para><command>Keys</command></para>
<para>The Java install file uses keys to define the platform and module information.</para>
<para><command>ForwardCompatible</command> gives a list of platforms that are forward compatible. If the current platform cannot be found in the list of supported platforms, then the <command>ForwardCompatible</command> list is checked for any platforms that have the same OS and architecture in an earlier version. If one is found, its attributes are used for the current platform. </para>
<para><command>Platforms</command> (required) Gives a list of platforms. Each entry in the list is itself a key-value pair: the key is the name of the platform and the value list contains various attributes of the platform. The platform string is in the format <emphasis>system name:OS release:architecture</emphasis>. The installer obtains these values from NSPR. OS release is an empty string on non-Unix operating systems. NSPR supports these platforms:</para>
<itemizedlist>
<listitem>
<para>AIX (rs6000)</para>
</listitem>
<listitem>
<para>BSDI (x86)</para>
</listitem>
<listitem>
<para>FREEBSD (x86)</para>
</listitem>
<listitem>
<para>HPUX (hppa1.1)</para>
</listitem>
<listitem>
<para>IRIX (mips)</para>
</listitem>
<listitem>
<para>LINUX (ppc, alpha, x86)</para>
</listitem>
<listitem>
<para>MacOS (PowerPC)</para>
</listitem>
<listitem>
<para>NCR (x86)</para>
</listitem>
<listitem>
<para>NEC (mips)</para>
</listitem>
<listitem>
<para>OS2 (x86)</para>
</listitem>
<listitem>
<para>OSF (alpha)</para>
</listitem>
<listitem>
<para>ReliantUNIX (mips)</para>
</listitem>
<listitem>
<para>SCO (x86)</para>
</listitem>
<listitem>
<para>SOLARIS (sparc)</para>
</listitem>
<listitem>
<para>SONY (mips)</para>
</listitem>
<listitem>
<para>SUNOS (sparc)</para>
</listitem>
<listitem>
<para>UnixWare (x86)</para>
</listitem>
<listitem>
<para>WIN16 (x86)</para>
</listitem>
<listitem>
<para>WIN95 (x86)</para>
</listitem>
<listitem>
<para>WINNT (x86)</para>
</listitem>
</itemizedlist>
<para>For example:</para>
<programlisting>IRIX:6.2:mips
SUNOS:5.5.1:sparc
Linux:2.0.32:x86
WIN95::x86</programlisting>
<para>The module information is defined independently for each platform in the <command>ModuleName</command>, <command>ModuleFile</command>, and <command>Files</command> attributes. These attributes must be given unless an <command>EquivalentPlatform</command> attribute is specified. </para>
<para><command>Per-Platform Keys</command></para>
<para>Per-platform keys have meaning only within the value list of an entry in the <command>Platforms</command> list.</para>
<para><command>ModuleName</command> (required) gives the common name for the module. This name is used to reference the module by servers and by the <command>modutil</command> tool. </para>
<para><command>ModuleFile</command> (required) names the PKCS #11 module file for this platform. The name is given as the relative path of the file within the JAR archive. </para>
<para><command>Files</command> (required) lists the files that need to be installed for this module. Each entry in the file list is a key-value pair. The key is the path of the file in the JAR archive, and the value list contains attributes of the file. At least <command>RelativePath</command> or <command>AbsolutePath</command> must be specified for each file.</para>
<para><command>DefaultMechanismFlags</command> specifies mechanisms for which this module is the default provider; this is equivalent to the <option>-mechanism</option> option with the <option>-add</option> command. This key-value pair is a bitstring specified in hexadecimal (0x) format. It is constructed as a bitwise OR. If the DefaultMechanismFlags entry is omitted, the value defaults to 0x0.</para>
<programlisting>RSA: 0x00000001
DSA: 0x00000002
RC2: 0x00000004
RC4: 0x00000008
DES: 0x00000010
DH: 0x00000020
FORTEZZA: 0x00000040
RC5: 0x00000080
SHA1: 0x00000100
MD5: 0x00000200
MD2: 0x00000400
RANDOM: 0x08000000
FRIENDLY: 0x10000000
OWN_PW_DEFAULTS: 0x20000000
DISABLE: 0x40000000</programlisting>
<para><command>CipherEnableFlags</command> specifies ciphers that this module provides that NSS does not provide (so that the module enables those ciphers for NSS). This is equivalent to the <option>-cipher</option> argument with the <option>-add</option> command. This key is a bitstring specified in hexadecimal (0x) format. It is constructed as a bitwise OR. If the <command>CipherEnableFlags</command> entry is omitted, the value defaults to 0x0.</para>
<para><command>EquivalentPlatform</command> specifies that the attributes of the named platform should also be used for the current platform. This makes it easier when more than one platform uses the same settings.</para>
<para><command>Per-File Keys</command></para>
<para>Some keys have meaning only within the value list of an entry in a <command>Files</command> list.</para>
<para>Each file requires a path key the identifies where the file is. Either <command>RelativePath</command> or <command>AbsolutePath</command> must be specified. If both are specified, the relative path is tried first, and the absolute path is used only if no relative root directory is provided by the installer program.</para>
<para><command>RelativePath</command> specifies the destination directory of the file, relative to some directory decided at install time. Two variables can be used in the relative path: <command>%root%</command> and <command>%temp%</command>. <command>%root%</command> is replaced at run time with the directory relative to which files should be installed; for example, it may be the server's root directory. The <command>%temp%</command> directory is created at the beginning of the installation and destroyed at the end. The purpose of <command>%temp%</command> is to hold executable files (such as setup programs) or files that are used by these programs. Files destined for the temporary directory are guaranteed to be in place before any executable file is run; they are not deleted until all executable files have finished.</para>
<para><command>AbsolutePath</command> specifies the destination directory of the file as an absolute path. </para>
<para><command>Executable</command> specifies that the file is to be executed during the course of the installation. Typically, this string is used for a setup program provided by a module vendor, such as a self-extracting setup executable. More than one file can be specified as executable, in which case the files are run in the order in which they are specified in the script file.</para>
<para><command>FilePermissions</command> sets permissions on any referenced files in a string of octal digits, according to the standard Unix format. This string is a bitwise OR.</para>
<programlisting>
user read: 0400
user write: 0200
user execute: 0100
group read: 0040
group write: 0020
group execute: 0010
other read: 0004
other write: 0002
other execute: 0001
</programlisting>
<para>Some platforms may not understand these permissions. They are applied only insofar as they make sense for the current platform. If this attribute is omitted, a default of 777 is assumed.</para>
</refsection>
<refsection id="databases"><title>NSS Database Types</title>
<para>NSS originally used BerkeleyDB databases to store security information.
The last versions of these <emphasis>legacy</emphasis> databases are:</para>
<itemizedlist>
<listitem>
<para>
cert8.db for certificates
</para>
</listitem>
<listitem>
<para>
key3.db for keys
</para>
</listitem>
<listitem>
<para>
secmod.db for PKCS #11 module information
</para>
</listitem>
</itemizedlist>
<para>BerkeleyDB has performance limitations, though, which prevent it from being easily used by multiple applications simultaneously. NSS has
some flexibility that allows applications to use their own, independent database engine while keeping a shared database and working around the access issues. Still, NSS
requires more flexibility to provide a truly shared security database.</para>
<para>In 2009, NSS introduced a new set of databases that are SQLite databases rather than
BerkleyDB. These new databases provide more accessibility and performance:</para>
<itemizedlist>
<listitem>
<para>
cert9.db for certificates
</para>
</listitem>
<listitem>
<para>
key4.db for keys
</para>
</listitem>
<listitem>
<para>
pkcs11.txt, which is listing of all of the PKCS #11 modules contained in a new subdirectory in the security databases directory
</para>
</listitem>
</itemizedlist>
<para>Because the SQLite databases are designed to be shared, these are the <emphasis>shared</emphasis> database type. The shared database type is preferred; the legacy format is included for backward compatibility.</para>
<para>By default, the tools (<command>certutil</command>, <command>pk12util</command>, <command>modutil</command>) assume that the given security databases follow the more common legacy type.
Using the SQLite databases must be manually specified by using the <command>sql:</command> prefix with the given security directory. For example:</para>
<programlisting>modutil -create -dbdir sql:/home/my/sharednssdb</programlisting>
<para>To set the shared database type as the default type for the tools, set the <envar>NSS_DEFAULT_DB_TYPE</envar> environment variable to <envar>sql</envar>:</para>
<programlisting>export NSS_DEFAULT_DB_TYPE="sql"</programlisting>
<para>This line can be added to the <filename>~/.bashrc</filename> file to make the change permanent for the user.</para>
<para>Most applications do not use the shared database by default, but they can be configured to use them. For example, this how-to article covers how to configure Firefox and Thunderbird to use the new shared NSS databases:</para>
<itemizedlist>
<listitem>
<para>
https://wiki.mozilla.org/NSS_Shared_DB_Howto</para>
</listitem>
</itemizedlist>
<para>For an engineering draft on the changes in the shared NSS databases, see the NSS project wiki:</para>
<itemizedlist>
<listitem>
<para>
https://wiki.mozilla.org/NSS_Shared_DB
</para>
</listitem>
</itemizedlist>
</refsection>
<refsection id="seealso">
<title>See Also</title>
<para>certutil (1)</para>
<para>pk12util (1)</para>
<para>signtool (1)</para>
<para>The NSS wiki has information on the new database design and how to configure applications to use it.</para>
<itemizedlist>
<listitem>
<para>
https://wiki.mozilla.org/NSS_Shared_DB_Howto</para>
</listitem>
<listitem>
<para>
https://wiki.mozilla.org/NSS_Shared_DB
</para>
</listitem>
</itemizedlist>
</refsection>
<!-- don't change -->
<refsection id="resources">
<title>Additional Resources</title>
<para>For information about NSS and other tools related to NSS (like JSS), check out the NSS project wiki at <ulink url="http://www.mozilla.org/projects/security/pki/nss/">http://www.mozilla.org/projects/security/pki/nss/</ulink>. The NSS site relates directly to NSS code changes and releases.</para>
<para>Mailing lists: https://lists.mozilla.org/listinfo/dev-tech-crypto</para>
<para>IRC: Freenode at #dogtag-pki</para>
</refsection>
<!-- fill in your name first; keep the other names for reference -->
<refsection id="authors">
<title>Authors</title>
<para>The NSS tools were written and maintained by developers with Netscape, Red Hat, Sun, Oracle, Mozilla, and Google.</para>
<para>
Authors: Elio Maldonado &lt;emaldona@redhat.com>, Deon Lackey &lt;dlackey@redhat.com>.
</para>
</refsection>
<!-- don't change -->
<refsection id="license">
<title>LICENSE</title>
<para>Licensed under the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
</para>
</refsection>
</refentry>