Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
BN
Explorer

Problem to Migrate policy from CMA to SMS by Python script

Hello Guys,

 

i need to migrate one policy from CMA to SMS 

i saw here the tool 

https://github.com/CheckPointSW/ExportImportPolicyPackage

 

I installed the SDK on the Security management Home/admin/python and when i execute the python import_export_package.py cmd to export the policy i has an error message

can't open file ' import_export_package.py' errno 2 no such file or directory

 

The python folder cp_mgmt_api_python_sdk-master is on python folder and i execute the command under this folder

someone can help please ??

0 Kudos
4 Replies
PhoneBoy
Admin
Admin

If you’re using R80.20 or above with a recent JHF, we have more official tools for exporting a CMA into an SMS: https://supportcenter.checkpoint.com/supportcenter/portal?eventSubmit_doGoviewsolutiondetails=&solut...

 

0 Kudos
BN
Explorer

Hi,

 

Thanks for your response 

i need just to migrate one policy with this procedure will migrate all the CMA( all object , all policies,..)

 

now the script is running but just i have an error when i enter the username :

 

# python import_export_package.py
Welcome to the Policy Package Import/Export Tool.
What would you like to do?
1. Import a package
2. Export a package
99. Exit
2
Please enter a Policy Package name to export:
'IE1_Migration_to_not_be_install'
Please select a login method:
1. Enter user credentials manually
2. Login as Root
3. Use an existing session file
4. Use an existing session UID
99. Back
3
The script will run with the following parameters:
Export Access-Control layers = True
Export NAT layers = True
Export Threat-Prevention layers = True
Export HTTPS Inspection layers = True
Output-file name = None
Management Server IP = 127.0.0.1
Management Server Port = 443
Management Server Domain = None
1. Change Settings
2. Run
99. Back
2
Traceback (most recent call last):
File "import_export_package.py", line 26, in <module>
args = process_arguments(arg_parser)
File "/home/admin/python/ExportImportPolicyPackage-master/utils.py", line 108, in process_arguments
log_file = open(args.log_file, "w",newline='')
TypeError: 'newline' is an invalid keyword argument for this function
[Expert@CBSL011:0]# python import_export_package.py

Welcome to the Policy Package Import/Export Tool.
What would you like to do?
1. Import a package
2. Export a package
99. Exit
2
Please enter a Policy Package name to export:
'IE1_Migration_to_not_be_install'
Please select a login method:
1. Enter user credentials manually
2. Login as Root
3. Use an existing session file
4. Use an existing session UID
99. Back
1
The script will run with the following parameters:
Export Access-Control layers = True
Export NAT layers = True
Export Threat-Prevention layers = True
Export HTTPS Inspection layers = True
Output-file name = None
Management Server IP = 127.0.0.1
Management Server Port = 443
Management Server Domain = None
1. Change Settings
2. Run
99. Back
2
Please enter your username:
admin
Traceback (most recent call last):
File "import_export_package.py", line 26, in <module>
args = process_arguments(arg_parser)
File "/home/admin/python/ExportImportPolicyPackage-master/utils.py", line 98, in process_arguments
args = Menu(args).self_args
File "/home/admin/python/ExportImportPolicyPackage-master/menu.py", line 21, in __init__
self.build()
File "/home/admin/python/ExportImportPolicyPackage-master/menu.py", line 146, in build
self.display()
File "/home/admin/python/ExportImportPolicyPackage-master/menu.py", line 30, in display
self.handle_input()
File "/home/admin/python/ExportImportPolicyPackage-master/menu.py", line 269, in handle_input
self.build()
File "/home/admin/python/ExportImportPolicyPackage-master/menu.py", line 146, in build
self.display()
File "/home/admin/python/ExportImportPolicyPackage-master/menu.py", line 30, in display
self.handle_input()
File "/home/admin/python/ExportImportPolicyPackage-master/menu.py", line 269, in handle_input
self.build()
File "/home/admin/python/ExportImportPolicyPackage-master/menu.py", line 146, in build
self.display()
File "/home/admin/python/ExportImportPolicyPackage-master/menu.py", line 30, in display
self.handle_input()
File "/home/admin/python/ExportImportPolicyPackage-master/menu.py", line 269, in handle_input
self.build()
File "/home/admin/python/ExportImportPolicyPackage-master/menu.py", line 146, in build
self.display()
File "/home/admin/python/ExportImportPolicyPackage-master/menu.py", line 30, in display
self.handle_input()
File "/home/admin/python/ExportImportPolicyPackage-master/menu.py", line 269, in handle_input
self.build()
File "/home/admin/python/ExportImportPolicyPackage-master/menu.py", line 146, in build
self.display()
File "/home/admin/python/ExportImportPolicyPackage-master/menu.py", line 30, in display
self.handle_input()
File "/home/admin/python/ExportImportPolicyPackage-master/menu.py", line 259, in handle_input
self.self_args.username = input()
File "<string>", line 1, in <module>
NameError: name 'admin' is not defined
[Expert@CBSL011:0]#

 

 

 

