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.10.tar.gz (35.2 kB view details)

Uploaded Source

Built Distribution

fortilib-1.0.10-py3-none-any.whl (44.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fortilib-1.0.10.tar.gz
  • Upload date:
  • Size: 35.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.3 Linux/6.8.0-1010-azure

File hashes

Hashes for fortilib-1.0.10.tar.gz
Algorithm Hash digest
SHA256 c78d89c8ed64d070331d0bc7172540eeb5d9c479c626d98449ebefd7bfef3259
MD5 2ba276722787e4592e253c4a736f40e1
BLAKE2b-256 6a070850862ac6ef33dc80082499d4ba2e55fe980276bad7c7f5c44bf1bc9e96

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fortilib-1.0.10-py3-none-any.whl
  • Upload date:
  • Size: 44.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.3 Linux/6.8.0-1010-azure

File hashes

Hashes for fortilib-1.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 2e4880e29b82dae0f1fbef78b8ab2975a466390f2566005c62a66903ee52d031
MD5 3de4df6f3859e097996aa9f42a83a56c
BLAKE2b-256 2746f93f3de5b967258e5159bbd9994b4a68539a5aef7c2c81060da8aa5efa75

See more details on using hashes here.

Supported by

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