.nh .TH pkispawn 8 "September 30, 2020" PKI "PKI Instance Creation Utility" .SH NAME .PP pkispawn - Sets up a PKI subsystem. .SH SYNOPSIS .PP \fBpkispawn\fP \fB-s\fP \fIsubsystem\fP \fB-f\fP \fIconfig_file\fP [\fB-h\fP] [\fB-v\fP] .SH DESCRIPTION .PP Sets up a PKI subsystem (CA, KRA, OCSP, TKS, or TPS) in a Tomcat instance. .PP \fBNote:\fP A 389 Directory Server instance must be configured and running before this script can be run. PKI server requires an internal directory database. The default configuration assumes a Directory Server instance running on the same machine on port 389. For more information on creating a Directory Server instance, see \fBdscreate(8)\fP\&. .PP An instance can contain multiple subsystems, although it may contain at most one of each type of subsystem on a single machine. So, for example, an instance could contain CA and KRA subsystems, but not two CA subsystems. To create an instance with a CA and a KRA, simply run pkispawn twice, with values \fB-s CA\fP and \fB-s KRA\fP respectively. .PP The instances are created based on values for configuration parameters in the default configuration (i.e. /usr/share/pki/server/etc/default.cfg) and the user-provided configuration file. The user-provided configuration file is read after the default configuration file, so any parameters defined in that file will override parameters in the default configuration file. In general, most users will store only those parameters which are different from the default configuration in their user-provided configuration file. .PP This configuration file contains parameters that are grouped into sections. These sections are stacked, so that parameters defined in earlier sections can be overwritten by parameters defined in later sections. The sections are read in the following order: [DEFAULT], [Tomcat], and the subsystem section ([CA], [KRA], [OCSP], [TKS], or [TPS]). This allows the ability to specify parameters to be shared by all subsystems in [DEFAULT] or [Tomcat], and system-specific customization. .PP \fBNote:\fP Any non-password related parameter values in the configuration file that needs to contain a \fB%\fP character must be properly escaped. For example, a value of \fBfoo%bar\fP would be specified as \fBfoo%%bar\fP in the configuration file. .PP At a minimum, the user-defined configuration file must provide some passwords needed for the install. An example configuration file is provided in the \fBEXAMPLES\fP section below. For more information on the default configuration file and the parameters it contains (and can be customized), see \fBpki_default.cfg(5)\fP\&. .PP The \fBpkispawn\fP run creates several different installation files that can be referenced later, if need be: .RS .IP \(bu 2 For Tomcat-based instances, a Tomcat instance is created at /var/lib/pki/\fIpki_instance_name\fP, where \fBpki_instance_name\fP is defined in the configuration file. .IP \(bu 2 A log file of \fBpkispawn\fP operations is written to /var/log/pki/pki-\fIsubsystem\fP-spawn.\fItimestamp\fP\&.log. .IP \(bu 2 A .p12 (PKCS #12) file containing a certificate for a subsystem administrator is stored in \fBpki_client_dir\fP defined in the configuration file. .RE .PP When the utility is done running, the CA can be accessed by pointing a browser to https://\fIhostname\fP:\fIpki_https_port\fP/. The agent pages can be accessed by importing the CA certificate and administrator certificate into the browser. .PP The PKI server instance can also be accessed using the \fBpki\fP command line interface. See \fBpki(1)\fP\&. For more extensive documentation on how to use PKI features, see the Red Hat Certificate System Documentation at https://access.redhat.com/knowledge/docs/Red_Hat_Certificate_System. .PP Instances created using \fBpkispawn\fP can be removed using \fBpkidestroy\fP\&. See \fBpkidestroy(8)\fP\&. .SH OPTIONS .PP \fB-s\fP \fIsubsystem\fP .br Specifies the subsystem to be installed and configured, where \fIsubsystem\fP is CA, KRA, OCSP, TKS, or TPS. .PP \fB-f\fP \fIconfig_file\fP .br Specifies the path to the user-defined configuration file. This file contains differences between the default configuration and the custom configuration. .PP \fB--precheck\fP .br Execute pre-checks and exit. .PP \fB--skip-configuration\fP .br Run the first step of the installation (i.e. skipping the instance configuration step). .PP \fB--skip-installation\fP .br Run the second step of the installation (i.e. skipping the instance installation step). .PP \fB-h\fP, \fB--help\fP .br Prints additional help information. .PP \fB-v\fP .br Displays verbose information about the installation. This flag can be provided multiple times to increase verbosity. See \fBpkispawn -h\fP for details. .SH SEPARATE VERSUS SHARED INSTANCES .SS Separate PKI instances .PP As described above, this version of PKI continues to support separate PKI instances for all subsystems. .PP Separate PKI instances run as a single Java-based Apache Tomcat instance, contain a single PKI subsystem (CA, KRA, OCSP, TKS, or TPS), and must utilize unique ports if co-located on the same machine. .SS Shared PKI instances .PP Additionally, this version of PKI introduces the notion of a shared PKI instance. .PP Shared PKI instances also run as a single Java-based Apache Tomcat instance, but may contain any combination of up to one of each type of PKI subsystem: .RS .IP \(bu 2 CA .IP \(bu 2 TKS .IP \(bu 2 CA, KRA .IP \(bu 2 CA, OCSP .IP \(bu 2 TKS, TPS .IP \(bu 2 CA, KRA, TKS, TPS .IP \(bu 2 CA, KRA, OCSP, TKS, TPS .IP \(bu 2 etc. .RE .PP Shared PKI instances allow all of their subsystems contained within that instance to share the same ports, and must utilize unique ports if more than one shared PKI instance is co-located on the same machine. .PP Semantically, a shared PKI instance that contains a single PKI subsystem is identical to a separate PKI instance. .SH INTERACTIVE MODE .PP If no options are specified, pkispawn will provide an interactive menu to collect the parameters needed to install the Certificate Server instance. Note that only the most basic installation options are provided. This includes root CA, KRA, OCSP, TKS, and TPS connecting to an existing directory server. More advanced setups such as cloned subsystems, subordinate or externally signed CA, subsystems that connect to the directory server using LDAPS, and subsystems that are customized beyond the options described below require the use of a configuration file with the \fB-f\fP option. .PP The interactive option is most useful for those users getting familiar with Certificate Server. The parameters collected are written to the installation file of the subsystem, which can be found at /etc/dogtag/tomcat/\fIinstance_name\fP/\fIsubsystem\fP/deployment.cfg. .PP The following parameters are queried interactively during the installation process. .SS Subsystem Type .PP \fBSubsystem (CA/KRA/OCSP/TKS/TPS):\fP .br The type of subsystem to be installed. Prompted when the -s option is not specified. The default value chosen is CA. .SS Instance Specific Parameters .PP \fBInstance name:\fP .br The name of the tomcat instance in which the subsystem is to be installed. The default value is pki-tomcat. .PP \fBNote:\fP Only one subsystem of a given type (CA, KRA, OCSP, TKS, TPS) can exist within a given instance. .PP \fBHTTP port:\fP .br The HTTP port of the Tomcat instance. The default value is 8080. .PP \fBSecure HTTP port:\fP .br The HTTPS port of the Tomcat instance. The default value is 8443. .PP \fBAJP port:\fP .br The AJP port of the Tomcat instance. The default value is 8009. .PP \fBManagement port:\fP .br The management port of the Tomcat instance. The default value is 8005. .PP \fBNote:\fP When deploying a new subsystem into an existing instance, pkispawn will attempt to read the ports from \fBdeployment.cfg\fP files stored for previously installed subsystems for this instance. If successful, the installer will not prompt for these ports. .SS Administrative User Parameters .PP \fBUsername:\fP .br The username of the administrator of this subsystem. The default value is admin. .PP \fBPassword:\fP .br Password for the administrator user. .PP \fBImport certificate:\fP .br An optional parameter that can be used to import an already available CA admin certificate into this instance. .PP \fBExport certificate:\fP .br Setup the path where the admin certificate of this should be stored. The default value is $HOME/.dogtag/pki-tomcat/_admin.cert. .SS Directory Server Parameters .PP \fBHostname:\fP .br Hostname of the directory server instance. The default value is the hostname of the system. .PP \fBUse a secure LDAPS connection?\fP .br Answering yes to this question will cause prompts for \fBSecure LDAPS Port:\fP and \fBDirectory Server CA certificate pem file:\fP\&. Answering no to this question will cause a prompt for \fBLDAP Port\fP\&. The initial default value for this question is no. .PP \fBSecure LDAPS Port:\fP .br Secure LDAPS port for the directory server instance. The default value is 636. .PP \fBDirectory Server CA certificate PEM file:\fP .br The fully-qualified path including the filename of the file which contains an exported copy of the Directory Server's CA certificate (e.g. $HOME/dscacert.pem). This file must exist prior to \fBpkispawn\fP being able to utilize it. For details on creation of this file see the \fBEXAMPLES\fP section below entitled \fBInstalling PKI Subsystem with Secure LDAP Connection\fP\&. .PP \fBLDAP Port:\fP .br LDAP port for the directory server instance. The default value is 389. .PP \fBBase DN:\fP .br The Base DN to be used for the internal database for this subsystem. The default value is o=pki-tomcat-. .PP \fBBind DN:\fP .br The bind DN required to connect for the directory server. This user must have sufficient permissions to install the required schema and database. The default value is cn=Directory Manager. .PP \fBPassword:\fP .br Password for the bind DN. .SS Security Domain Parameters .PP \fBName:\fP .br The name of the security domain. Required only if installing a root CA. Default value: Security Domain. .PP \fBHostname:\fP .br The hostname for the security domain CA. Required only for non-CA subsystems. The default value is the hostname of this system. .PP \fBSecure HTTP port:\fP .br The https port for the security domain. Required only for non-CA subsystems. The default value is 8443. .PP \fBUsername:\fP .br The username of the security domain administrator of the CA. Required only for non-CA subsystems. The default value is caadmin. .PP \fBPassword:\fP .br Password for the security domain administrator. Required for all subsystems that are not root CAs. .SH PRE-CHECK MODE .PP This option is only available when pkispawn is invoked in a non-interactive mode. When the \fB--precheck\fP option is provided, a set of basic tests are performed to ensure that the parameters provided to pkispawn are valid and consistent. .PP \fBpkispawn\fP will then exit with an exit code of 0 on success, or 1 on failure. This mode can be used to perform basic tests prior to doing any actual installation of the PKI server instance. .PP Flags are available to disable specific tests. For instance, one might want to disable validation of the credentials for the internal database user if the directory server instance has not yet been created. .PP See \fBpki_default.cfg(5)\fP for more details about available flags. .SH TWO-STEP INSTALLATION MODE .PP \fBpkispawn\fP provides a number of parameters to customize an instance before it is created. Usually, most other customization can be done after the server is created. However, sometimes certain types of customization need to be done before the server is created, but there are no parameters for that. For example, configuring session timeout, adding CSR extensions, customizing certificate profiles, configuring TLS ciphers, etc. To support such customization, \fBpkispawn\fP provides a two-step installation mode. .PP Generally, instance creation happens in one step (except for the external CA case). Internally, the process happens in two stages. In the first stage, pkispawn will install the instance files (e.g. CS.cfg, NSS database, profiles, etc.) in the instance directory and customize them based on pkispawn parameters. In the second stage, pkispawn will start the instance and configure the instance based on the instance configuration files (e.g. initializing database, generating certificates, configuring connectors, etc.). The two-step process allows the process to be stopped after the first stage, allowing further customization to be done before running the second stage. .PP To use two-step installation mode, prepare a normal pkispawn configuration file, then run \fBpkispawn\fP with the \fB--skip-configuration\fP parameter. For example: .PP .RS .nf $ pkispawn -s CA -f myconfig.txt --skip-configuration .fi .RE .PP Then customize the files in the instance directory as needed. Finally, finish the installation by running pkispawn again with the \fB--skip-installation\fP parameter. For example: .PP .RS .nf $ pkispawn -s CA -f myconfig.txt --skip-installation .fi .RE .SH EXAMPLES .SS Installing Root CA .PP To install a root CA in a new instance execute the following command: .PP .RS .nf $ pkispawn -s CA -f myconfig.txt .fi .RE .PP where \fBmyconfig.txt\fP contains the following text: .PP .RS .nf [DEFAULT] pki_admin_password=Secret.123 pki_client_pkcs12_password=Secret.123 pki_ds_password=Secret.123 .fi .RE .PP Prior to running this command, a Directory Server instance should be created and running. This command assumes that the Directory Server instance is using its default configuration: .RS .IP \(bu 2 Installed on the local machine .IP \(bu 2 Listening on port 389 .IP \(bu 2 The user is cn=Directory Manager, with the password specified in \fBpki_ds_password\fP .RE .PP This invocation of \fBpkispawn\fP creates a Tomcat instance containing a CA running on the local machine with secure port 8443 and unsecure port 8080. To access this CA, simply point a browser to https://\fIhostname\fP:8443. .PP The instance name (defined by \fBpki_instance_name\fP) is pki-tomcat, and it is located at /var/lib/pki/pki-tomcat. Logs for the instance are located at /var/log/pki/pki-tomcat, and an installation log is written to /var/log/pki/pki-\fIsubsystem\fP-spawn.\fItimestamp\fP\&.log. .PP A PKCS #12 file containing the administrator certificate is created in $HOME/.dogtag/pki-tomcat. This PKCS #12 file uses the password designated by \fBpki_client_pkcs12_password\fP in the configuration file. .PP To access the agent pages, first import the CA certificate by accessing the CA End Entity Pages and clicking on the Retrieval Tab. Be sure to trust the CA certificate. Then, import the administrator certificate in the PKCS #12 file. .SS Installing Root CA using ECC .PP To install a root CA in a new instance using ECC execute the following command: .PP .RS .nf $ pkispawn -s CA -f myconfig.txt .fi .RE .PP where \fBmyconfig.txt\fP contains the following text: .PP .RS .nf [DEFAULT] pki_admin_password=Secret.123 pki_admin_key_algorithm=SHA256withEC pki_admin_key_size=nistp256 pki_admin_key_type=ecc pki_client_pkcs12_password=Secret.123 pki_ds_password=Secret.123 pki_sslserver_key_algorithm=SHA256withEC pki_sslserver_key_size=nistp256 pki_sslserver_key_type=ecc pki_subsystem_key_algorithm=SHA256withEC pki_subsystem_key_size=nistp256 pki_subsystem_key_type=ecc [CA] pki_ca_signing_key_algorithm=SHA256withEC pki_ca_signing_key_size=nistp256 pki_ca_signing_key_type=ecc pki_ca_signing_signing_algorithm=SHA256withEC pki_ocsp_signing_key_algorithm=SHA256withEC pki_ocsp_signing_key_size=nistp256 pki_ocsp_signing_key_type=ecc pki_ocsp_signing_signing_algorithm=SHA256withEC .fi .RE .PP In order to utilize ECC, the SSL Server and Subsystem key algorithm, key size, and key type should be changed from SHA256withRSA to SHA256withEC, 2048 to nistp256, and rsa to ecc, respectively. To use an ECC admin key size and key type, the values should also be changed from 2048 to nistp256, and rsa to ecc. .PP Additionally, for a CA subsystem, both the CA and OCSP Signing key algorithm, key size, key type, and signing algorithm should be changed from SHA256withRSA to SHA256withEC, 2048 to nistp256, rsa to ecc, and SHA256withRSA to SHA256withEC, respectively. .PP \fBNote:\fP For all PKI subsystems including the CA, ECC is not supported for the corresponding Audit Signing parameters. Similarly, for KRA subsystems, ECC is not supported for either of the corresponding Storage or Transport parameters. .SS Installing KRA, OCSP, TKS, or TPS in Shared Instance .PP For this example, assume that a new CA instance has been installed by executing the following command: .PP .RS .nf $ pkispawn -s CA -f myconfig.txt .fi .RE .PP where \fBmyconfig.txt\fP contains the following text: .PP .RS .nf [DEFAULT] pki_admin_password=Secret.123 pki_client_pkcs12_password=Secret.123 pki_ds_password=Secret.123 .fi .RE .PP To install a shared KRA in the same instance used by the CA execute the following command: .PP .RS .nf $ pkispawn -s KRA -f myconfig.txt .fi .RE .PP where \fBmyconfig.txt\fP contains the following text: .PP .RS .nf [DEFAULT] pki_admin_password=Secret.123 pki_client_database_password=Secret.123 pki_client_pkcs12_password=Secret.123 pki_ds_password=Secret.123 pki_security_domain_password=Secret.123 .fi .RE .PP To install a shared OCSP in the same instance used by the CA execute the following command: .PP .RS .nf $ pkispawn -s OCSP -f myconfig.txt .fi .RE .PP where \fBmyconfig.txt\fP contains the following text: .PP .RS .nf [DEFAULT] pki_admin_password=Secret.123 pki_client_database_password=Secret.123 pki_client_pkcs12_password=Secret.123 pki_ds_password=Secret.123 pki_security_domain_password=Secret.123 .fi .RE .PP To install a shared TKS in the same instance used by the CA execute the following command: .PP .RS .nf $ pkispawn -s TKS -f myconfig.txt .fi .RE .PP where \fBmyconfig.txt\fP contains the following text: .PP .RS .nf [DEFAULT] pki_admin_password=Secret.123 pki_client_database_password=Secret.123 pki_client_pkcs12_password=Secret.123 pki_ds_password=Secret.123 pki_security_domain_password=Secret.123 .fi .RE .PP To install a shared TPS in the same instance used by the CA execute the following command: .PP .RS .nf $ pkispawn -s TPS -f myconfig.txt .fi .RE .PP where \fBmyconfig.txt\fP contains the following text: .PP .RS .nf [DEFAULT] pki_admin_password=Secret.123 pki_client_database_password=Secret.123 pki_client_pkcs12_password=Secret.123 pki_ds_password=Secret.123 pki_security_domain_password=Secret.123 [TPS] # Shared TPS instances optionally utilize their shared KRA # for server-side keygen pki_enable_server_side_keygen=True pki_authdb_basedn=dc=example,dc=com .fi .RE .PP \fBNote:\fP For this particular example, the computed default values for a PKI instance name including its ports, URLs, machine names, etc. were utilized as defined in /usr/share/pki/server/etc/default.cfg. Each subsystem in this example will reside under the /var/lib/pki/pki-tomcat instance housed within their own \fBca\fP, \fBkra\fP, \fBocsp\fP, \fBtks\fP, and \fBtps\fP subdirectories, utilizing the same default port values of 8080 (http), 8443 (https), 8009 (ajp), 8005 (tomcat), using the same computed hostname and URL information, and sharing a single common PKI Administrator Certificate. .PP The \fBpki_security_domain_password\fP is the admin password of the CA installed in the same instance. This command should be run after a CA is installed. This installs another subsystem within the same instance using the certificate generated for the CA administrator for the subsystem's administrator. This allows a user to access both subsystems on the browser with a single administrator certificate. To access the new subsystem's functionality, simply point the browser to https://\fIhostname\fP:8443 and click the relevant top-level links. .PP To install TPS in a shared instance the following section must be added to \fBmyconfig.txt\fP: .PP .RS .nf [TPS] pki_authdb_basedn=dc=example,dc=com .fi .RE .PP TPS requires an authentication database. The \fBpki_authdb_basedn\fP specifies the base DN of the authentication database. .PP TPS also requires that a CA and a TKS subsystems are already installed in the same instance. Since they are in the same instance, a shared secret key will automatically be generated in TKS and imported into TPS. .PP Optionally, server-side key generation can be enabled in TPS by adding the following parameter in [TPS]: .PP .RS .nf pki_enable_server_side_keygen=True .fi .RE .PP Enabling server-side key generation requires that a KRA subsystem is already installed in the same instance. .SS Installing KRA, OCSP, TKS, or TPS in Separate Instance .PP For this example, assume that a new CA instance has been installed by executing the following command: .PP .RS .nf $ pkispawn -s CA -f myconfig.txt .fi .RE .PP where \fBmyconfig.txt\fP contains the following text: .PP .RS .nf [DEFAULT] pki_admin_password=Secret.123 pki_client_pkcs12_password=Secret.123 pki_ds_password=Secret.123 # Separated CA instance name and ports pki_instance_name=pki-ca pki_http_port=18080 pki_https_port=18443 # This Separated CA instance will be its own security domain pki_security_domain_https_port=18443 [Tomcat] # Separated CA Tomcat ports pki_ajp_port=18009 pki_tomcat_server_port=18005 .fi .RE .PP To install a separate KRA which connects to this remote CA execute the following command: .PP .RS .nf $ pkispawn -s KRA -f myconfig.txt .fi .RE .PP where \fBmyconfig.txt\fP contains the following text: .PP .RS .nf [DEFAULT] pki_admin_password=Secret.123 pki_client_database_password=Secret.123 pki_client_pkcs12_password=Secret.123 pki_ds_password=Secret.123 pki_security_domain_password=Secret.123 # Separated KRA instance name and ports pki_instance_name=pki-kra pki_http_port=28080 pki_https_port=28443 # Separated KRA instance security domain references pki_issuing_ca=https://pki.example.com:18443 pki_security_domain_hostname=pki.example.com pki_security_domain_https_port=18443 pki_security_domain_user=caadmin [Tomcat] # Separated KRA Tomcat ports pki_ajp_port=28009 pki_tomcat_server_port=28005 [KRA] # A Separated KRA instance requires its own # PKI Administrator Certificate pki_import_admin_cert=False .fi .RE .PP To install a separate OCSP which connects to this remote CA execute the following command: .PP .RS .nf $ pkispawn -s OCSP -f myconfig.txt .fi .RE .PP where \fBmyconfig.txt\fP contains the following text: .PP .RS .nf [DEFAULT] pki_admin_password=Secret.123 pki_client_database_password=Secret.123 pki_client_pkcs12_password=Secret.123 pki_ds_password=Secret.123 pki_security_domain_password=Secret.123 # Separated OCSP instance name and ports pki_instance_name=pki-ocsp pki_http_port=29080 pki_https_port=29443 # Separated OCSP instance security domain references pki_issuing_ca=https://pki.example.com:18443 pki_security_domain_hostname=pki.example.com pki_security_domain_https_port=18443 pki_security_domain_user=caadmin [Tomcat] # Separated OCSP Tomcat ports pki_ajp_port=29009 pki_tomcat_server_port=29005 [OCSP] # A Separated OCSP instance requires its own # PKI Administrator Certificate pki_import_admin_cert=False .fi .RE .PP To install a separate TKS which connects to this remote CA execute the following command: .PP .RS .nf $ pkispawn -s TKS -f myconfig.txt .fi .RE .PP where \fBmyconfig.txt\fP contains the following text: .PP .RS .nf [DEFAULT] pki_admin_password=Secret.123 pki_client_database_password=Secret.123 pki_client_pkcs12_password=Secret.123 pki_ds_password=Secret.123 pki_security_domain_password=Secret.123 # Separated TKS instance name and ports pki_instance_name=pki-tks pki_http_port=30080 pki_https_port=30443 # Separated TKS instance security domain references pki_issuing_ca=https://pki.example.com:18443 pki_security_domain_hostname=pki.example.com pki_security_domain_https_port=18443 pki_security_domain_user=caadmin [Tomcat] # Separated TKS Tomcat ports pki_ajp_port=30009 pki_tomcat_server_port=30005 [TKS] # A Separated TKS instance requires its own # PKI Administrator Certificate pki_import_admin_cert=False .fi .RE .PP To install a separate TPS which connects to this remote CA execute the following command: .PP .RS .nf $ pkispawn -s TPS -f myconfig.txt .fi .RE .PP where \fBmyconfig.txt\fP contains the following text: .PP .RS .nf [DEFAULT] pki_admin_password=Secret.123 pki_client_database_password=Secret.123 pki_client_pkcs12_password=Secret.123 pki_ds_password=Secret.123 pki_security_domain_password=Secret.123 # Separated TPS instance name and ports pki_instance_name=pki-tps pki_http_port=31080 pki_https_port=31443 # Separated TPS instance security domain references pki_issuing_ca=https://pki.example.com:18443 pki_security_domain_hostname=pki.example.com pki_security_domain_https_port=18443 pki_security_domain_user=caadmin [Tomcat] # Separated TPS Tomcat ports pki_ajp_port=31009 pki_tomcat_server_port=31005 [TPS] # Separated TPS instances require specifying a remote CA pki_ca_uri=https://pki.example.com:18443 # Separated TPS instances optionally utilize a remote KRA # for server-side keygen pki_kra_uri=https://pki.example.com:28443 pki_enable_server_side_keygen=True pki_authdb_basedn=dc=example,dc=com # Separated TPS instances require specifying a remote TKS pki_tks_uri=https://pki.example.com:30443 pki_import_shared_secret=True # A Separated TPS instance requires its own # PKI Administrator Certificate pki_import_admin_cert=False .fi .RE .PP \fBNote:\fP For this particular example, besides passwords, sample values were also utilized for PKI instance names, ports, URLs, machine names, etc. Under no circumstances should these demonstrative values be construed to be required literal values. .PP A remote CA is one where the CA resides in another PKI server instance, either on the local machine or a remote machine. In this case, \fBmyconfig.txt\fP must specify the connection information for the remote CA and the information about the security domain (the trusted collection of subsystems within an instance). .PP The subsystem section is [KRA], [OCSP], [TKS], or [TPS]. This example assumes that the specified CA hosts the security domain. The CA must be running and accessible. .PP A new administrator certificate is generated for the new subsystem and stored in a PKCS #12 file in $HOME/.dogtag/\fIpki_instance_name\fP\&. .PP As in a shared instance, to install TPS in a separate instance the authentication database must be specified in the [TPS] section, and optionally the server-side key generation can be enabled. If the CA, KRA, or TKS subsystems required by TPS are running on a remote instance the following parameters must be added into the [TPS] section to specify their locations: .PP .RS .nf pki_ca_uri=https://: pki_kra_uri=https://: pki_tks_uri=https://: .fi .RE .PP If TPS and TKS are installed on separate instances the shared secret key should be imported over the wire between the TKS and TPS automatically. .PP If the automated procedure fails for any unlikely reason the following manual procedure will serve as a fallback. The key needs to be created on the TKS side and imported into the TPS side in this case. .PP Generate the shared secret key (if needed) in TKS with the following command: .PP .RS .nf $ tkstool -T -d /var/lib/pki/pki-tomcat/alias -n sharedSecret .fi .RE .PP Verify the shared secret key in TKS with the following command: .PP .RS .nf $ tkstool -L -d /var/lib/pki/pki-tomcat/alias .fi .RE .PP Once TPS is installed, shutdown TPS instance, then import the shared secret key into TPS with the following command: .PP .RS .nf $ tkstool -I -d /var/lib/pki/pki-tomcat/alias -n sharedSecret .fi .RE .PP Verify the shared secret key in TPS with the following command: .PP .RS .nf $ tkstool -L -d /var/lib/pki/pki-tomcat/alias .fi .RE .PP The shared secret key nickname should be stored in the following property in the TPS's CS.cfg: .PP .RS .nf conn.tks1.tksSharedSymKeyName=sharedSecret .fi .RE .PP Finally, restart the TPS instance. .SS Installing CA, KRA, OCSP, TKS, or TPS using HSM .PP This section provides sample \fBmyconfig.txt\fP files when a Hardware Security Module (HSM) is being utilized in a shared PKI instance. .PP For this example, assume that a new CA instance has been installed by executing the following command: .PP .RS .nf $ pkispawn -s CA -f myconfig.txt .fi .RE .PP where \fBmyconfig.txt\fP contains the following text: .PP .RS .nf [DEFAULT] pki_admin_password=Secret.123 pki_client_pkcs12_password=Secret.123 pki_ds_password=Secret.123 # Provide HSM parameters pki_hsm_enable=True pki_hsm_libfile= pki_hsm_modulename= pki_token_name= pki_token_password= # Provide PKI-specific HSM token names pki_audit_signing_token= pki_sslserver_token= pki_subsystem_token= [CA] # Provide CA-specific HSM token names pki_ca_signing_token= pki_ocsp_signing_token= .fi .RE .PP To install a shared KRA in the same instance used by the CA execute the following command: .PP .RS .nf $ pkispawn -s KRA -f myconfig.txt .fi .RE .PP where \fBmyconfig.txt\fP contains the following text: .PP .RS .nf [DEFAULT] pki_admin_password=Secret.123 pki_client_database_password=Secret.123 pki_client_pkcs12_password=Secret.123 pki_ds_password=Secret.123 pki_security_domain_password=Secret.123 # Provide HSM parameters pki_hsm_enable=True pki_hsm_libfile= pki_hsm_modulename= pki_token_name= pki_token_password= # Provide PKI-specific HSM token names pki_audit_signing_token= pki_sslserver_token= pki_subsystem_token= [KRA] # Provide KRA-specific HSM token names pki_storage_token= pki_transport_token= .fi .RE .PP To install a shared OCSP in the same instance used by the CA execute the following command: .PP .RS .nf $ pkispawn -s OCSP -f myconfig.txt .fi .RE .PP where \fBmyconfig.txt\fP contains the following text: .PP .RS .nf [DEFAULT] pki_admin_password=Secret.123 pki_client_database_password=Secret.123 pki_client_pkcs12_password=Secret.123 pki_ds_password=Secret.123 pki_security_domain_password=Secret.123 # Provide HSM parameters pki_hsm_enable=True pki_hsm_libfile= pki_hsm_modulename= pki_token_name= pki_token_password= # Provide PKI-specific HSM token names pki_audit_signing_token= pki_sslserver_token= pki_subsystem_token= [OCSP] # Provide OCSP-specific HSM token names pki_ocsp_signing_token= .fi .RE .PP To install a shared TKS in the same instance used by the CA execute the following command: .PP .RS .nf $ pkispawn -s TKS -f myconfig.txt .fi .RE .PP where \fBmyconfig.txt\fP contains the following text: .PP .RS .nf [DEFAULT] pki_admin_password=Secret.123 pki_client_database_password=Secret.123 pki_client_pkcs12_password=Secret.123 pki_ds_password=Secret.123 pki_security_domain_password=Secret.123 # Provide HSM parameters pki_hsm_enable=True pki_hsm_libfile= pki_hsm_modulename= pki_token_name= pki_token_password= # Provide PKI-specific HSM token names pki_audit_signing_token= pki_sslserver_token= pki_subsystem_token= .fi .RE .PP To install a shared TPS in the same instance used by the CA execute the following command: .PP .RS .nf $ pkispawn -s TPS -f myconfig.txt .fi .RE .PP where \fBmyconfig.txt\fP contains the following text: .PP .RS .nf [DEFAULT] pki_admin_password=Secret.123 pki_client_database_password=Secret.123 pki_client_pkcs12_password=Secret.123 pki_ds_password=Secret.123 pki_security_domain_password=Secret.123 # Provide HSM parameters pki_hsm_enable=True pki_hsm_libfile= pki_hsm_modulename= pki_token_name= pki_token_password= # Provide PKI-specific HSM token names pki_audit_signing_token= pki_sslserver_token= pki_subsystem_token= [TPS] # Shared TPS instances optionally utilize their shared KRA # for server-side keygen pki_enable_server_side_keygen=True pki_authdb_basedn=dc=example,dc=com .fi .RE .PP \fBImportant:\fP Since HSM keys are stored in the HSM, they cannot be backed up, moved, or copied to a PKCS #12 file. For example, if \fBpki_hsm_enable\fP is set to \fBTrue\fP, \fBpki_backup_keys\fP should be set to \fBFalse\fP and \fBpki_backup_password\fP should be left unset (the default values in /usr/share/pki/server/etc/default.cfg). Similarly, for the case of clones using an HSM, this means that the HSM keys must be shared between the master and its clones. Therefore, if \fBpki_hsm_enable\fP is set to True, both \fBpki_clone_pkcs12_path\fP and \fBpki_clone_pkcs12_password\fP should be left unset (the default values in /usr/share/pki/server/etc/default.cfg). Failure to comply with these rules will result in \fBpkispawn\fP reporting an appropriate error and exiting. .SS Installing CA Clone .PP To install a CA clone execute the following command: .PP .RS .nf $ pkispawn -s CA -f myconfig.txt .fi .RE .PP where \fBmyconfig.txt\fP contains the following text: .PP .RS .nf [DEFAULT] pki_admin_password=Secret.123 pki_client_database_password=Secret.123 pki_client_pkcs12_password=Secret.123 pki_ds_password=Secret.123 pki_security_domain_password=Secret.123 pki_security_domain_hostname= pki_security_domain_https_port= pki_security_domain_user=caadmin pki_security_domain_post_login_sleep_seconds=5 [Tomcat] pki_clone=True pki_clone_pkcs12_password=Secret.123 pki_clone_pkcs12_path= pki_clone_replicate_schema=True pki_clone_uri=https://: .fi .RE .PP A cloned CA is a CA which uses the same signing, OCSP signing, and audit signing certificates as the master CA, but issues certificates within a different serial number range. It has its own internal database -- separate from the master CA database -- but using the same base DN, that keeps in sync with the master CA through replication agreements between the databases. This is very useful for load sharing and disaster recovery. To create a clone, the \fBmyconfig.txt\fP uses pki\fIclone\fP* parameters in its [Tomcat] section which identify the original CA to use as a master template. Additionally, it connects to the master CA as a remote CA and uses its security domain. .PP Before the clone can be generated, the Directory Server must be created that is separate from the master CA's Directory Server. The example assumes that the master CA and cloned CA are on different machines, and that their Directory Servers are on port 389. .PP In addition, since this example does not utilize an HSM, the master's system certs and keys have been stored in a PKCS #12 file that is copied over to the clone subsystem in the location specified in . This file needs to be readable by the user the Certificate Server runs as (by default, pkiuser) and be given the SELinux context \fBpki_tomcat_cert_t\fP\&. .PP The master's system certificates can be exported to a PKCS#12 file when the master is installed if the parameter \fBpki_backup_keys\fP is set to \fBTrue\fP and the \fBpki_backup_password\fP is set. The PKCS#12 file is then found under /var/lib/pki//alias. Alternatively, the PKCS#12 file can be generated at any time post-installation using \fBPKCS12Export\fP\&. .PP The \fBpki_security_domain_post_login_sleep_seconds\fP config specifies sleep duration after logging into a security domain, to allow the security domain session data to be replicated to subsystems on other hosts. It is optional and defaults to 5 seconds. .PP An example invocation showing the export of the system certificates and keys, copying the keys to the replica subsystem, and setting the relevant SELinux and file permissions is shown below. \fBpwfile\fP is a text file containing the password for the masters NSS DB (found in /etc/pki/\fIinstance_name\fP/password.conf). \fBpkcs12_password_file\fP is a text file containing the password selected for the generated PKCS12 file. .PP .RS .nf master# PKCS12Export -d /etc/pki/pki-tomcat/alias -p pwfile \\ -w pkcs12_password_file -o backup_keys.p12 master# scp backup_keys.p12 clone:/backup_keys.p12 clone# chown pkiuser: /backup_keys.p12 clone# semanage -a -t pki_tomcat_cert_t /backup_keys.p12 .fi .RE .PP \fBNote:\fP From Dogtag 10.3, a slightly different mechanism has been provided to create and specify the required PKCS#12 file to the clone subsystem. This new method is provided in addition to the method above, but will become the preferred method in future releases. .PP This method can be used if both master and clone are 10.3 or above. .PP To export the required keys from the master, use the \fBpki-server\fP command line tool. .PP .RS .nf master# pki-server ca-clone-prepare -i pki-tomcat \\ --pkcs12-file backup_keys.p12 \\ --pkcs12-password Secret123 master# scp backup_keys.p12 clone:/backup_keys.p12 master# scp /etc/pki/pki-tomcat/external_certs.conf \\ clone:/external_certs.conf .fi .RE .PP The \fBexternal_certs.conf\fP file contains information about third party certificates that were added to the master's certificate database using the \fBpki-server\fP command. The certificates themselves are stored in the backup_keys.p12 file. If there are no third-party certifcates that have been added, then the \fBexternal_certs.conf\fP file may not exist and should be ignored. .PP The two files (\fBbackup_keys.p12\fP and \fBexternal_certs.conf\fP) are specified to pkispawn as below. .PP .RS .nf [DEFAULT] pki_admin_password=Secret.123 pki_client_database_password=Secret.123 pki_client_pkcs12_password=Secret.123 pki_ds_password=Secret.123 pki_security_domain_password=Secret.123 pki_security_domain_hostname= pki_security_domain_https_port= pki_security_domain_user=caadmin [Tomcat] pki_server_pkcs12_path= pki_server_pkcs12_password=Secret.123 pki_server_external_certs_path= pki_clone=True pki_clone_replicate_schema=True pki_clone_uri=https://: .fi .RE .PP Note that the previous p12 parameters (pki_clone\fIpkcs12\fP*) are no longer needed, and will be ignored. .PP \fBNote:\fP One current cloning anomaly to mention is the following scenario: .RS .IP " 1." 5 Create a clone of a CA or of any other subsystem. .IP " 2." 5 Remove that just created clone. .IP " 3." 5 Immediately attempt the exact same clone again, in place of the recently destroyed instance. Before recreating this clone, make sure the \fBpki_ds_remove_data=True\fP is used in the clone's deployment config file. This will remove the old data from the previous clone. .RE .PP Here the Director Server instance may have worked itself in into a state where it no longer accepts connections, aborting the clone configuration quickly. .PP The fix to this is to simply restart the Directory Server instance before creating the clone for the second time. After restarting the Directory Server it should be possible to create the mentioned clone instance. .SS Installing KRA or TKS Clone .PP To install a KRA or TKS (OCSP and TPS unsupported as of now) execute the following command: .PP .RS .nf $ pkispawn -s -f myconfig.txt .fi .RE .PP where subsystem is KRA or TKS and \fBmyconfig.txt\fP contains the following text: .PP .RS .nf [DEFAULT] pki_admin_password=Secret.123 pki_client_database_password=Secret.123 pki_client_pkcs12_password=Secret.123 pki_ds_password=Secret.123 pki_security_domain_password=Secret.123 pki_security_domain_hostname= pki_security_domain_https_port= pki_security_domain_user=caadmin [Tomcat] pki_clone=True pki_clone_pkcs12_password=Secret.123 pki_clone_pkcs12_path= pki_clone_replicate_schema=True pki_clone_uri=https://: pki_issuing_ca=https://: .fi .RE .PP As with a CA clone, a KRA or TKS clone uses the same certificates and basic configuration as the original subsystem. The configuration points to the original subsystem to copy its configuration. This example also assumes that the CA is on a remote machine and specifies the CA and security domain information. .PP The parameter \fBpki_clone_uri\fP should be modified to point to the required master (KRA or TKS). .PP As of 10.3, a slightly different mechanism has been introduced to generate and specify the PKCS#12 file and any third-party certificates. See the \fBInstalling CA Clone\fP section for details. .SS Installing CA Clone on the Same Host .PP For testing purposes, it is useful to configure cloned CAs which exist (with their internal databases) on the same host as the master CA. To configure the cloned CA execute the following command: .PP .RS .nf $ pkispawn -s CA -f myconfig.txt .fi .RE .PP where \fBmyconfig.txt\fP contains the following text: .PP .RS .nf [DEFAULT] pki_admin_password=Secret123 pki_client_database_password=Secret123 pki_client_pkcs12_password=Secret123 pki_ds_password=Secret123 pki_ds_ldap_port= pki_ds_ldaps_port= pki_http_port= pki_https_port= pki_instance_name= pki_security_domain_hostname= pki_security_domain_https_port= pki_security_domain_password=Secret123 [Tomcat] pki_ajp_port= pki_clone=True pki_clone_pkcs12_password=Secret123 pki_clone_pkcs12_path= pki_clone_uri=https://: pki_tomcat_server_port= [CA] pki_ds_base_dn= pki_ds_database= .fi .RE .PP In this case, because both CA Tomcat instances are on the same host, they must have distinct ports. Similarly, each CA must use a distinct directory server instance for its internal database. Like the Tomcat instances, these are distinguished by distinct ports. The suffix being replicated (\fBpki_ds_base\fP), however, must be the same for both master and clone. .SS Installing Subordinate CA in Existing Security Domain .PP To install a subordinate CA in an existing security domain execute the following command: .PP .RS .nf $ pkispawn -s CA -f myconfig.txt .fi .RE .PP where \fBmyconfig.txt\fP contains the following text: .PP .RS .nf [DEFAULT] pki_admin_password=Secret.123 pki_client_database_password=Secret.123 pki_client_pkcs12_password=Secret.123 pki_ds_password=Secret.123 pki_security_domain_password=Secret.123 pki_security_domain_hostname= pki_security_domain_https_port= pki_security_domain_user=caadmin [CA] pki_subordinate=True pki_issuing_ca=https://: pki_ca_signing_subject_dn=cn=CA Subordinate Signing,o=example.com .fi .RE .PP A sub-CA derives its certificate configuration -- such as allowed extensions and validity periods -- from a superior or root CA. Otherwise, the configuration of the CA is independent of the root CA, so it is its own instance rather than a clone. A sub-CA is configured using the \fBpki_subordinate\fP parameter and a pointer to the CA which issues the sub-CA's certificates. .PP \fBNote:\fP The value of \fBpki_ca_signing_subject_dn\fP of a subordinate CA should be different from the root CA's signing subject DN. .SS Installing Subordinate CA in New Security Domain .PP To install a subordinate CA in a new security domain execute the following command: .PP .RS .nf $ pkispawn -s CA -f myconfig.txt .fi .RE .PP where \fBmyconfig.txt\fP contains the following text: .PP .RS .nf [DEFAULT] pki_admin_password=Secret.123 pki_client_database_password=Secret.123 pki_client_pkcs12_password=Secret.123 pki_ds_password=Secret.123 pki_security_domain_password=Secret.123 pki_security_domain_hostname= pki_security_domain_https_port= pki_security_domain_user=caadmin [CA] pki_subordinate=True pki_issuing_ca=https://: pki_ca_signing_subject_dn=cn=CA Subordinate Signing,o=example.com pki_subordinate_create_new_security_domain=True pki_subordinate_security_domain_name=Subordinate CA Security Domain .fi .RE .PP In this section, the subordinate CA logs onto and registers with the security domain CA (using parameters \fBpki_security_domain_hostname\fP, \fBpki_security_domain_user\fP and \fBpki_security_domain_password\fP) as in the previous section, but also creates and hosts a new security domain. To do this, \fBpki_subordinate_create_new_security_domain\fP must be set to \fBTrue\fP\&. The subordinate CA security domain name can also be specified by specifying a value for \fBpki_subordinate_security_domain_name\fP\&. .PP \fBNote:\fP The value of \fBpki_ca_signing_subject_dn\fP of a subordinate CA should be different from the root CA's signing subject DN. .SS Installing Externally-Signed CA .PP To install an externally signed CA execute the following command: .PP .RS .nf $ pkispawn -s CA -f myconfig.txt .fi .RE .PP This is a two-step process. .PP In the first step, a certificate signing request (CSR) is generated for the signing certificate and \fBmyconfig.txt\fP contains the following text: .PP .RS .nf [DEFAULT] pki_admin_password=Secret.123 pki_client_database_password=Secret.123 pki_client_pkcs12_password=Secret.123 pki_ds_password=Secret.123 pki_security_domain_password=Secret.123 [CA] pki_external=True pki_ca_signing_csr_path=/tmp/ca_signing.csr pki_ca_signing_subject_dn=cn=CA Signing,ou=External,o=example.com .fi .RE .PP The CSR is written to \fBpki_ca_signing_csr_path\fP\&. The \fBpki_ca_signing_subject_dn\fP should be different from the subject DN of the external CA that is signing the request. The \fBpki_ca_signing_subject_dn\fP parameter can be used to specify the signing certificate's subject DN. .PP The CSR is then submitted to the external CA, and the resulting certificate and certificate chain are saved to files on the system. .PP In the second step, the configuration file has been modified to install the issued certificates. In place of the original CSR, the configuration file now points to the issued CA certificate and certificate chain. There is also a flag to indicate that this completes the installation process (\fBpki_external_step_two\fP). .PP .RS .nf [DEFAULT] pki_admin_password=Secret.123 pki_client_database_password=Secret.123 pki_client_pkcs12_password=Secret.123 pki_ds_password=Secret.123 pki_security_domain_password=Secret.123 [CA] pki_external=True pki_external_step_two=True pki_cert_chain_path=/tmp/ca_cert_chain.cert pki_ca_signing_cert_path=/tmp/ca_signing.cert pki_ca_signing_subject_dn=cn=CA Signing Certificate,ou=External,o=example.com .fi .RE .PP Then, the \fBpkispawn\fP command is run again: .PP .RS .nf $ pkispawn -s CA -f myconfig.txt .fi .RE .SS Installing PKI Subsystem with Secure LDAP Connection .PP There are three scenarios in which a PKI subsystem (e.g. a CA) needs to communicate securely via LDAPS with a directory server: .PP \fBScenario 1:\fP A directory server exists which is already running LDAPS using a CA certificate that has been issued by some other CA. For this scenario, the CA certificate must be made available via a PEM file (e.g. $HOME/dscacert.pem) prior to running \fBpkispawn\fP such that the new CA may be installed and configured to communicate with this directory server using LDAPS. .PP \fBScenario 2:\fP A directory server exists which is currently running LDAP. Once a CA has been created, there is a desire to use its CA certificate to issue an SSL certificate for this directory server so that this CA and this directory server can communicate via LDAPS. For this scenario, since there is no need to communicate securely during the \fBpkispawn\fP installation/configuration, simply use \fBpkispawn\fP to install and configure the CA using the LDAP port of the directory server, issue an SSL certificate from this CA for the directory server, and then reconfigure the CA and directory server to communicate with each other via LDAPS. .PP \fBScenario 3:\fP Similar to the previous scenario, a directory server exists which is currently running LDAP, and the desire is to create a CA and use it to establish LDAPS communications between this CA and this directory server. However, for this scenario, there is a need for the CA and the directory server to communicate securely during \fBpkispawn\fP installation and configuration. For this to succeed, the directory server must generate a temporary self-signed certificate which then must be made available via a PEM file (e.g. $HOME/dscacert.pem) prior to running \fBpkispawn\fP\&. Once the CA has been created, swap things out to reconfigure the CA and directory server to utilize LDAPS through the desired certificates. .PP Set up a Directory Server instance with a self-signed CA certificate (see \fBdscreate(8)\fP), then export the certificate into a PEM file .PP Once the self-signed CA certificate is obtained, add the following parameters into the [DEFAULT] section in \fBmyconfig.txt\fP: .PP .RS .nf pki_ds_secure_connection=True pki_ds_secure_connection_ca_pem_file=$HOME/dscacert.pem .fi .RE .PP Then execute \fBpkispawn\fP to create the CA subsystem. .SS Managing PKI instance .PP To start a PKI instance named : .PP .RS .nf $ systemctl start pki-tomcatd@.service .fi .RE .PP To stop a PKI instance named : .PP .RS .nf $ systemctl stop pki-tomcatd@.service .fi .RE .PP To restart a PKI instance named : .PP .RS .nf $ systemctl restart pki-tomcatd@.service .fi .RE .PP To obtain the status of a PKI instance named : .PP .RS .nf $ systemctl status pki-tomcatd@.service .fi .RE .PP To obtain a detailed status of a Tomcat PKI instance named : .PP .RS .nf $ pki-server status .fi .RE .PP To list all available PKI instances installed on a system: .PP .RS .nf $ pki-server instance-find .fi .RE .SH SEE ALSO .PP \fBpkidestroy(8)\fP .br \fBpki_default.cfg(5)\fP .br \fBpki(1)\fP .br \fBdscreate(8)\fP .SH AUTHORS .PP Ade Lee and Dinesh Prasanth M K .SH COPYRIGHT .PP Copyright (c) 2020 Red Hat, Inc. This is licensed under the GNU General Public License, version 2 (GPLv2). A copy of this license is available at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.