This Python script automates the execution of CyberArk's PAReplicate.exe utility and securely emails the log file (PAReplicate.log) as a zipped and password-protected attachment.
This script streamlines the process of running CyberArk backups using PAReplicate.exe and ensures the secure handling of log files. It performs the following actions:
- Executes PAReplicate.exe: Runs the
PAReplicate.exeutility with specified configurations for backups. - Manages Log Files: Handles the
PAReplicate.logfile, including moving and appending content to maintain a history of backups. - Zips and Password-Protects: Compresses the log file into a ZIP archive and protects it with a password for security.
- Emails the Log: Sends an email with the zipped log file as an attachment to a designated recipient.
- Python 3.12.x: This script is compatible with Python 3.12.x.
- CyberArk 14.x: This script supports CyberArk version 14.x.
- 7-Zip: You need 7-Zip installed and accessible via the command line (
7z.exe). - Email Credentials: Ensure you have the necessary email credentials (sender address, password, SMTP server details) to send the email.
- PAReplicate.exe: You need access to the
PAReplicate.exefile in your CyberArk installation directory.
-
Configuration:
- Update Paths: Modify the script to reflect the correct paths for your CyberArk installation and 7-Zip.
- SMTP Settings: Update the
SMTP_SERVER,sender_email,sender_password, andreceiver_emailvariables with your email configuration. - Password: Set a strong password for the ZIP archive by replacing
"StrongPassword123!"in theos.system()command.
-
Placement: Place the
PAReplicate-new.pyscript in theC:\Scriptsfolder (or adjust the path accordingly). -
Execution: Open a command prompt, navigate to the script directory, and run:
python PAReplicate-new.py