Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 27 additions & 10 deletions JuniperMigration/JuniperConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4033,19 +4033,29 @@ private void MatchNATRulesIntoFirewallPolicy()
{
continue;
}

var parentLayerRuleZone = (CheckPoint_Zone)cpParentRule.Source[0];
if (parentLayerRuleZone == null)
try
{
continue;
}
var parentLayerRuleZone = (CheckPoint_Zone)cpParentRule.Source[0];

// NAT rule source zone(s)/interface(s) should match on firewall rule source zone
if (!IsFirewallRuleSourceZoneMatchedByNATRule(parentLayerRuleZone.Name, juniperNatCustomData))
if (parentLayerRuleZone == null)
{
continue;
}

// NAT rule source zone(s)/interface(s) should match on firewall rule source zone
if (!IsFirewallRuleSourceZoneMatchedByNATRule(parentLayerRuleZone.Name, juniperNatCustomData))
{
continue;
}
} catch (Exception ex)
{
continue;
if (ex.Message == "Unable to cast object of type 'CheckPointObjects.CheckPoint_NetworkGroup' to type 'CheckPointObjects.CheckPoint_Zone'.")
continue;
else throw ex;
}



// Get into the relevant sub-policy
foreach (CheckPoint_Layer subPolicy in cpPackage.SubPolicies)
{
Expand Down Expand Up @@ -4709,8 +4719,15 @@ private CheckPointObject GetCheckPointObjectOrCreateDummy(string cpObjectName, s

juniperObject.ConversionIncidentType = ConversionIncidentType.ManualActionRequired;

errorDescription = string.Format("{0} Using dummy object: {1}.", errorDescription, cpDummyObject.Name);
_conversionIncidents.Add(new ConversionIncident(juniperObject.LineNumber, errorTitle, errorDescription, juniperObject.ConversionIncidentType));
if (cpObjectName.Contains("<") && cpObjectName.Contains(">") && cpObjectName.Contains("*"))
{
errorDescription = string.Format("wildcard expression is not supported");
_conversionIncidents.Add(new ConversionIncident(juniperObject.LineNumber, "Error creating a parent layer rule", errorDescription, juniperObject.ConversionIncidentType));
} else
{
errorDescription = string.Format("{0} Using dummy object: {1}.", errorDescription, cpDummyObject.Name);
_conversionIncidents.Add(new ConversionIncident(juniperObject.LineNumber, errorTitle, errorDescription, juniperObject.ConversionIncidentType));
}
}

return cpDummyObject;
Expand Down
39 changes: 39 additions & 0 deletions JuniperMigration/JuniperParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public override void Parse(string filename)
ParseApplicationsAndGroups(configNode);
parseSchedulers(configNode);
ParsePolicy(configNode);
ParsePolicyFromGroups(configNode);
ParseNat(configNode);
AttachRoutesToInterfacesTopology();
}
Expand Down Expand Up @@ -448,6 +449,44 @@ private void ParsePolicy(XElement configNode)
_juniperGlobalPolicyRules.Add(juniperDefaultActionRule);
}

private void ParsePolicyFromGroups(XElement configNode)
{
var zonePolicies = configNode.XPathSelectElements("./groups/security/policies/policy");
foreach (var zonePolicy in zonePolicies)
{
JuniperObject juniperZonePolicy = new Juniper_ZonePolicy();
juniperZonePolicy.Parse(zonePolicy, null);
_juniperObjects.Add(juniperZonePolicy);

var policies = zonePolicy.Elements("policy");
foreach (var policy in policies)
{
var juniperRule = new Juniper_PolicyRule();
juniperRule.Parse(policy, null);
((Juniper_ZonePolicy)juniperZonePolicy).Rules.Add(juniperRule);
}
}

var globalPolicies = configNode.XPathSelectElements("./groups/security/policies/global/policy");
foreach (var globalPolicy in globalPolicies)
{
var juniperGlobalRule = new Juniper_GlobalPolicyRule();
juniperGlobalRule.Parse(globalPolicy, null);
_juniperGlobalPolicyRules.Add(juniperGlobalRule);
}

var defaultAction = Juniper_PolicyRule.ActionType.Deny;
var policyDefaultAction = configNode.XPathSelectElement("./groups/security/policies/default-policy");
if (policyDefaultAction != null && policyDefaultAction.Element("permit-all") != null)
{
defaultAction = Juniper_PolicyRule.ActionType.Permit;
}

var juniperDefaultActionRule = new Juniper_GlobalPolicyRule();
juniperDefaultActionRule.GenerateDefaultActionRule(defaultAction);
_juniperGlobalPolicyRules.Add(juniperDefaultActionRule);
}

private void ParseNat(XElement configNode)
{
var nat = configNode.XPathSelectElement("./security/nat");
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ The tool is developed using Microsoft C# language and .Net framework version 4.5

From version 9.1 the tool is developed using Python language version 3.7.

### Note:
Please create the pull request with a request to merge into the staging branch instead of into the master branch.

This allows us to do testing, and to make any additional edits or changes after the merge but before merging to master.

### A Note About Maintenance:

NOTICE! Maintenance of this program is on a ''best effort'' basis.
We try to get to issues and pull requests as quickly as we can.


## 💧 Community
Join the welcoming community of Check Point SmartMove developers at [CheckMATES](https://community.checkpoint.com/t5/SmartMove/bd-p/smartmove)
Expand Down