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.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
Project details
Release history Release notifications | RSS feed
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.15.tar.gz
(60.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
fortilib-1.0.15-py3-none-any.whl
(46.3 kB
view details)
File details
Details for the file fortilib-1.0.15.tar.gz.
File metadata
- Download URL: fortilib-1.0.15.tar.gz
- Upload date:
- Size: 60.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57aa877def5d82eec84cb50d8d345f4d3bfff7fa9f9c170ced9f1e3b1e4229ae
|
|
| MD5 |
201a4cea15f48aa8eb490262b78f25f5
|
|
| BLAKE2b-256 |
f2f741f82294e86040a61aeeb0311e4e3028568d2521f363b0fb58b6eaa7fe96
|
File details
Details for the file fortilib-1.0.15-py3-none-any.whl.
File metadata
- Download URL: fortilib-1.0.15-py3-none-any.whl
- Upload date:
- Size: 46.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9044b8ec6dc545d5e4227dd1465eb6310e55e731266b70372481558a9301035c
|
|
| MD5 |
b5cf4447647096f75d6f56d167750f9a
|
|
| BLAKE2b-256 |
b9790a98c3aaabff584865709d1dd3c458d80ba5a4dbf0e2aec804b7d4b7538a
|