Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
13.8. Backing up and Restoring Certificate System
Certificate System does not include backup and restore tools. However, the Certificate System components can still be archived and restored manually, which can be necessary for deployments where information cannot be accessed if certificate or key information is lost. Three major parts of Certificate System need to be backed up routinely in case of data loss or hardware failure:
- Internal database. Subsystems use an LDAP database to store their data. The Directory Server provides its own backup scripts and procedures.
- Security databases. The security databases store the certificate and key material. If these are stored on an HSM, then consult the HSM vendor documentation for information on how to back up the data. If the information is stored in the default directories in the instance
alias
directory, then it is backed up with the instance directory. To back it up separately, use a utility such astar
orzip
. - Instance directory. The instance directory contains all configuration files, security databases, and other instance files. This can be backed up using a utility such as
tar
orzip
.
13.8.1. Backing up and Restoring the LDAP Internal Database Link kopierenLink in die Zwischenablage kopiert!
Link kopierenLink in die Zwischenablage kopiert!
The Red Hat Directory Server documentation contains more detailed information on backing up and restoring the databases.
13.8.1.1. Backing up the LDAP Internal Database Link kopierenLink in die Zwischenablage kopiert!
Link kopierenLink in die Zwischenablage kopiert!
Two pairs of tools are available to back up the Directory Server instance; each back-up tool has a counterpart to restore the files it generated:
- The
db2ldif
tool creates a LDIF file you can restore using theldif2db
tool. - The
db2bak
command creates a backup file you can restore using thebak2db
tool.
13.8.1.1.1. Backing up using db2ldif Link kopierenLink in die Zwischenablage kopiert!
Link kopierenLink in die Zwischenablage kopiert!
Running the
db2ldif
command backs up a single subsystem database as specified by the -n
option.
Note
As the
db2ldif
command runs with the dirsrv user, it doesn't have permissions to write under the /root/
directory, so you need to provide a path where it can write.
- Back up each Directory Server database used by PKI subsystems. You can use the
pki-server ca-db-config-show
command to check the database name for a given subsystem.For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - In addition to backing up all individual subsytem databases, you can back up the main database by adding
userRoot
as-n
option. For example:db2ldif -V -n userRoot -a /var/lib/dirsrv/slapd-pki1/ldif/userRoot.ldif
# db2ldif -V -n userRoot -a /var/lib/dirsrv/slapd-pki1/ldif/userRoot.ldif
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
To restore the LDIF file using the
ldif2db
, see Section 13.8.1.2.1, “Restoring using ldif2db”.
13.8.1.1.2. Backing up using db2bak Link kopierenLink in die Zwischenablage kopiert!
Link kopierenLink in die Zwischenablage kopiert!
Running the
db2bak
command backs up all Certificate System subsystem databases for that Directory Server (and any other databases maintained by that Directory Server instance).
For example:
db2bak
# db2bak
Back up directory: /var/lib/dirsrv/slapd-pki1/bak/pki1-2020_11_05_11_20_21
Note
As the
db2bak
command runs with the dirsrv user, the target directory must be writeable by dirsrv. Running the command without any argument creates the backup in the /var/lib/dirsrv/slapd-<instance_name>/bak
folder where db2bak
has the proper write permissions.
To restore the LDIF file using
bak2db
, see Section 13.8.1.2.2, “Restoring using bak2db”.
13.8.1.2. Restoring the LDAP Internal Database Link kopierenLink in die Zwischenablage kopiert!
Link kopierenLink in die Zwischenablage kopiert!
Depending on how you backed up the Directory Server instance, use
ldif2db
or bak2db
with the corresponding file(s) to restore the database.
Note
Make sure you stop the instance before restoring databases.
13.8.1.2.1. Restoring using ldif2db Link kopierenLink in die Zwischenablage kopiert!
Link kopierenLink in die Zwischenablage kopiert!
If you created a LDIF file with
db2ldif
, stop the Directory Server instance and import the files using the ldif2db
command. You can specify a single database to restore from the backup. For example:
- Stop the Directory Server instance:
systemctl stop dirsrv@instance_name
# systemctl stop dirsrv@instance_name
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Import the file specified by the
-i
option for the subsystem specified by the-n
option:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Start the Directory Server instance:
systemctl start dirsrv@instance_name
# systemctl start dirsrv@instance_name
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
13.8.1.2.2. Restoring using bak2db Link kopierenLink in die Zwischenablage kopiert!
Link kopierenLink in die Zwischenablage kopiert!
If you created a backup file with
db2bak
, stop the Directory Server and import the file using the bak2db
command; you can specify a single database to restore from the backup. For example:
- Stop the Directory Server instance:
systemctl stop dirsrv@instance_name
# systemctl stop dirsrv@instance_name
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Import the file for the subsystem specified by the
-n
option:Copy to Clipboard Copied! Toggle word wrap Toggle overflow You can also restore the complete database from the backup using the command without the-n
option. For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Start the Directory Server instance:
systemctl start dirsrv@instance_name
# systemctl start dirsrv@instance_name
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
13.8.2. Backing up and Restoring the Instance Directory Link kopierenLink in die Zwischenablage kopiert!
Link kopierenLink in die Zwischenablage kopiert!
The instance directory has all of the configuration information for the subsystem instance, so backing up the instance directory preserves the configuration information not contained in the internal database.
Note
Stop the subsystem instance before backing up the instance or the security databases.
- Stop the subsystem instance.
systemctl stop pki-tomcatd@instance_name.service
systemctl stop pki-tomcatd@instance_name.service
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Save the directory to a compressed file:
cd /var/lib/pki/ tar -chvf /export/archives/pki/instance_name.tar instance_name/
# cd /var/lib/pki/ # tar -chvf /export/archives/pki/instance_name.tar instance_name/
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Restart the subsystem instance.
systemctl start instance_name
systemctl start instance_name
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
You can use the Certificate System backup files, both the
alias
database backups and the full instance directory backups, to replace the current directories if the data is corrupted or the hardware is damaged. To restore the data, uncompress the archive file using the unzip
or tar
tools, and copy the archive over the existing files.
To restore the instance directory:
- Uncompress the archive:
cd /export/archives/pki/ tar -xvf instance_name.tar
cd /export/archives/pki/ tar -xvf instance_name.tar
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Stop the subsystem instance if it is not already stopped.
systemctl stop pki-tomcatd@instance_name.service
systemctl stop pki-tomcatd@instance_name.service
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Copy the archived files to restore the instance directory:
cp -r /export/archives/pki/instance_name /var/lib/pki/instance_name
cp -r /export/archives/pki/instance_name /var/lib/pki/instance_name
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For example:cp -r /tmp/pki-tomcat/ca/ /var/lib/pki/pki-tomcat/ca/
# cp -r /tmp/pki-tomcat/ca/ /var/lib/pki/pki-tomcat/ca/
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Restart the subsystem instance.
systemctl start pki-tomcatd@instance_name.service
systemctl start pki-tomcatd@instance_name.service
Copy to Clipboard Copied! Toggle word wrap Toggle overflow