Disaster Recovery
1. Overview
In the event of a disaster or data loss, you can restore backed up data to the Key Manager Plus database. Key Manager Plus allows you to schedule database backups from within the product, and provides scripts to restore the data.
2. Database Backup at Periodic Intervals
To schedule a database backup to a location in the system:
- Navigate to the Settings >> General Settings >> Database Backup tab.
- Enter the scheduled time for backup and the location where you would like the backup files and the email id to be notified.
- Indicate how many of the backups you would like to maintain in the specified location using the Maintain latest backups option.
- Click Save.
You will get a confirmation that the database backup settings have been updated.
Database backup actions are audited. To view the audit trails related to database backup, click the Backup audit icon available in the top-right corner of the screen.
3. Restoring the Data
Important Note:
- Stop Key Manager Plus server before trying to restore data. If restoration is done while the server is running, it may lead to data corruption.
- Data backed up from Key Manager Plus running on Windows can be restored only in Windows.
For Windows:
- Navigate to <KeyManagerPlus_Installation_Directory>/bin folder.
- Execute the script restoreDB.bat <backup file name> -p<Key path>(for build versions 5600 and above). Enter your backup file name in .ezip format. Note that the backup file and the pmp_key.key file should be located in the same folder under the same path inside the Key Manager Plus server.
- The backed up contents would be restored to the Key Manager Plus database.
- Navigate to <KeyManagerPlus_Installation_Folder>/conf folder, edit manage_key.conf and specify the location of pmp_key.key (AES 256 encryption master key). Key Manager Plus requires the pmp_key.key file accessible with its full path when it starts up every time. After a successful start-up, it does not need the key anymore and so the device with the key file can be taken offline.
For Linux:
- Navigate to <KeyManagerPlus_Installation_Directory>/bin folder.
- Execute the script sh restoreDB.sh <backup file name> -p<Key path>(for build versions 5600 and above). Enter your backup file name in .ezip format. Note that the backup file and the pmp_key.key file should be located in the same folder under the same path inside the Key Manager Plus server.
- The backed up contents would be restored to the Key Manager Plus database.
- Navigate to <KeyManagerPlus_Installation_Folder>/conf folder, edit manage_key.conf and specify the location of pmp_key.key (AES 256 encryption master key). Key Manager Plus requires the pmp_key.key file accessible with its full path when it starts up every time. After a successful start-up, it does not need the key anymore and so the device with the key file can be taken offline.
Note:
- If your build is of version 5510 or below, specifying the key path is not necessary when executing data restoration scripts in the restoreDB.bat (Windows) or restoreDB.sh (Linux) files.
- For Windows, execute the following script:
restoreDB.bat <backup file name> - For Linux, execute the following script:
sh restoreDB.sh <backup file name>
- For Windows, execute the following script:
- During restoration, make sure that the build version onto which data is being restored is of the same version from which the backup was taken. (For instance, if data backup was performed in build version 5600, make sure the new build onto which you are restoring the data is also of version 5600.)
- Also when specifying the location of the encryption master key in manage_key.conf file during restoration (point #4), make sure you correctly point to the location of the pmp_key.key file of that build from which the backup was taken.
4. Disaster Recovery Steps for Key Manager Plus with MS SQL Server
Prerequisite
Key Manager Plus uses SQL server's encryption mechanism to encrypt the data. The encryption master key will be stored under <Key Manager Plus Installation Folder/conf> directory with the name masterkey.key. For security reasons, during installation of MS SQL, we recommend moving the encryption key from the default location to a secure location. For performing disaster recovery, the master key is required.
Step 1:
Install another instance of Key Manager Plus. Follow the steps for using MS SQL server as the backend (specifying a new instance of MS SQL server where the backup has to be restored). The new instance of MS SQL server should have been configured with SSL. You can do this by carrying out Steps 1, 2, 3 in this document.
Step 2:
Copy the Key Manager Plus backup file from the SQL server. By default, it will be present under /Backup folder and have the name something like pmpbackup_pmpversion_backupdate-time.bak (For example, pmpbackup_6400_110721-1159.bak)
Step 3:
Launch Microsoft SQL Server Management Studio (in the machine where the backed up data are to be restored - that is, another instance of SQL server) and connect to the Database Engine.
Step 4:
Right-click on Databases and the click Restore Database from the displayed menu.
Step 5:
In the Restore Database window, choose the option From device and click [...] button to browse the Key Manager Plus backup file.
Step 6:
In the Specify Backup window that opens up, choose the option File as the Backup media and click Add.
Step 7:
In the Locate Backup File window, select the Key Manager Plus backup file and click OK.
Step 8:
- Now, in the Restore Database window, select the database where the backup is to be restored and specify it in the To database field.
- Under Select the backup sets to restore, select the required Restore column.
- Click OK to start the restoring the database.
- Upon completion of the restoration, a status window pops-up.
Step 9:
Now, you need to restore the Master Key. As mentioned in the prerequisite section above, by default, the encryption master key will be stored under <Key Manager Plus Installation Folder/conf> directory in the file named masterkey.key. For security reasons, if you have moved the file to some other secure location, identify that. Open the masterkey.key file and copy the password.
Step 10:
Connect to the SQL server in which you have restored the Key Manager Plus backup file. Open Microsoft SQL Server Management Studio and connect the database engine. Execute the following queries:
use write_the_name_of the restored_database;
OPEN MASTER KEY DECRYPTION BY PASSWORD = 'type_the_master_key_password';
alter master key regenerate with encryption by password = 'type_the_master_key_password';
Example:
use pki;
OPEN MASTER KEY DECRYPTION BY PASSWORD = 'secret';
alter master key regenerate with encryption by password = 'secret';
Execution of the above queries will help decrypt the data.
Step 11:
Navigate to <Key Manager Plus_Installation_Folder>/conf folder, edit manage_key.conf and specify the location of pmp_key.key (encryption master key). Key Manager Plus requires the pmp_key.key file accessible with its full path when it starts up every time. After a successful start-up, it does not need the key anymore and so the device with the key file can be taken offline.