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
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.13.tar.gz
(35.7 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.13-py3-none-any.whl
(46.2 kB
view details)
File details
Details for the file fortilib-1.0.13.tar.gz.
File metadata
- Download URL: fortilib-1.0.13.tar.gz
- Upload date:
- Size: 35.7 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e389f8c3ee22310769c63a77375e5a98cfe1b40dfad26e3d91dbf1eea84b869
|
|
| MD5 |
38fe595cb9ea74252a809d8eb1188d09
|
|
| BLAKE2b-256 |
0179c07478009872f2d8ae51b94eec02dd4639d110d92d1c2049582afafa0127
|
File details
Details for the file fortilib-1.0.13-py3-none-any.whl.
File metadata
- Download URL: fortilib-1.0.13-py3-none-any.whl
- Upload date:
- Size: 46.2 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3b395500ef122b20c2027efba5810d465a137d5bf09703cf98028f0ae5c1367
|
|
| MD5 |
672c3d35de7865b306e8ceeeaeb91e9a
|
|
| BLAKE2b-256 |
7631d801db944667222cce14b0775ac98473e4422f6d053fd784d1b2e71a3cb4
|