garak REST targets behind mTLS and proxies

Scanning internal LLM endpoints that require client certificates, corporate proxies or private CAs needs careful generator configuration. This page covers the settings garak's REST generator provides and how to verify them.

On this page

How garak scans internal REST targets behind mTLS and proxies

A security or platform team that must scan an internal LLM endpoint often finds the endpoint sits behind client certificate authentication, a corporate forward proxy or a private certificate authority. garak's REST generator supports proxies, verify_ssl, client_cert, client_key and a client_key_passphrase_env_var setting, and mutual TLS support arrived in v0.15.0. Teams need this when the model or application under test is reachable only from inside the network, when the gateway requires the scanning host to present its own certificate, or when outbound traffic must pass through an approved proxy. This section covers how those settings fit together in the endpoint's YAML file and what each one changes at the network layer.

The core decision is where the scanning host sits and what identity it presents. The client_cert and client_key values point to the certificate and private key that the scanner presents during the TLS handshake, so the certificate must be issued to the scanning host or a dedicated scanner identity, not to a shared developer account. Ask the endpoint owner which certificate authority signs client certificates and whether the scanner identity can be restricted to the test route. For verify_ssl, the team must decide whether the private CA bundle is trusted on the scanning host or whether verification is disabled, which should be treated as a finding to justify rather than a convenience. Confirm these settings against the generator source in the garak source for generators/rest.py before relying on them, since behavior can change between releases.

Passphrase handling needs the same care. client_key_passphrase_env_var names an environment variable rather than holding the passphrase in the config file, so the value stays out of version control and shell history, but the variable must still be populated on the scan host by the secrets process you already use. Check that garak.log and the JSONL report do not echo connection details that expose the key path or proxy credentials, and restrict read access to the key file on the host. Before a full scan, run a short probe set against a non-sensitive route and confirm the handshake, the proxy path and the certificate chain with the endpoint owner. Failures here are cheap to diagnose early and expensive to diagnose mid-scan.

Which REST generator TLS and proxy settings fit which target

This table compares the five REST generator settings covering proxies, certificate verification, client certificates and key passphrases. Read each row as a question: what the setting controls, when your target needs it, and what goes wrong if it is left unset or verification is turned off. Confirm exact key behavior against the generator source for the garak version you install.

SettingWhat it controlsWhen to use itRisk if unset or disabled
proxiesRoutes garak's HTTP requests through a named corporate or egress proxyThe target is only reachable through an outbound proxy from the scan hostRequests fail or hang at the network boundary, or bypass the proxy policy your security team expects
verify_sslWhether garak checks the server certificate against trusted authoritiesLeave on for any internal endpoint, and point trust at a private CA bundle insteadDisabling it lets a spoofed endpoint receive prompts and credentials without warning
client_certPath to the client certificate garak presents during the TLS handshakeThe endpoint enforces mutual TLS and rejects clients without a certificateHandshake fails, or the endpoint returns authentication errors that look like application faults
client_keyPath to the private key that matches the client certificateAlways paired with client_cert when the endpoint requires mTLSMissing or mismatched keys produce handshake errors; keys stored in plain files need strict file permissions
client_key_passphrase_env_varName of an environment variable holding the passphrase for an encrypted client keyThe client key is encrypted and the passphrase should not appear in the YAML fileA hard-coded passphrase ends up in config files, shell history or job logs, which is a credential exposure

Configuring mTLS and proxy settings in a garak REST config

