# fortilib - a Python Library to interact with Fortigate Firewalls
This Python module contains the ability to get and configure following object on [Fortigate Firewalls](https://www.fortinet.com/products/next-generation-firewall):
* 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:
* [httpx](https://www.python-httpx.org/)
Simply install fortilib via pip:
```
> pip install fortilib
```
## Quickstart
```python
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](CONTRIBUTING.md).
## License
GPLv3
Raw data
{
"_id": null,
"home_page": "https://github.com/telekom-mms/fortilib",
"name": "fortilib",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.11",
"maintainer_email": null,
"keywords": "firewall, fortinet, fortigate",
"author": "Daniel Zinke",
"author_email": "Daniel.Zinke@telekom.de",
"download_url": "https://files.pythonhosted.org/packages/20/39/f06f488505a0339895b1205f41d9e0cb5b42e0f63c072b17dada7fe09122/fortilib-1.0.12.tar.gz",
"platform": null,
"description": "# fortilib - a Python Library to interact with Fortigate Firewalls\n\nThis Python module contains the ability to get and configure following object on [Fortigate Firewalls](https://www.fortinet.com/products/next-generation-firewall):\n* Addresses\n* Address Groups\n* Interfaces\n* IPPools\n* Policies\n* Proxy Addresses\n* Proxy Address Groups\n* Proxy Policies\n* Routes\n* Services\n* Service Groups\n* Vips\n* Vip Groups\n\n## Installation\nPython >= 3.8 is required.\n\nDependencies:\n* [httpx](https://www.python-httpx.org/)\n\nSimply install fortilib via pip:\n```\n> pip install fortilib\n```\n\n## Quickstart\n\n```python\nimport ipaddress\n\nfrom fortilib.firewall import FortigateFirewall\nfrom fortilib.fortigateapi import FortigateFirewallApi\nfrom fortilib.address import FortigateIpMask\n\n\napi = FortigateFirewallApi(\n ipaddr=\"127.0.0.1\", # firewall ip\n vdom=\"vdom\", # use \"root\" if you dont have vdoms activated\n access_token=\"token\",\n # username=\"username\", # alternative login with username\n # password=\"password\", # and password\n)\nfirewall = FortigateFirewall(\"fw01\", api)\nfirewall.login()\n\n# load all objects from fortigate\nfirewall.get_all_objects()\n\n# create an firewall address\naddress = FortigateIpMask()\naddress.name = \"Test Address\"\naddress.subnet = ipaddress.ip_network(\"127.0.0.1/32\")\n\n# add object to firewall\nfirewall.create_firewall_address(address)\n\n# print all addresses on firewall\nfor address in firewall.addresses:\n print(address.name)\n```\n\n## Contributing\n\nSee [Contributing](CONTRIBUTING.md).\n\n## License\n\nGPLv3\n",
"bugtrack_url": null,
"license": "GPL-3.0-only",
"summary": "fortilib - a Python Library to interact with Fortigate Firewalls",
"version": "1.0.12",
"project_urls": {
"Changelog": "https://github.com/telekom-mms/fortilib/blob/master/CHANGELOG.md",
"Documentation": "https://github.com/telekom-mms/fortilib",
"Homepage": "https://github.com/telekom-mms/fortilib",
"Repository": "https://github.com/telekom-mms/fortilib"
},
"split_keywords": [
"firewall",
" fortinet",
" fortigate"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "54c56fe7702c27e097f88efab84458b44bd2e9a7f14417433b3d07ba35ef335c",
"md5": "4ce275aaaeb779204fdf988ed96c209e",
"sha256": "1c8f1cd008eaf736b6d37d8354f43ce95ecd39d9a6ea42907cdd2674409394c8"
},
"downloads": -1,
"filename": "fortilib-1.0.12-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4ce275aaaeb779204fdf988ed96c209e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.11",
"size": 44553,
"upload_time": "2025-08-01T10:21:36",
"upload_time_iso_8601": "2025-08-01T10:21:36.129921Z",
"url": "https://files.pythonhosted.org/packages/54/c5/6fe7702c27e097f88efab84458b44bd2e9a7f14417433b3d07ba35ef335c/fortilib-1.0.12-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2039f06f488505a0339895b1205f41d9e0cb5b42e0f63c072b17dada7fe09122",
"md5": "4964a899f93cc5635f23252881b55c02",
"sha256": "e0f3f16661a564e76f0f372851a0022620c4ba87026006f20654daafa9c0280f"
},
"downloads": -1,
"filename": "fortilib-1.0.12.tar.gz",
"has_sig": false,
"md5_digest": "4964a899f93cc5635f23252881b55c02",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.11",
"size": 34460,
"upload_time": "2025-08-01T10:21:37",
"upload_time_iso_8601": "2025-08-01T10:21:37.917183Z",
"url": "https://files.pythonhosted.org/packages/20/39/f06f488505a0339895b1205f41d9e0cb5b42e0f63c072b17dada7fe09122/fortilib-1.0.12.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-01 10:21:37",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "telekom-mms",
"github_project": "fortilib",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"tox": true,
"lcname": "fortilib"
}