Skip to main content

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.11 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

Metadata

Release files for fortilib 1.0.16

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fortilib 1.0.16
File Size Uploaded Provenance Actions
fortilib-1.0.16.tar.gz 60.9 kB Without provenance Details for fortilib-1.0.16.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fortilib 1.0.16
File Interpreter ABI Platform Actions
fortilib-1.0.16-py3-none-any.whl Python 3 none any Details for fortilib-1.0.16-py3-none-any.whl

Total release size: 107.3 kB

Release files / fortilib-1.0.16.tar.gz

Download URL fortilib-1.0.16.tar.gz
Size 60.9 kB
Tags Source
SHA-256 checksum
How to use checksums
bc66a53626743de45f99ded35e594cee2c414d78d3ec8b3f3e7b7ec0181a8d1c
BLAKE2b-256 checksum
How to use checksums
95e64e743aac10560f640df8ef02631593a38469ae5e836c4e6aba163a435256
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / fortilib-1.0.16-py3-none-any.whl

Download URL fortilib-1.0.16-py3-none-any.whl
Size 46.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2a851b341fd7433bd5fbc178350658d15f425ebaf3e05128924bf949eb0addc4
BLAKE2b-256 checksum
How to use checksums
9f5161efa48edf06b36933339f791b29c26772c12487a046d1d929a18d8e904c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for fortilib 1.0.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page