Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
Suleyman_B_T
Participant

Re: Python tool for exporting/importing a policy package or parts of it

Hi,

python version 2.7.9 installed on my pc.

also my smartcenter pyton version 2.7.3

[Expert@mgmt:0]# /opt/CPsuite-R80/fw1/Python/bin/python -V
Python 2.7.3

How can I resolve the Login failed issue?

C:\import_export_package\export_package.py -m 192.168.0.1 fwpolicy
Trying to get login credentials...
Trying to login via `mgmt_cli login -r true`.
Trying to get username and password.
Enter username: admin
Enter password:
Got the following login credentials:
Username: admin
Password: ********
Session ID: None
Login failed: APIResponse received a response which is not valid JSON.

Thank you
Best Regards

Suleyman

0 Kudos
10 Replies
Moti
Admin
Admin

0 Kudos
Suleyman_B_T
Participant

Hello again,

Do you have an idea for the solution?

python version 2.7.9 installed on my pc.

 

also my smartcenter pyton version 2.7.3

[Expert@mgmt:0]# /opt/CPsuite-R80/fw1/Python/bin/python -V
Python 2.7.3

 

How can I resolve the Login failed issue?

 

C:\import_export_package\export_package.py -m 192.168.0.1 fwpolicy
Trying to get login credentials...
Trying to login via `mgmt_cli login -r true`.
Trying to get username and password.
Enter username: admin
Enter password:
Got the following login credentials:
Username: admin
Password: ********
Session ID: None
Login failed: APIResponse received a response which is not valid JSON.

 

Thank you
Best Regards

Suleyman

Adam_Galmor
Employee Alumnus
Employee Alumnus

Hi Suleyman,

Please try using the newer version of the API Python library - 

https://community.checkpoint.com/docs/DOC-1091

Please contact me via e-mail if you run into any issues.

Thanks,

Adam

0 Kudos
Sebastian_Gxxx
Contributor

Ps. my Python version installed on the PC is 2.7.13 Tk version 8.5.15

Adam_Galmor
Employee Alumnus
Employee Alumnus

Hi Sebastian,

Please add the --unsafe flag when you run the tool. 

Let me know if this resolves your issue.

Adam Galmor

0 Kudos
Sebastian_Gxxx
Contributor

Hello Adam,

I have tried it already before with different ways.

Here once again the results.

Python version installed on the PC is 2.7.13 Tk version 8.5.15

Best regards

Sebastian

C:\Users\lab1\Documents\import_export_package1>export_package.py -u

123 -m 192.168.63.80 Standard --unsafe true

Trying to get login credentials...

Got the following login credentials:

Username: admin

Password: ******

Session ID: None

Traceback (most recent call last):

File "C:\Users\lab1\Documents\import_export_package1\export_packag

30, in

_, , usercreated, client, args = process_args_and_login(client

ser=parser, showparameter="package")

File "C:\Users\lab1\Documents\import_export_package1\import_export

objects.py", line 68, in processargs_and_login

raise mgmt_api_lib.APIClientException("The server's fingerprint

than your local record of it. The script cannot operate in this uns

(unless running with --unsafe). Exiting...")

import_export_objects.mgmt_api_lib.api_exceptions.APIClientException

's fingerprint is different than your local record of it. The script

ate in this unsecure manner (unless running with --unsafe). Exiting.

C:\Users\lab1\Documents\import_export_package1>

C:\Users\lab1\Documents\import_export_package1>

C:\Users\lab1\Documents\import_export_package1>python -V

'python' is not recognized as an internal or external command,

operable program or batch file.

C:\Users\lab1\Documents\import_export_package1>export_package.py --unsafe -u adm

in -p vpn123 -m 192.168.63.80 Standard

usage: export_package.py

package

export_package.py: error: argument --unsafe: expected one argument

C:\Users\lab1\Documents\import_export_package1>export_package.py --unsafe true -

u admin -p vpn123 -m 192.168.63.80 Standard

Trying to get login credentials...

Got the following login credentials:

Username: admin

Password: ******

Session ID: None

Traceback (most recent call last):

File "C:\Users\lab1\Documents\import_export_package1\export_package.py", line

30, in

_, , usercreated, client, args = process_args_and_login(client=client, par

ser=parser, showparameter="package")

File "C:\Users\lab1\Documents\import_export_package1\import_export_objects\get

objects.py", line 68, in processargs_and_login

raise mgmt_api_lib.APIClientException("The server's fingerprint is different

than your local record of it. The script cannot operate in this unsecure manner

(unless running with --unsafe). Exiting...")

import_export_objects.mgmt_api_lib.api_exceptions.APIClientException: The server

's fingerprint is different than your local record of it. The script cannot oper

ate in this unsecure manner (unless running with --unsafe). Exiting...

C:\Users\lab1\Documents\import_export_package1>

C:\Users\lab1\Documents\import_export_package1>export_package.py --unsafe-auto-a

ccept true -u admin -p vpn123 -m 192.168.63.80 Standard

Trying to get login credentials...

Got the following login credentials:

Username: admin

Password: ******

Session ID: None

Traceback (most recent call last):

File "C:\Users\lab1\Documents\import_export_package1\export_package.py", line

30, in

_, , usercreated, client, args = process_args_and_login(client=client, par

ser=parser, showparameter="package")

File "C:\Users\lab1\Documents\import_export_package1\import_export_objects\get

objects.py", line 68, in processargs_and_login

raise mgmt_api_lib.APIClientException("The server's fingerprint is different

than your local record of it. The script cannot operate in this unsecure manner

(unless running with --unsafe). Exiting...")

import_export_objects.mgmt_api_lib.api_exceptions.APIClientException: The server

's fingerprint is different than your local record of it. The script cannot oper

ate in this unsecure manner (unless running with --unsafe). Exiting...

C:\Users\lab1\Documents\import_export_package1>

0 Kudos
Sebastian_Gxxx
Contributor

unfortunately the unsafe flag does not resolve it.

Adam_Galmor
Employee Alumnus
Employee Alumnus

Hi Sebastian, have you tried using both "unsafe" and "unsafe-auto-accept"?

In any case, please supply me with your e-mail address.

0 Kudos
PhoneBoy
Admin
Admin

Adam, I will send his email address offline. Smiley Happy

0 Kudos
Sebastian_Gxxx
Contributor

It was the IP address. Using correct IP helped.

C:\Users\lab1\Documents\import_export_package1>export_package.py --unsafe true -u admin -p vpn123 -m 192.168.163.80 Standard
Trying to get login credentials...
Got the following login credentials:
    Username: admin
    Password: ******
    Session ID: None

You currently do not have a record of this server's fingerprint.
Server's fingerprint: ******************************************
Do you accept this fingerprint? [y/n] y
Fingerprint saved.
Exporting rulebase from layer 'Network'...

1/1 objects retrieved.
Exporting access rules from layer 'Network'...
Exporting access sections from layer 'Network'...
Done exporting layer 'Network'.

Thank you

0 Kudos

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events