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 variables

Config::from_env() reads these variables. Unset or empty optional variables keep the defaults; a missing host or API key throws a fortiapi::Error.

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)

Fields set in code

These Config fields have no environment variable:

Config fieldDefaultMeaning
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 (see Tracing)
max_reply_depth256Deepest nesting of objects and arrays accepted in a JSON reply (see Reply nesting limit)

TLS

TLS is always verified

TLS is always verified (peer and host name). There is no option to turn verification off.

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).