Este conteúdo não está disponível no idioma selecionado.
Chapter 5. Preparing for data loss with IdM backups
IdM provides the ipa-backup utility to backup IdM data, and the ipa-restore utility to restore servers and data from those backups.
Red Hat recommends running backups as often as necessary on a hidden replica with all server roles installed, especially the Certificate Authority (CA) role if the environment uses the integrated IdM CA. See Installing an IdM hidden replica.
5.1. IdM backup types Copiar o linkLink copiado para a área de transferência!
With the ipa-backup utility, you can create two types of backups:
- Full-server backup
- Contains all server configuration files related to IdM, and LDAP data in LDAP Data Interchange Format (LDIF) files
- IdM services must be offline.
- Suitable for rebuilding an IdM deployment from scratch.
- Data-only backup
- Contains LDAP data in LDIF files and the replication changelog
- IdM services can be online or offline.
- Suitable for restoring IdM data to a state in the past
5.2. Naming conventions for IdM backup files Copiar o linkLink copiado para a área de transferência!
By default, IdM stores backups as .tar archives in subdirectories of the /var/lib/ipa/backup/ directory.
The archives and subdirectories follow these naming conventions:
- Full-server backup
An archive named
ipa-full.tarin a directory namedipa-full-<YEAR-MM-DD-HH-MM-SS>, with the time specified in GMT time.ll /var/lib/ipa/backup/ipa-full-2021-01-29-12-11-46
[root@server ~]# ll /var/lib/ipa/backup/ipa-full-2021-01-29-12-11-46 total 3056 -rw-r--r--. 1 root root 158 Jan 29 12:11 header -rw-r--r--. 1 root root 3121511 Jan 29 12:11 ipa-full.tarCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Data-only backup
An archive named
ipa-data.tarin a directory namedipa-data-<YEAR-MM-DD-HH-MM-SS>, with the time specified in GMT time.ll /var/lib/ipa/backup/ipa-data-2021-01-29-12-14-23
[root@server ~]# ll /var/lib/ipa/backup/ipa-data-2021-01-29-12-14-23 total 1072 -rw-r--r--. 1 root root 158 Jan 29 12:14 header -rw-r--r--. 1 root root 1090388 Jan 29 12:14 ipa-data.tarCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Uninstalling an IdM server does not automatically remove any backup files.
5.3. Considerations when creating a backup Copiar o linkLink copiado para a área de transferência!
The important behaviors and limitations of the ipa-backup command include the following:
-
By default, the
ipa-backuputility runs in offline mode, which stops all IdM services. The utility automatically restarts IdM services after the backup is finished. - A full-server backup must always run with IdM services offline, but a data-only backup can be performed with services online.
-
By default, the
ipa-backuputility creates backups on the file system containing the/var/lib/ipa/backup/directory. Red Hat recommends creating backups regularly on a file system separate from the production filesystem used by IdM, and archiving the backups to a fixed medium, such as tape or optical storage.
- Consider performing backups on hidden replicas. IdM services can be shut down on hidden replicas without affecting IdM clients.
Starting with RHEL 8.3.0, the
ipa-backuputility checks if all of the services used in your IdM cluster, such as a Certificate Authority (CA), Domain Name System (DNS), and Key Recovery Agent (KRA), are installed on the server where you are running the backup. If the server does not have all these services installed, theipa-backuputility exits with a warning, because backups taken on that host would not be sufficient for a full cluster restoration.For example, if your IdM deployment uses an integrated Certificate Authority (CA), a backup run on a non-CA replica will not capture CA data. Red Hat recommends verifying that the replica where you perform an
ipa-backuphas all of the IdM services used in the cluster installed.You can bypass the IdM server role check with the
ipa-backup --disable-role-checkcommand, but the resulting backup will not contain all the data necessary to restore IdM fully.
5.4. Creating an IdM backup Copiar o linkLink copiado para a área de transferência!
Create a full-server and data-only backup in offline and online modes using the ipa-backup command.
Prerequisites
-
You must have
rootprivileges to run theipa-backuputility.
Procedure
To create a full-server backup in offline mode, use the
ipa-backuputility without additional options.Copy to Clipboard Copied! Toggle word wrap Toggle overflow To create an offline data-only backup, specify the
--dataoption.ipa-backup --data
[root@server ~]# ipa-backup --dataCopy to Clipboard Copied! Toggle word wrap Toggle overflow To create a full-server backup that includes IdM log files, use the
--logsoption.ipa-backup --logs
[root@server ~]# ipa-backup --logsCopy to Clipboard Copied! Toggle word wrap Toggle overflow To create a data-only backup while IdM services are running, specify both
--dataand--onlineoptions.ipa-backup --data --online
[root@server ~]# ipa-backup --data --onlineCopy to Clipboard Copied! Toggle word wrap Toggle overflow
If the backup fails due to insufficient space in the /tmp directory, use the TMPDIR environment variable to change the destination for temporary files created by the backup process:
TMPDIR=/new/location ipa-backup
[root@server ~]# TMPDIR=/new/location ipa-backup
Verification
Ensure the backup directory contains an archive with the backup.
ls /var/lib/ipa/backup/ipa-full-2020-01-14-11-26-06
[root@server ~]# ls /var/lib/ipa/backup/ipa-full-2020-01-14-11-26-06 header ipa-full.tarCopy to Clipboard Copied! Toggle word wrap Toggle overflow
5.5. Creating a GPG2-encrypted IdM backup Copiar o linkLink copiado para a área de transferência!
You can create encrypted backups using GNU Privacy Guard (GPG) encryption. The following procedure creates an IdM backup and encrypts it using a GPG2 key.
Prerequisites
- You have created a GPG2 key. See Creating a GPG2 key.
Procedure
Create a GPG-encrypted backup by specifying the
--gpgoption.Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Ensure that the backup directory contains an encrypted archive with a
.gpgfile extension.ls /var/lib/ipa/backup/ipa-full-2020-01-13-14-38-00
[root@server ~]# ls /var/lib/ipa/backup/ipa-full-2020-01-13-14-38-00 header ipa-full.tar.gpgCopy to Clipboard Copied! Toggle word wrap Toggle overflow
5.6. Creating a GPG2 key Copiar o linkLink copiado para a área de transferência!
The following procedure describes how to generate a GPG2 key to use with encryption utilities.
Prerequisites
-
You need
rootprivileges.
Procedure
Install and configure the
pinentryutility.yum install pinentry mkdir ~/.gnupg -m 700 echo "pinentry-program /usr/bin/pinentry-curses" >> ~/.gnupg/gpg-agent.conf
[root@server ~]# yum install pinentry [root@server ~]# mkdir ~/.gnupg -m 700 [root@server ~]# echo "pinentry-program /usr/bin/pinentry-curses" >> ~/.gnupg/gpg-agent.confCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create a
key-inputfile used for generating a GPG keypair with your preferred details. For example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Optional: By default, GPG2 stores its keyring in the
~/.gnupgfile. To use a custom keyring location, set theGNUPGHOMEenvironment variable to a directory that is only accessible by root.export GNUPGHOME=/root/backup mkdir -p $GNUPGHOME -m 700
[root@server ~]# export GNUPGHOME=/root/backup [root@server ~]# mkdir -p $GNUPGHOME -m 700Copy to Clipboard Copied! Toggle word wrap Toggle overflow Generate a new GPG2 key based on the contents of the
key-inputfile.gpg2 --batch --gen-key key-input
[root@server ~]# gpg2 --batch --gen-key key-inputCopy to Clipboard Copied! Toggle word wrap Toggle overflow Enter a passphrase to protect the GPG2 key. You use this passphrase to access the private key for decryption.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Confirm the correct passphrase by entering it again.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify that the new GPG2 key was created successfully.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
List the GPG keys on the server.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow