- Products
- Learn
- Local User Groups
- Partners
- More
Check Point Jump-Start Online Training
Now Available on CheckMates for Beginners!
Why do Hackers Love IoT Devices so Much?
Join our TechTalk on Aug 17, at 5PM CET | 11AM EST
Welcome to Maestro Masters!
Talk to Masters, Engage with Masters, Be a Maestro Master!
ZTNA Buyer’s Guide
Zero Trust essentials for your most valuable assets
The SMB Cyber Master
Boost your knowledge on Quantum Spark SMB gateways!
As YOU DESERVE THE BEST SECURITY
Upgrade to our latest GA Jumbo
CheckFlix!
All Videos In One Space
Hello everyone, I encountered a problem when using the API here. I hope to get help.
I call the API command in the gateway's Clish, and use mgmt login user (user_name) password (password) ip-address (address) in clish. But I add it to the script and use clish -c "mgmt login ip- address 192.168.10.252 user admin password ***" After running the script, I found that the login was not successful, and no error message was found in the message log file. Does any friend encounter this kind of problem?
Add this to the top of your script: source /opt/CPshrd-R80.40/tmp/.CPprofile.sh
(Replace R80.40 with your version)
This will add mgmt_cli to the path so you can include it in your scripts.
I've never seen anyone call it that way before (i.e. using clish -c in a script).
Why aren't you using mgmt_cli instead, which can be called from a script?
i know, but mgmt_cli Cannot be used in scheduled tasks
Add this to the top of your script: source /opt/CPshrd-R80.40/tmp/.CPprofile.sh
(Replace R80.40 with your version)
This will add mgmt_cli to the path so you can include it in your scripts.
OK, thank you very much, I will try
I tried the method you said, adding at the top of bash:
source /opt/CPshrd-R81.10/tmp/.CPprofile.sh
I did not see the execution process in the message log file, but I saw the execution log in the Audit log.
Thank you for your answer
clish -c "...." is a single CLISH command called from bash. API calls will not work like that. To use API from bash and for scripts, do mgmt_cli, as @PhoneBoy already said.
I need to make this action into a scheduled task. I tried to replace clish -c "mgmt" with mgmt_cli, but mgmt_cli will not be executed in the scheduled task
I use many scripts through the schedulers to run many Check Point tasks and it works well. Your problem is your CP environment is not loaded (Ex: $FWDIR, $PCDIR, etc. are missing) when you execute a CP program through your script. Add this line ". /etc/bashrc" (valid if you are running GAIA) in the top of your script. Example:
#!/bin/bash
. /etc/bashrc # Load the Check Point environment if a GAIA (DOT space must be at the beginning of the line)
:
The rest of your script here
If my script is running on a SMB (ex 1400, 1500, etc.), I use: . /pfrm2.0/etc/bashrc
About CheckMates
Learn Check Point
Advanced Learning
YOU DESERVE THE BEST SECURITY