How To Remotely Download ClearPass Configuration Backups Using Curl
Introduction : Being able to automate backups and backup storage is critical to proper system administration. This article will explain how curl can be used to remotely download ClearPass backups allowing easy automation on a third party server using cron jobs.
Environment : ClearPass 6+
Note that future versions may change the login/download URLs.
This method will be utilizing the curl utility to remotely download ClearPass backups. Other tools such as wget will also work but require a different syntax.
A brief explanation of the flags used in the following commands:
-k = ignore certificate warnings, useful for self-signed certificate servers
-c = create a cookie jar to store cookies created by this request
-d = post data to requested page
-b = use a cookie jar's cookies when making this request
--output = save output from request to specified file
The first command will login to ClearPass and save the session cookie to the /tmp/cjar file. The second command will use the cookie from the first command to request an automated backup file be saved to /tmp/cppm_backup.tar.gz.
[root@localhost mercury]# curl -k -c /tmp/cjar -d "username=admin" -d "password=eTIPS123" https://10.162.117.20/tips/tipsLoginSubmit.action
[root@localhost mercury]# curl -k -b /tmp/cjar --output /tmp/cppm_backup.tar.gz https://10.162.117.20/tips/tipsExport.action?type=SharedFile_AutoBackup\&contextData=auto-backup-tips-2013-08-16-01-10-01.tar.gz
Note that the filename specified in the second command "auto-backup-tips-2013-08-16-01-10-01.tar.gz" will need to be changed to your current timestamp. For automation the use of the Linux date command is capable of producing this same timestamp format.