top of page

Since Check Point got rid of their web virtualization tool, we wanted to use the API show package tool to generate a copy of the policy and ftp it off to the customer's site. 

Actual script: generate_policy.sh

#! /bin/bash -f

source /opt/CPshrd-R80.30/tmp/.CPprofile.sh

# Vars
POLICY=show_package-`date +"%Y-%m-%d"`_*.tar.gz

# Generate policy file
/bin/sh /opt/CPsuite-R80.30/fw1/scripts/web_api_show_package.sh -d <CMA's IP> -o /var/tmp/<dir_name>
cd /var/tmp/<dir_name>

# SFTP policy
export SSHPASS=<remote ftp server password>
sshpass -e sftp -oBatchMode=no -b - <user@server_name> << !
   cd /<remote FTP dir>
   put ${POLICY}
   bye
!


# Clean up policy
# rm /var/tmp/<dir_name>/${policy}

 

In order to automate the process, we need to create a cronjob 

crontab -u admin -e

 

#  This file was AUTOMATICALLY GENERATED

#  Generated by /bin/cron_xlate on Thu Nov 21 19:58:48 2019

#

#  DO NOT EDIT

#

SHELL=/bin/bash

MAILTO=""

#

# mins  hrs     daysinm months  daysinw command

#

0 4 * * * /home/admin/generate_policy.sh >/dev/null 2>&1  ##<< run this job at 4am daily

bottom of page