Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
DPB_Point
Contributor
Contributor

Python modules in checkpoint

HI!

I am trying to install the requests python module in a R80.10 Management server, and as I have seen, it hasnt the pip utility. Does anyone know how to install the module?

11 Replies
Martin_Valenta
Advisor

There is no pip and never will be I guess. You can try to import module locally, meaning upload .py files to management station and import in script. What's the use case to run python script from mgmt station?

0 Kudos
DPB_Point
Contributor
Contributor

Ok but I am trying to install the modules locally but i cant, because when I try to install requests module the system asks me for the setuptools modules and when I try to install the setuptools  it asks me for distutils.core and when I try to install distutils it asks me for distutils so I cant continue. I´m trying to convert the python file in executable, but the .spec file that I have generated cannot be run by the mgmt server so I am a little bit blocked(I have generated it in a Fedora in order to get a similar enviroment). 

The use case is the following, we are trying to disable a group of policies which have a determinate comment, If we would have a problem, we disable the rules that could generate them(critical service) and we solve the problem quickly. 

I have also tried to install pip with the get_pip.py script but it doesnt work.

0 Kudos
PhoneBoy
Admin
Admin

The python that is available on Check Point appliances is not meant to be used for general purpose.

As a result, we only put the specific modules and features we explicitly use and disable everything else.

In fact, any script has to be explicitly whitelisted before running.

0 Kudos
Joshua_Hatter
Employee
Employee

This isn't the case anymore in R80. You can run any python files without whitelist.

0 Kudos
PhoneBoy
Admin
Admin

Yeah, but it's still a pretty stripped down Python Smiley Happy

0 Kudos
DPB_Point
Contributor
Contributor

So do you think that I couldnt work with libraries such as requests? the thing is that I need to include the python script in the management server either way. So that would generate a problem to me, do you know if there is a way to become the script in a executable? I have tried pyinstaller utility in a Fedora that is a similar to the Checkpoint enviroment but I cannot execute the executable which is generated as I have told before. Any solution would be welcomed.

PhoneBoy
Admin
Admin

What is it you are actually trying to do?

Clearly run some sort of python script, but to do what exactly?

0 Kudos
Joshua_Hatter
Employee
Employee

You aren't going to be able to install non-standard library with a package manager. I've never tried it but it should work, you will need to copy in requests + all it's dependencies to the management server and it might work.

I haven't had much luck with pyinstaller with Check Point myself, I did try it once.

DPB_Point
Contributor
Contributor

What I have done remotely is cretae a python script which through web services, disables a group of rules by the comment they have. Doing that we can disable each rule which has a critical service by the execution of the script. But, I need to have the ability of executing the script in the management server because of the proyect details. 

Joshua Hatter, I have added all the dependencies but when i am trying to execute their setup.py they ask me for more dependencies as I have commented before. I reached at one point in which I couldnt install the distutils module which is needed for the rest of the modules.

Joshua_Hatter
Employee
Employee

First of all, you should do your best to not have to run this from the management server. The API can accept remote calls.

Second, as I mentioned you cannot install packages from the Management server itself, which is what the setup.py does. It reads from a dict the 'install_requires' fields and tries to install through distUtils the dependencies.

I've just tested to verify for you, that this indeed does work. Once you move requests and all it's dependencies to the machine you can execute against them.

lennyb
Explorer

This python is 32bit.

Is it possible and how to install python2 x86_64?

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events