This sequence takes a scan host from confirmed endpoint TLS requirements to a working garak REST configuration that presents a client certificate, routes through the approved proxy and verifies the server against the right CA. It ends with evidence from a short connectivity probe that the handshake and requests succeed.

  1. Confirm the endpoint's TLS requirements

    Before touching garak, ask the owner of the internal LLM endpoint which client certificate and key pair the scan host must present, which private CA signed the server certificate, whether a corporate proxy must be used and whether the endpoint requires a specific TLS version or cipher. Also ask whether the client key is passphrase protected and where the passphrase will be stored. Done when you hold a written list of the certificate file, key file, CA bundle, proxy address and any passphrase handling rule, and you have confirmed that a test request with curl from the scan host succeeds using the same material.

  2. Install garak on a dedicated scan host

    On a dedicated scan host, create a virtual environment with Python 3.11 or newer, then install garak from PyPI with pip. garak is a command-line tool developed on Linux and macOS, so a Linux scan host is the common choice. Keep the certificate and key files in a directory readable only by the account that runs the scan. Done when garak --help runs inside the environment and the installed version is recorded in your change ticket so later report comparisons can be traced to a release.

  3. Create the YAML generator config

    Write a YAML file that describes the REST endpoint for garak's REST generator, including the request URL, headers, the request and response shape, and the TLS and proxy settings. The client settings are client_cert and client_key, which point to the certificate and private key files. The network settings are proxies, which names the proxy route, and verify_ssl, which should point to the private CA bundle rather than being disabled. Done when the file parses as YAML, contains no literal passphrase, and every file path in it resolves on the scan host.

  4. Supply the key passphrase through an environment variable

    If the client key is encrypted, do not place the passphrase in the YAML file or on the command line. Set the variable named in client_key_passphrase_env_var in the shell or in the service account's secret store, and confirm the name matches the config exactly. Clear shell history for any session where the value was typed. Done when a printenv check in the same session shows the variable is set, and a search of the config directory and the garak report directory for the passphrase value returns no matches.

  5. Run a short connectivity probe

    Run one small probe against the endpoint using the new config, with generations limited so the run stays small. This confirms that the client certificate is accepted, the proxy routes the request and the server certificate validates against the CA bundle. Use only a probe the endpoint owner has approved for this environment. Done when the run completes and returns generation output from the endpoint rather than a connection, handshake or certificate error. Record the command and the config file version used.

  6. Inspect garak.log for TLS errors

    Open the garak.log file written by the run and search for TLS and connection messages, such as certificate verification failures, unknown CA errors, handshake failures, proxy authentication errors and passphrase errors. Each message points to a specific setting: a verification error usually means the CA bundle path is wrong, and a handshake failure often means the client certificate or key does not match what the server expects. Done when the log shows successful requests and no TLS warnings for the endpoint, or each remaining error has been traced to a setting and fixed.

  7. Check the JSONL report for failed attempts

    Open the JSONL report from the connectivity run and confirm that each attempt has a recorded output rather than an empty or error response. A run that appears to finish but returns blank or error outputs for every attempt indicates that requests are failing at the transport layer even though garak exits normally. Done when the report contains the expected attempts with real endpoint responses, and you have shared the config version and the clean log summary with the endpoint owner before scaling up the scan.

Protecting keys, passphrases and verification settings during scans

A garak scan against an internal REST endpoint touches client keys, passphrases, TLS trust and every prompt and output the model returns. The controls below cover where those secrets and sensitive outputs sit during and after a run, so the scan does not weaken the security of the endpoint it is meant to test.

Keep private keys off shared scan hosts

The client_key file is the credential that proves the scan host may reach the endpoint. Store it on a dedicated scan host with read access limited to the account that runs garak, and keep it out of repositories, container images and shared home directories. Ask the endpoint owner whether the certificate can be issued to a scan-only identity with a short validity period, so a leaked key can be revoked without affecting production clients.

Pass passphrases through environment variables

Set client_key_passphrase_env_var to the name of an environment variable rather than writing the passphrase into the REST generator YAML. Config files are often committed, copied into tickets and attached to bug reports. Load the variable from your secrets manager at job start, and confirm that garak.log and the JSONL report do not echo the passphrase or the full request headers.

Do not disable verify_ssl to clear errors

A certificate error during the first scan usually means the private CA bundle is not configured or the endpoint certificate chain is incomplete. Setting verify_ssl to false lets garak talk to any server that answers, including a spoofed one that receives your prompts and credentials. Fix the trust path instead: point the generator at the internal CA and confirm the chain with the endpoint owner before the first run.

Review what corporate proxies can read

A forward proxy that terminates TLS can see every prompt sent during a scan, and it may log request bodies for inspection. Before setting proxies, confirm with the network team whether traffic to the model endpoint is inspected, where those logs are kept and who can read them. If the proxy decrypts traffic, treat it as part of the data path for the scan's risk assessment and document it.