can you help me please ?

 

Thanks

 

0 Kudos
BN
Explorer

HI,

 

i exported the package now on the CMA

i have exported access layer .gz and exported package .gz files

 

someone can help to import it on the SMS please

 which command i need to use please 

 

Thanks a lot 

 

 

0 Kudos
BN
Explorer

Hi,

 

i am trying to import the package now and i had this error :

 

 

 

 

Creating a Policy Package named [site1_policy]

Importing general objects

Traceback (most recent call last):
File "import_export_package.py", line 63, in <module>
import_package(client, args)
File "/home/admin/python/ExportImportPolicyPackage-master/importing/import_package.py", line 53, in import_package
layers_to_attach = import_objects(args.file, client, {}, package, None, args)
File "/home/admin/python/ExportImportPolicyPackage-master/importing/import_objects.py", line 63, in import_objects
export_tar.extractall()
File "/opt/CPsuite-R80.40/fw1/Python/lib/python2.7/tarfile.py", line 2081, in extractall
self.extract(tarinfo, path)
File "/opt/CPsuite-R80.40/fw1/Python/lib/python2.7/tarfile.py", line 2118, in extract
self._extract_member(tarinfo, os.path.join(path, tarinfo.name))
File "/opt/CPsuite-R80.40/fw1/Python/lib/python2.7/tarfile.py", line 2194, in _extract_member
self.makefile(tarinfo, targetpath)
File "/opt/CPsuite-R80.40/fw1/Python/lib/python2.7/tarfile.py", line 2235, in makefile
copyfileobj(source, target)
File "/opt/CPsuite-R80.40/fw1/Python/lib/python2.7/tarfile.py", line 266, in copyfileobj
shutil.copyfileobj(src, dst)
File "/opt/CPsuite-R80.40/fw1/Python/lib/python2.7/shutil.py", line 63, in copyfileobj
buf = fsrc.read(length)
File "/opt/CPsuite-R80.40/fw1/Python/lib/python2.7/tarfile.py", line 831, in read
buf += self.fileobj.read(size - len(buf))
File "/opt/CPsuite-R80.40/fw1/Python/lib/python2.7/tarfile.py", line 743, in read
return self.readnormal(size)
File "/opt/CPsuite-R80.40/fw1/Python/lib/python2.7/tarfile.py", line 758, in readnormal
return self.__read(size)
File "/opt/CPsuite-R80.40/fw1/Python/lib/python2.7/tarfile.py", line 748, in __read
buf = self.fileobj.read(size)
File "/opt/CPsuite-R80.40/fw1/Python/lib/python2.7/gzip.py", line 267, in read
self._read(readsize)
File "/opt/CPsuite-R80.40/fw1/Python/lib/python2.7/gzip.py", line 314, in _read
self._read_eof()
File "/opt/CPsuite-R80.40/fw1/Python/lib/python2.7/gzip.py", line 353, in _read_eof
hex(self.crc)))
IOError: CRC check failed 0x171ffe7c != 0xcfb4bea4L

 

someone can help me please ??

 

Thanks a lot 

0 Kudos

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events