# 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.9",
"maintainer_email": null,
"keywords": "firewall, fortinet, fortigate",
"author": "Daniel Zinke",
"author_email": "Daniel.Zinke@telekom.de",
"download_url": "https://files.pythonhosted.org/packages/55/30/7ddbf4ad02fd7d6f22d3704d134e8d13139343763632e8c843af49c14c3d/fortilib-1.0.6.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.6",
"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": "cb6af5bd6395ae4c9dd85ba8909319095a0ae41f5fea94673ade6b3370ef2ac0",
"md5": "c69f6c508a0ef62b141a254345b28c4a",
"sha256": "20645cca08bd96e409a1be3786ae6295cca718716e5d719183294e0c3765df4e"
},
"downloads": -1,
"filename": "fortilib-1.0.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c69f6c508a0ef62b141a254345b28c4a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 44348,
"upload_time": "2024-07-29T15:50:06",
"upload_time_iso_8601": "2024-07-29T15:50:06.693246Z",
"url": "https://files.pythonhosted.org/packages/cb/6a/f5bd6395ae4c9dd85ba8909319095a0ae41f5fea94673ade6b3370ef2ac0/fortilib-1.0.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "55307ddbf4ad02fd7d6f22d3704d134e8d13139343763632e8c843af49c14c3d",
"md5": "19c8bee9f79f244388301664e59b8339",
"sha256": "576fa56323761ae8ef51affa288cca2599bdd48a23e6958b90b3e58f8fed805c"
},
"downloads": -1,
"filename": "fortilib-1.0.6.tar.gz",
"has_sig": false,
"md5_digest": "19c8bee9f79f244388301664e59b8339",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 35112,
"upload_time": "2024-07-29T15:50:07",
"upload_time_iso_8601": "2024-07-29T15:50:07.718318Z",
"url": "https://files.pythonhosted.org/packages/55/30/7ddbf4ad02fd7d6f22d3704d134e8d13139343763632e8c843af49c14c3d/fortilib-1.0.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-29 15:50:07",
"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"
}