Skip to main content

fortiosAPI Overview

Opensource python library to configure Fortigate/Fortios devices (Fortigate REST API)

Ready for config management.

Compare to the REST API there a few add-ons: In addition to get,put,post,delete methods there is a set which will try to post and if failing will put and collect the mkey directly. The lib will also find the mkey for you

Examples

You can find and propose examples here: https://github.com/fortinet-solutions-cse/fortiosapi-examples Separated to avoid cluttering those who integrate the fortiosapi module.

### New overlay configuration

You now have an overlayconfig call which can be pass a complex configuration change in yaml. Including multiple endpoints (name/path) as the simple example below shows:

antivirus:
  profile:
    apisettree:
      "scan-mode": "quick"
      'http': {"options": "scan avmonitor",}
      "emulator": "enable"
firewall:
  policy:
    67:
      'name': "Testfortiosapi"
      'action': "accept"
      'srcintf': [{"name": "port1"}]
      'dstintf': [{"name": "port2"}]
      'srcaddr': [{"name": "all"}]
      'dstaddr': [{"name": "all"}]
      'schedule': "always"
      'service': [{"name": "HTTPS"}]
      "utm-status": "enable"
      "profile-type": "single"
      'av-profile': "apisettree"
      'profile-protocol-options': "default"
      'ssl-ssh-profile': "certificate-inspection"
      'logtraffic': "all"

The behaviour is to change the parameters at the higher level in the CMDB tree first then do a serie of set on the tables.

Will fail if one of the set fails.

Order in the yaml is preserved.

Login methods

User/password

Token (api key) documented in the Fortigate API Spec that you can find if having an account on http://fndn.fortinet.net/

Multi vdom

In multi vdom environment use vdom=global in the API call. As it is a reserved word the API will switch to use the global=1 and take care of the differences in the repsonses.

Schema

There is a get_schema call and an example to get the schema of the differents methods to ease writting them.

License (5.6)

A rest call to check and force license validation check starting with 5.6 See license. usage of schema and mkey for every call for 5.6

License validity is now checked at login

Versions

Test driven development

In tests folder you will find a tox based set of tests as examples. The test_fortiosapi_virsh need you to have virsh access, especially to the console. This allow to perform actions automatically from the CLI and check API calls actual results. Other tests are welcomed.

Files upload/download

You will find the calls to exchange files (config, logs, licenses) with Fortigate in this LIB

Known Usage

Fortiosapi library is used in Home-Assistant, Fortinet Ansible modules and in Cloudify plugins.

Maintained mainly by Fortinet employees.

Metadata

Release files for fortiosapi 1.0.5

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

Source distribution (sdist)

Source distribution for fortiosapi 1.0.5
File Size Uploaded Provenance
fortiosapi-1.0.5.tar.gz 16.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for fortiosapi 1.0.5
File Interpreter ABI Platform
fortiosapi-1.0.5-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 35.9 kB

Release files / fortiosapi-1.0.5.tar.gz

Download URL fortiosapi-1.0.5.tar.gz
Size 16.0 kB
Tags Source
SHA-256 checksum
How to use checksums
37269d9dceeebeddfcf5b43932db9dc1f1f4f9b292e0931d2483e31949eb5099
BLAKE2b-256 checksum
How to use checksums
88eb3bebe6506edfcf9bc7de5638728dcab09ad3c141e976cbeb883531c6f383
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.7

Release files / fortiosapi-1.0.5-py2.py3-none-any.whl

Download URL fortiosapi-1.0.5-py2.py3-none-any.whl
Size 19.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
a39aee01a6fc7861330897f601ada3ad7024c1f84690656b7df99089e5c25f4c
BLAKE2b-256 checksum
How to use checksums
403fc40b800c8ae8cb730528044cbb1175c229e17330a1503e9db063030215b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.7

Security for fortiosapi 1.0.5

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.

Release history Release notifications | RSS feed

This release

1.0.5 This release

2 release files No provenance

0.5

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