Limit retention of harmful outputs

JSONL reports record each attempt and its evaluation, and many attempts contain the harmful text that garak was designed to elicit. Those reports can contain sensitive data from the application's own system prompts or retrieval context. Store them in an access-controlled location, set a retention period agreed with the data owner, and delete scratch copies when the review ends.

Restrict access to garak.log

The garak.log file continues across runs and is meant for debugging, so it accumulates request details from every scan on the host. Restrict its file permissions, avoid sharing it in support requests without review, and rotate or clear it when a scan host changes hands. Check its contents after the first scan against an endpoint that uses mTLS, since that is where a misconfigured header or path is most likely to appear.

Certificate and proxy patterns by environment

When the REST endpoint sits on an internal network and its server certificate is issued by a private certificate authority, the main risk is a scan host that does not trust that authority. The scan host needs the CA's root and any intermediate certificates available to the TLS stack garak uses. The REST generator exposes a verify_ssl setting, which controls whether certificate verification happens at all. Turning it off is a shortcut that hides trust problems and sends prompts to an endpoint whose identity you have not checked, so keep verification on and install the CA chain instead.

  • Trust the chain, not the warning: ask the endpoint owner for the full chain, including intermediates, and confirm the leaf certificate's subject alternative names match the hostname in your generator file.
  • Keep verify_ssl enabled: treat any scan that needs it disabled as an open finding to resolve with the owner before testing.
  • Confirm the CA path on the scan host: check which trust store your Python environment uses, since a system-wide CA bundle does not always cover it.
  • Check expiry and renewal: confirm the certificate's validity window covers the planned scan schedule and who renews it.
  • Test a plain request first: send one benign prompt from the scan host before running garak so trust failures appear as a single clear error.

Before the first run, confirm the hostname, the chain and the owner who renews the certificate.

Where the client certificate, proxy and private CA apply on the way to the endpoint

The scan starts on the garak host, where the REST generator reads its YAML file and builds each request. Requests leave either directly or through an optional corporate proxy, then meet the target endpoint in a TLS handshake that uses the client certificate and key to prove the scanner's identity and a private CA bundle to verify the server. Responses return to garak, which writes every attempt to the JSONL report and appends to garak.log on the same host. Check that the trust boundary crossings match what your security team has approved.

Requests cross the proxy or go direct, and both paths meet mTLS on the endpoint.

What to confirm in your environment before a scan

Garak's REST generator can reach internal endpoints that sit behind client certificates, corporate proxies and private certificate authorities. The items below are things to confirm in your own environment before the first scan, not behavior we guarantee for your setup.

Generator version supports the settings

Client certificate and key settings, proxies, TLS verification and passphrase handling are options of the REST generator, and the mTLS client certificate support was added in v0.15.0. Confirm that the installed garak version includes the settings your configuration uses, by reading the generator source for the release you have installed. Pin that version so a later upgrade does not change the behavior of a working configuration.

Generator source

Certificate and key formats

Confirm the format of the client certificate and private key the endpoint expects, and whether the key is encrypted. Check the file paths are readable by the account running the scan, and that the certificate chain includes the intermediate CA the endpoint needs. A key that is encrypted requires the passphrase to be supplied through an environment variable, so confirm that variable is set in the scan host's runtime without writing the passphrase into the YAML file.

Proxy bypass for internal hosts

A corporate proxy configured in the environment can silently route traffic to an internal LLM endpoint through the wrong path and fail or time out. Confirm which proxy settings apply to the scan host, and whether internal hostnames and address ranges are excluded from proxying. Test one request with the proxy setting in the generator configuration to see whether the request reaches the endpoint directly or through the proxy.

Certificate rotation and trust

Private CA certificates and client certificates usually rotate on a schedule that the endpoint team controls. Confirm where the trust store for the private CA lives, who renews the client certificate, and how the scan host learns about the new file. A scheduled rescan that runs after a silent rotation will fail in ways that look like endpoint outages, so record the certificate expiry date alongside each scan configuration.

