Hi
I am trying to run this script on my SMS expert mode:
#!/bin/bash
#vriables for login
LOGIN="cpadmin"
PASSWORD="Chkp!234"
# Clear screen
clear
# Prompt for username if LOGIN is undefined
if [ -z "$LOGIN" ]; then
read -p "Please enter your username and press Enter: " LOGIN
fi
# Prompt for password if PASSWORD is undefined
if [ -z "$PASSWORD" ]; then
read -s -p "Password: " PASSWORD
fi
echo
# Login to the API server and save session to file id.txt
mgmt_cli login user "$LOGIN" password "$PASSWORD" > id.txt
# Check if login was successful
if [ $? -ne 0 ]; then
echo "Login failed."
cat id.txt
exit 1
fi
# Create network objects
echo "Creating network objects"
mgmt_cli -s id.txt add network name "A-MGMT-NET" subnet "10.1.1.0" subnet-mask "255.255.255.0" comments "Management" set-if-exists true ignore-warnings true
mgmt_cli -s id.txt add network name "A-DMZ-NET" subnet "192.168.12.0" subnet-mask "255.255.255.0" comments "DMZ" set-if-exists true ignore-warnings true
mgmt_cli -s id.txt add network name "A-INT-NET" subnet "192.168.11.0" subnet-mask "255.255.255.0" comments "Internal" set-if-exists true ignore-warnings true
mgmt_cli -s id.txt add network name "A-WIFI-NET" subnet "192.168.13.0" subnet-mask "255.255.255.0" comments "WiFi" set-if-exists true ignore-warnings true
# Logout
mgmt_cli -s id.txt logout
echo "Script execution completed."
I am getting this error:
Login failed.
code: "err_login_failed"
message: "Authentication to server failed."
if I try to login from expert mode only with this command:
mgmt_cli login user admin password CPL@b8110
I get this:
[Expert@CPSMS:0]# mgmt_cli login user admin password CPL@b8110
uid: "ba1910a5-ab62-4eff-88d5-18fbabf73808"
sid: "SF_3IDzUm3KtLI_pksoPSliBVxkXCQ4N9SZAIz5MEAo"
url: "https://127.0.0.1:443/web_api"
session-timeout: 600
last-login-was-at:
posix: 1719657035894
iso-8601: "2024-06-29T12:30+0200"
api-server-version: "1.8"
user-name: "admin"
user-uid: "725333a3-ac40-46b5-8b44-ef17a83f8da3"
I have done what is in sk127572 but still have same problem!
Is there any way to run the script from Powershell?