Valkyrian Labs logo

Configuration

Environment variables and fortiapi::Config fields.

Configuration

fortiapi::default_client() is created from fortiapi::Config::from_env() on first use. Replace it with fortiapi::set_default_client(), or pass a fortiapi::Client to any call.

Environment variableConfig fieldDefaultMeaning
FORTIGATE_HOST (or FORTIGATE_GATEWAY_IP)hostrequiredHostname or address of the FortiGate
FORTIGATE_ADMIN_HTTPS_PORTport443Admin HTTPS port
FORTIGATE_API_KEYapi_keyrequiredREST API administrator key
PATH_TO_FORTIGATE_CA_CERTca_bundlesystem trust storePEM CA bundle
PATH_TO_FORTIGATE_SSL_CERTclient_certnonePKCS#12 client certificate (PKI peer authentication)
FORTIGATE_SSL_CERT_PASSclient_cert_passwordnoneIts password
FORTIGATE_RESOLVE_IPresolve_ipnoneConnect to this address while verifying TLS for the host name
FORTIGATE_VDOMvdomdevice defaultVDOM for every request (a Query can override it)
connect_timeout5 sConnection timeout
timeout30 sWhole-request timeout
retries, retry_backoff2, 500 msRead retries (see Errors and retries)
on_exchangenoneCallback receiving every request and reply, without credentials

TLS is always verified (peer and host name). resolve_ip helps when the certificate is issued for a name that does not resolve to the FortiGate from where the client runs (split-horizon DNS).