Vault - How to restore a single safe from a cold backup taken with PAReplicate
Objective
These instructions are relevant to the following use case:
- PAReplicate is installed in the environment and replicating the vault DB to an external machine (a component server in many cases such as the CPM or PVWA.)
- The backed up/replicated data is backed up daily with a file-based backup software to an external "cold" storage such as SAN or NAS.
- The Idira administrator wants to restore a specific safe (or multiple safes) from an older date (i.e. not restore the latest replication data).
- These instructions are not relevant for PSM Recordings safes, for those consult the official documentation
The instructions below, are an interpretation of the official documentation found in the link below.
Before proceeding, review the following documentation to ensure the article applies to your use case.
https://docs.cyberark.com/Product-Doc/OnlineHelp/PAS/Latest/en/Content/PASIMP/Restoring-Safes-or-the-Vault.htm
Environment
Privileged Access Manager (PAM, self-hosted) Vault
Procedure
METHOD 1 - Use the PAReplicate server to upload and restore the safe
- In PrivateArk Client, locate the "Backup" user used in the credfile of PAReplicate (System/Backup by default), and provide it the "Restore All Safes" vault authorization.
Alternatively- enable the "Operator" user, and ensure it has the restore all safes vault authorization, reset it's password and create a credfile for it in the PAReplicate directory. - On the PAReplicate server (usually the CPM server), make a new folder at the root of the data drive:
X:\PARestore\Safes\
And in it make the following subfolders:
Data
Metadate
Temp - From the cold-storage, download the entire contents of the Metadata folder from the appropriate date/snapshot into the new Metadata folder (X:\PARestore\Safes\Metadata)
- From the cold-storage, download the safe's data folder from the appropriate date/snapshot into the new Data folder (X:\PARestore\Safes\Data\SafeName)
- Repeat step 4 for all the safe you'd like to restore from this same cold-storage dated backup. The safes data must be from the same snapshot the Metadata was taken. Do not mix and match.
- In the PAReplicate program folder, locate the tsparm.ini file and make a backup of it ( Default location - "C:\Program Files (x86)\PrivateArk\Replicate\tsparm.ini")
*Note - the tsparm.ini file must be reverted to the backed up version after the restoration is complete, and BEFORE the next scheduled backup job runs. - Open and edit the original tsparm.ini to point the SafesDirectory from the backup location X:\PrivateArk\Safes to the new restoration safes location X:\PARestore\Safes\
Save and close the file. - With the files and configuration in place, we are ready to issue the PARestore command in an elevated command prompt:
PARestore <VaultFile> <User> /RestoreSafe <Safe> /TargetSafe <TargetSafe>
Example command:
PARestore Vault.ini /logonfromfile backupuser.ini /RestoreSafe Original_Safe_Name /TargetSafe Restored_Safe_Name
*Note- A safe by the name of the safe being restored, must exist on the vault. If the safe being restored has been deleted, create a new blank safe by the same name and ensure the operator and backup users have the appropriate permissions on it. Please also ensure to apply the original user and group's permission to the new blank safe. - Optional- For multiple safes, repeat the command with for each safe adding the /DataOnly parameter, to avoid re-upload and re-apply the Metadata.
PARestore <VaultFile> <User> /RestoreSafe <Safe> /TargetSafe <TargetSafe> /DataOnly
Example command:
PARestore Vault.ini /logonfromfile backupuser.ini /RestoreSafe Original_Safe_Name2 /TargetSafe Restored_Safe_Name2 /DataOnly
For Example:
PARestore vault.ini /logonfromfile backupuser.ini /RestoreSafe demosafe /TargetSafe demosafe-restored
- Once the restoration is complete, revert tsparm.ini to its previous backed up version to point SafesDirectory back to X:\PrivateArk\Safes
- Cleanup and delete the X:\PARestore folder when its no longer needed
METHOD 2 - Upload files manually to the vault and use the /LoadOnly command
This method is less preferred than METOD 1 but could be a faster approach in cases where large amounts of data needs to be restored.
1. In PrivateArk Client, locate the "Backup" user used in the credfile of PAReplicate (System/Backup by default), and provide it the "Restore All Safes" vault authorization.
Alternatively, enable the "Operator" user, and ensure it has the restore all safes vault authorization, reset it's password and create a credfile for it in the PAReplicate directory.
2. From the NAS, first copy the relevant day's Metadata files to the vault's Restored Safes Metadata location:
X:\PrivateArk\Restored Safes\Metadata
*Note- Copy the contents of the entire Metadata folder
*Note- Copy the files to the specified folder above on the Vault server, not the server running PAReplicate
*Note- If restoring multiple safes from the same day, you only need to do this step once, as the entire metadata folder is being copied.
3. From the NAS, then copy the relevant day's safe data files, to the vault's Restored Safes Data location:
X:\PrivateArk\Restored Safes\Data\RestoredSafeName
*Note- Do not change the name of the safe at this point.
*Note- Copy the files to the specified folder above on the Vault server, not the server running PAReplicate
4. On the machine where PAReplicate is installed, run the load only restore command in an elevated command prompt:
PARestore <VaultFile> <User> /RestoreSafe <Safe> /TargetSafe <TargetSafe> /LoadOnly
*Note- A safe by the name of the safe being restored, must exist on the vault. If the safe being restored has been deleted, create a new blank safe by the same name and ensure the operator and backup users have the appropriate permissions on it. Please also ensure to apply the original user and group's permission to the new blank safe.
Optional - For multiple safes, repeat the command with for each safe.
For Example:
PARestore vault.ini /logonfromfile backupuser.ini /RestoreSafe demosafe /TargetSafe demosafe-restored /LoadOnly