Skip to content

fortigate firewall policy support #173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
10 changes: 9 additions & 1 deletion capirca/aclgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
from capirca.lib import ciscoasa
from capirca.lib import ciscoxr
from capirca.lib import cloudarmor
from capirca.lib import fortigate
from capirca.lib import gce
from capirca.lib import ipset
from capirca.lib import iptables
Expand Down Expand Up @@ -174,6 +175,7 @@ def RenderFile(input_file, output_directory, definitions,
win_afw = False
xacl = False
paloalto = False
fcl = False

try:
conf = open(input_file).read()
Expand Down Expand Up @@ -238,6 +240,8 @@ def RenderFile(input_file, output_directory, definitions,
paloalto = copy.deepcopy(pol)
if 'cloudarmor' in platforms:
gca = copy.deepcopy(pol)
if 'fortigate' in platforms:
fcl = copy.deepcopy(pol)

if not output_directory.endswith('/'):
output_directory += '/'
Expand Down Expand Up @@ -327,11 +331,15 @@ def RenderFile(input_file, output_directory, definitions,
acl_obj = cloudarmor.CloudArmor(gca, exp_info)
RenderACL(str(acl_obj), acl_obj.SUFFIX, output_directory,
input_file, write_files)
if fcl:
acl_obj = fortigate.Fortigate(fcl, exp_info)
RenderACL(str(acl_obj), acl_obj.SUFFIX, output_directory,
input_file, write_files)
# TODO(robankeny) add additional errors.
except (juniper.Error, junipersrx.Error, cisco.Error, ipset.Error,
iptables.Error, speedway.Error, pcap.Error,
aclgenerator.Error, aruba.Error, nftables.Error, gce.Error,
cloudarmor.Error) as e:
cloudarmor.Error, fortigate.Error) as e:
raise ACLGeneratorError(
'Error generating target ACL for %s:\n%s' % (input_file, e))

Expand Down
Loading