Skip to main content

fortilib - a Python Library to interact with Fortigate Firewalls

Project description

fortilib - a Python Library to interact with Fortigate Firewalls

This Python module contains the ability to get and configure following object on Fortigate Firewalls:

  • Addresses
  • Address Groups
  • Interfaces
  • IPPools
  • Policies
  • Proxy Addresses
  • Proxy Address Groups
  • Proxy Policies
  • Routes
  • Services
  • Service Groups
  • Vips
  • Vip Groups

Installation

Python >= 3.8 is required.

Dependencies:

Simply install fortilib via pip:

> pip install fortilib

Quickstart

import ipaddress

from fortilib.firewall import FortigateFirewall
from fortilib.fortigateapi import FortigateFirewallApi
from fortilib.address import FortigateIpMask


api = FortigateFirewallApi(
    ipaddr="127.0.0.1", # firewall ip
    vdom="vdom", # use "root" if you dont have vdoms activated
    access_token="token",
    # username="username", #  alternative login with username
    # password="password", #  and password
)
firewall = FortigateFirewall("fw01", api)
firewall.login()

# load all objects from fortigate
firewall.get_all_objects()

# create an firewall address
address = FortigateIpMask()
address.name = "Test Address"
address.subnet = ipaddress.ip_network("127.0.0.1/32")

# add object to firewall
firewall.create_firewall_address(address)

# print all addresses on firewall
for address in firewall.addresses:
    print(address.name)

Contributing

See Contributing.

License

GPLv3

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fortilib-1.0.14.tar.gz (35.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fortilib-1.0.14-py3-none-any.whl (46.3 kB view details)

Uploaded Python 3

File details

Details for the file fortilib-1.0.14.tar.gz.

File metadata

  • Download URL: fortilib-1.0.14.tar.gz
  • Upload date:
  • Size: 35.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.12.3 Linux/6.11.0-1018-azure

File hashes

Hashes for fortilib-1.0.14.tar.gz
Algorithm Hash digest
SHA256 fcc076cbaf4de053dcab9d1591c85a69a3e2cb554130f3fe1af1878bc917c632
MD5 31d204be290a7f40c0129b5823762f09
BLAKE2b-256 cf83c420318f73a0bddc22fe1156a0c964ca2327279035d18e45722ee24c9f51

See more details on using hashes here.

File details

Details for the file fortilib-1.0.14-py3-none-any.whl.

File metadata

  • Download URL: fortilib-1.0.14-py3-none-any.whl
  • Upload date:
  • Size: 46.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.12.3 Linux/6.11.0-1018-azure

File hashes

Hashes for fortilib-1.0.14-py3-none-any.whl
Algorithm Hash digest
SHA256 845babcdbab1c63fbe11101107ba78e4ec37210ebbaa54565afecd748a337292
MD5 7d502b4a14b1528643a226a4882216e5
BLAKE2b-256 693cf3104413767aa026d22655c1d5d27c4e075f4dbb858bcc4ea74cbd5ed765

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page