- Products
- Learn
- Local User Groups
- Partners
- More
What’s New in Identity and Trust?
11 November @ 5pm CET / 11am EST
CPX is Back!
Join us in Las Vegas, Vienna, and/or Bangkok!
What’s New in Agentic Network Orchestration
AI Security Masters
LGTM: Bypassing an LLM Build Gate
When Prompt Injection Fails
CheckMates Go:
Fun Ding
Hello everyone!
Using the management web API v1.9 and the run-script route targetted at a VSX gateway, I am able to run a command like "vsx stat -l" to get the stats of the virtual systems running on the gateway.
My problem is that when I try to run the command "vsenv [vsid]" with the run-script route, I get the error message "vsenv command not found". Why would that be ?
I am trying to move inside of a vs to then run the "ifconfig -a" via the web API and this seems to be the only path I have found yet until official APIs for VSX are released as part of R82. I am using an API Key and an API User with elevated permission to authenticate with the API.
You need to sent the environment variables for the shell you are starting with run-script. this can be done by adding source /etc/bashrc ; before your command in the script value.
[Expert@sc:0]# mgmt_cli -r true -f json run-script script-name "test" script "source /etc/bashrc ; vsenv" targets.1 "sc"
Here is an example, ignore the fail as I am executing the command on a Security Management Server
[Expert@sc:0]# mgmt_cli -r true -f json run-script script-name "test" script "source /etc/bashrc ; vsenv" targets.1 "sc" | jq -r '.tasks[]."task-details"[].statusDescription'
---------------------------------------------
Time: [10:24:48] 15/12/2023
---------------------------------------------
"cpx-sc - test" failed (100%)
vsenv: This is only supported on a VSX machine.
Hi,
The mgmt_cli is just a client to send RESTful API requests as HTTP POST.
This is how the payload looks like that is sent to the Server.
Payload: {
"script" : "source /etc/bashrc ; vsenv",
"script-name":"test",
"targets":["sc"]
}
Hi,
Could put-file in combination with run-script be an option?
Cheers
Hi Vincent!
What difference would it make if I were to use put-file in combination with my run-script? I would pass the script in the put-file and then I would execute that script with run-script pointing at that script. I am not sure it would make a difference at the level where the command is executed ?
I have noticed that commands like mdsenv and vsenv do not work as such in bash scripts these days.
Need to look into that.
You need to sent the environment variables for the shell you are starting with run-script. this can be done by adding source /etc/bashrc ; before your command in the script value.
[Expert@sc:0]# mgmt_cli -r true -f json run-script script-name "test" script "source /etc/bashrc ; vsenv" targets.1 "sc"
Here is an example, ignore the fail as I am executing the command on a Security Management Server
[Expert@sc:0]# mgmt_cli -r true -f json run-script script-name "test" script "source /etc/bashrc ; vsenv" targets.1 "sc" | jq -r '.tasks[]."task-details"[].statusDescription'
---------------------------------------------
Time: [10:24:48] 15/12/2023
---------------------------------------------
"cpx-sc - test" failed (100%)
vsenv: This is only supported on a VSX machine.
Hi Jim,
You seem to be using the mgmt_cli tool, I am using the Web Services. Looking at the documentation (Check Point - Management API reference), it seems like I cannot add the source in the HTTP Request body...
Thank you
Hi,
The mgmt_cli is just a client to send RESTful API requests as HTTP POST.
This is how the payload looks like that is sent to the Server.
Payload: {
"script" : "source /etc/bashrc ; vsenv",
"script-name":"test",
"targets":["sc"]
}
Thank you very much, this seems to do the trick !
If this can help anyone: I got it to work with "src /etc/bashrc ; vsenv [vsName] ; /bin/cp-ifconfig.sh -a"
ifconfig -a gave the internal IP's. /bin/cp-ifconfig.sh -a gives me the external IP's
All currently supported versions of VSX are based on Linux network namespaces rather than the old VRF extensions. As long as you're running a current version, the easiest way to run a command in a given VS is this:
ip nets exec <namespace name> <command>
The namespaces have predictable names in the form CTX##### where ##### is the VSID padded out to five digits with leading zeroes. For example, VSID 4 is CTX00004 and VSID 196 is CTX00196.
For example, to run the command 'netstat -rn' in VSID 2, I use:
ip netns exec CTX00002 netstat -rn
You can get a list of all of the namespace names using 'ip nets list'. Note that this list includes switch contexts.
Useful information about the namespaces, thanks for sharing.
Tue 03 Nov 2026 @ 06:00 PM (CET)
Under the Hood: How to Secure Agentic AI on AWS with Check PointTue 10 Nov 2026 @ 06:00 PM (IST)
Under the Hood: Introducing Check Point Cloud Firewall as a ServiceTue 10 Nov 2026 @ 08:00 PM (IST)
Check Point Mobile Security | Extending Zero Trust with NetskopeTue 03 Nov 2026 @ 06:00 PM (CET)
Under the Hood: How to Secure Agentic AI on AWS with Check PointTue 10 Nov 2026 @ 06:00 PM (IST)
Under the Hood: Introducing Check Point Cloud Firewall as a ServiceTue 10 Nov 2026 @ 08:00 PM (IST)
Check Point Mobile Security | Extending Zero Trust with NetskopeAbout CheckMates
Learn Check Point
Advanced Learning
WE SECURE YOUR AI TRANSFORMATION