Request schema the endpoint expects

The REST generator sends requests in a structure described by your YAML file, and many internal endpoints expect a specific JSON body, header set or response path. Ask the endpoint owner for an example request and response, then confirm the generator configuration matches both. A mismatch often produces empty or error responses that garak records as model output, which distorts the results.

Owner approval for scan traffic and rates

Before the scan starts, get written approval from the team that runs the endpoint for the scan window, the source host, the expected request volume and the concurrency level. Internal gateways may apply rate limits or security monitoring that treat a scan as an attack. Agree a contact who can stop the run, and confirm whether the endpoint's logs will hold the prompts and outputs garak sends.

Questions teams ask before scanning mTLS endpoints

Can our own team set up garak against an mTLS endpoint without a partner?

Yes, if your engineers already know how your private CA, client certificates and proxy policy work. garak is a free command-line tool, and its REST generator takes a short YAML file that can name a client certificate, a client key, proxies and a CA trust setting. The hard part is usually not garak but the surrounding access: getting a client certificate issued for the scan host, confirming which CA signs the server, and agreeing with the endpoint owner on who may send test traffic. A partner is most useful when those steps cross several teams or when the scan has to be repeated in a controlled way.

How long does mTLS and proxy setup take for garak?

Duration depends mostly on how many certificate authorities, proxies and approval steps sit between the scan host and the endpoint. A single endpoint behind a known internal CA with a ready client certificate is a short configuration task. Adding a corporate proxy with its own allow list, a passphrase-protected key, or a certificate chain that must be issued or renewed moves the work into change control, which usually takes longer than the configuration itself. Ask any provider to break the estimate into certificate issuance, proxy rules, test requests and approvals, and to state which of those depend on people outside the project.

What makes an mTLS garak setup more or less effort?

Four factors move the effort most:

  • The number of endpoints, since each needs its own generator configuration, certificate pair and test pass.
  • PKI maturity, meaning whether the internal CA publishes clear chains and whether certificates have documented owners and renewal dates.
  • Proxy policy, including whether the proxy inspects TLS, requires authentication, or blocks traffic to model hosts.
  • Change control, because test traffic against an internal model often needs sign-off from the endpoint owner, the network team and the security team.

Each factor can be reduced by settling it before the scan starts.

What must our team provide before a garak scan of an internal endpoint?

Your team needs to provide the endpoint details, a client certificate and key for the scan host, the CA bundle that signs the server, and written approval to send test prompts. Endpoint details include the URL, request and response shape for the REST generator, expected rate limits and a named contact for the model owner. Certificates should come from your PKI team with the chain and expiry date recorded. Approvals should cover the scan window, the request volume, and where reports containing harmful prompts and outputs will be stored. Ask any partner to list these inputs in the written scope before work begins.

Is it ever acceptable to turn off verify_ssl in garak?

Disabling verify_ssl should be treated as a temporary diagnostic step, not a production setting. With verification off, the scan host cannot confirm that it is talking to the intended model endpoint, so a misrouted or spoofed service could receive prompts and return responses that look valid. A safer path is to point the REST generator at the correct CA bundle, confirm the chain with your PKI team, and keep verification on for every scheduled or CI run. If verification must be disabled to unblock a test, limit it to a non-sensitive environment, record who approved it, and restore verification before the results are used as evidence.

Is garak free, and what license does it use?

garak is licensed under the Apache 2.0 license and is developed in the NVIDIA GitHub organization. The maintainers describe it as a free tool, and its user guide is published at the garak documentation site. The license covers using the software without paying the project, but your costs still arise elsewhere: the time your engineers spend, the compute or model API calls the scan consumes, and any outside help you buy. Confirm the license terms in the repository for your exact release, and check with your legal team before redistributing modified versions.

How do we get help with an mTLS garak setup on a fixed scope?

DeployOpen runs most engagements as fixed-scope work, with scope, deliverables and timelines agreed in writing before any work starts. For garak, that scope would typically cover the endpoints in scope, the generator configuration, certificate and proxy handling, a verified test run, and the report handling rules your team needs. A quote follows from that written scope, and DeployOpen does not publish a price list. Ongoing scheduled rescans or support can be arranged as a retainer. Ask for the scope in writing and confirm which steps depend on your own PKI, network and approval teams.

