GoSecure / Cisco2Checkpoint

Tool that assists in migrating firewall rules from Cisco to Checkpoint. Will optimize rules for you (rationalization, reuse merging, etc.).
http://gosecure.net/2017/01/30/cisco2checkpoint-cisco-checkpoint-conversion-tool/
GNU General Public License v3.0
21 stars 11 forks source link

icmp service parse #13

Closed mjardeli closed 7 years ago

mjardeli commented 7 years ago

Hi Martin,

I tried to play with ICMP_DIC, but seems it is not being loaded. I am receiving error when trying to import object group that contains icmp

object-group service icmp_Prot
 service-object icmp echo
 service-object icmp echo-reply

Output error:

Traceback (most recent call last):
  File "c2c.py", line 168, in <module>
    c2c.importConfig(args.cpPortsFile,args.cpNetObjFile,args.ciscoFile)
  File "lib/cisco2checkpoint.py", line 1749, in importConfig
    self._importPortGroups(self.parser.getPortGroups())
  File "lib/cisco2checkpoint.py", line 1833, in _importPortGroups
    self.addObj(CiscoServiceGroup(self, newGrp))
  File "lib/cisco2checkpoint.py", line 1054, in __init__
    for mm_r in parsedObj.result_dict:
  File "lib/ciscoconfparse_patch.py", line 497, in result_dict
    .format(obj.text))
ValueError: [FATAL] models_asa cannot parse ' service-object icmp echo'

thanks,

martindube commented 7 years ago

This is another use case that is not managed by the code yet. However, here's a workaround:

!object-group service icmp_Prot
! service-object icmp echo
! service-object icmp echo-reply
object-group service icmp_Prot
 icmp-object echo
 icmp-object echo-reply
mjardeli commented 7 years ago

Thanks Martin!

I did a find for "service-object icmp" replacing with "icmp-object", this solved. Is there a way to automate this on your code?

cheers,

martindube commented 7 years ago

Patched !

From

object-group service icmp_Prot
 service-object icmp echo
 service-object icmp echo-reply

To

CiscoServiceGroup(name=icmp_Prot,desc=,nbMembers=2)
 CiscoIcmp(name=echo-request,desc=ICMP, echo request,alias=echo)
 CiscoIcmp(name=echo-reply,desc=ICMP, echo reply,alias=)
mjardeli commented 7 years ago

Thank you Martin! No more manual intervention for icmp services.

cheers