What a DeployOpen engagement covers for garak REST targets

A DeployOpen engagement for garak REST targets starts with a review of how the internal endpoint secures itself: which TLS versions and cipher policies it enforces, whether it requires client certificates, which private CA issued the server and client certificates, and whether a corporate proxy sits in the path. That review decides the generator configuration. From there the work covers writing the REST generator config, including the proxies, verify_ssl, client_cert and client_key settings, and setting up client_key_passphrase_env_var so that a key passphrase is read from the environment rather than stored in a file. Secrets handling is agreed with the client's security team before any key material is moved onto the scan host.

Next, the engagement validates connectivity from the scan host with small, controlled requests before any full probe run, so that certificate, proxy and routing failures surface early and are not mistaken for model behavior. The scan host is documented: its operating system and Python environment, where garak writes reports and garak.log, who can read them, and the retention rules that apply to reports containing harmful prompts and outputs. A runbook then records how to rotate certificates, how to handle an expired client certificate, and who to contact on the endpoint owner's side. Scope, deliverables and timelines are agreed in writing before work starts. DeployOpen does not publish prices, so a quote follows from that written scope. Ask for the exact list of endpoints, the certificate authority arrangement and the retention requirement in the quote request, since each one changes the effort.

How DeployOpen scopes and supports garak REST integrations

This sequence takes an internal LLM endpoint from a written scope through a verified garak REST configuration inside your network, then hands over the files and runbook your team needs to keep it working. Retainers cover ongoing changes when endpoints or certificates rotate.

  1. Inventory the endpoints and access paths

    DeployOpen and your platform team list each target endpoint, its URL and response format, and the network path garak will take, including any corporate proxy or egress rules. Your team confirms which hosts can reach the endpoint from the scan host and which ones cannot. The step closes with a written inventory that both sides have signed off on.

  2. Confirm the certificate chain and trust model

    Your security or PKI team identifies the client certificate and key pair the endpoint expects, the private CA that issued the server certificate, and whether the endpoint enforces mutual TLS on every route. DeployOpen records where each file lives, who owns its renewal and how it is delivered to the scan host. The step closes when the team agrees on the trust chain and the owner of each certificate.

  3. Define the passphrase and secret handling

    If the client key is passphrase-protected, DeployOpen agrees with your team how the passphrase reaches garak through an environment variable named in the generator configuration, and how that variable is populated without appearing in shell history, config files committed to source control or job logs. Ownership of the secret store and rotation steps are written down. The step closes with a documented secret path that your security team has reviewed.

  4. Write and review the REST generator configuration

    DeployOpen drafts the YAML that describes the endpoint, including proxies, verify_ssl, client_cert, client_key and the passphrase variable, and reviews it with your engineers against the garak REST generator source. Settings that disable verification are flagged for explicit approval and recorded in the scope. The step closes with a reviewed configuration file stored in the repository you choose.

  5. Verify connectivity and trust in your environment

    DeployOpen runs a small set of test requests from the scan host inside your environment to confirm the TLS handshake, client authentication, proxy routing and response parsing. Failures are traced to the certificate, proxy, DNS or endpoint layer and fixed before any security probes run. The step closes with a connectivity report showing successful authenticated requests and the exact settings that produced them.

  6. Run the agreed scan and deliver the runbook

    DeployOpen runs the scope agreed in writing and produces the garak JSONL report and log files, stored where your retention policy requires. The handover includes the configuration, a runbook for rotating certificates and passphrases, and the steps to rerun the scan. The step closes when your team has rerun the test once from its own tooling or confirmed that it can.

  7. Support changes through a retainer

    When an endpoint moves, a certificate is renewed or a proxy policy changes, your team asks DeployOpen to update the configuration under an ongoing support retainer, with the change reviewed and retested in your environment. Retainer scope, response expectations and what counts as a change are agreed in writing before the retainer starts. The step closes with an updated configuration, a retest result and a change record.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.