Skip to main content

FIPS 140-3 image

FIPS 140-3 is the United States government standard for cryptographic modules. US federal agencies, their contractors and many regulated companies may only protect data with cryptography from a module that the NIST Cryptographic Module Validation Program has tested and certified. The spanway-ai-fips image is the full gateway image built so that all of its encryption, hashing and TLS goes through such a module: the OpenSSL FIPS provider 3.1.2, which holds FIPS 140-3 certificate #4985 (listed by NIST in March 2025). The image switches FIPS mode on by default, so an algorithm the FIPS policy does not approve, such as MD5 for security use, is refused instead of quietly used.

When to use it​

Use the FIPS image when a contract, an authority to operate or an internal policy says the gateway must use FIPS validated cryptography, for example a FedRAMP or DoD workload, a state agency, or a bank or health system that inherited the rule from a government customer.

Keep the standard spanway-ai image when nobody asks for FIPS. The FIPS image is the same gateway with the same features, but it refuses a few things the standard image allows (see what changes in FIPS mode), it hashes Admin UI passwords with a different algorithm, and moving an existing installation onto it needs the steps in moving an existing gateway.

A real-world scenario​

A systems integrator runs the gateway for a federal agency. The agency's security officer asks for proof that the gateway encrypts with a validated module. The integrator deploys spanway-ai-fips instead of spanway-ai, runs spanway-container fips-check in the new container and attaches its output, the provider listing and certificate #4985 to the agency's security package. When a developer later points an OpenTelemetry exporter at a gRPC endpoint, the page's limits section tells them to switch it to OTLP over HTTP so the traces leave through the validated module too.

Steps​

  1. Pull the FIPS image from your registry. The registry address and pull credentials are in your Spanway onboarding pack.

    docker pull registry.spanway.ai/spanway/spanway-ai-fips:v2.0.0
  2. Run the FIPS self-check. It needs no database and no configuration.

    docker run --rm --entrypoint spanway-container registry.spanway.ai/spanway/spanway-ai-fips:v2.0.0 fips-check
  3. Check which provider OpenSSL loaded.

    docker run --rm --entrypoint openssl registry.spanway.ai/spanway/spanway-ai-fips:v2.0.0 list -providers
  4. Start the gateway exactly as you start spanway-ai, with the same variables and config file. In the all-in-one Helm chart set image.repository to registry.spanway.ai/spanway/spanway-ai-fips, and in docker compose change the image: line.

    docker run --rm -p 4000:4000 \
    -e SPANWAY_MASTER_KEY="$SPANWAY_MASTER_KEY" \
    -e SPANWAY_SALT_KEY="$SPANWAY_SALT_KEY" \
    -e DATABASE_URL="$DATABASE_URL" \
    registry.spanway.ai/spanway/spanway-ai-fips:v2.0.0
  5. Confirm the gateway answers and that it started in FIPS mode.

    curl http://localhost:4000/health/liveliness
    docker logs <container> 2>&1 | grep "FIPS mode is on"
  6. Sign in to the Admin UI at http://localhost:4000/ui as you would on the standard image. There is no FIPS switch in the Admin UI, because FIPS mode belongs to the image you deploy, not to a setting an admin can change at run time.

Expected result​

The self-check prints one PASS line per check and ends with FIPS self-check passed, and exits 0:

PASS SPANWAY_FIPS_MODE is on
PASS OPENSSL_CONF is set
PASS OpenSSL asks for FIPS approved algorithms by default
PASS SHA-256 works under the FIPS policy
PASS MD5 is refused for security use
PASS the cryptography library uses the same OpenSSL as Python
PASS the cryptography library runs in FIPS mode
PASS the cryptography library encrypts with AES-256-GCM
PASS the cryptography library refuses MD5
PASS TLS client contexts can be created
FIPS self-check passed

The provider listing shows OpenSSL FIPS Provider, version: 3.1.2 and status: active, next to the base and default providers. The gateway answers "I'm alive!" and its startup output carries Spanway Proxy: FIPS mode is on, OpenSSL <version> enforces the FIPS 140-3 policy.

How the image is built​

The image is the standard compiled gateway image plus four things, and the release only publishes it when the self-check passes.

PartWhat it does
The FIPS provider fips.soBuilt from the unmodified OpenSSL 3.1.2 source release, checked against its published SHA-256, with the build steps the module's security policy prescribes. At image build time openssl fipsinstall runs the provider's self-tests and records its integrity checksum in /etc/ssl/fipsmodule.cnf. The provider repeats its self-tests every time a process loads it.
/etc/ssl/openssl-fips.cnfLoads the FIPS provider and sets default_properties = fips=yes, so every lookup of an algorithm asks for a FIPS approved implementation. OPENSSL_CONF points every process at it, Python and the Node based Prisma CLI included. An error in this file stops the process instead of falling back.
The cryptography library built from sourceThe published wheels of the Python cryptography library carry their own copy of OpenSSL. The FIPS image replaces it with the same locked version built against the image's OpenSSL, so there is only one OpenSSL, and one FIPS boundary, in the process. The tools that build it (maturin, cffi, setuptools and pycparser) are pinned by version and checked against recorded hashes, so two builds of the same release produce the same library.
SPANWAY_FIPS_MODE=trueTurns on the gateway's FIPS behaviour listed below and its startup checks.

The release workflow builds the image for linux/amd64 and linux/arm64, runs the same self-check and the provider listing in each built image, and stops the release if any check fails, before the image is tagged or signed. The image is signed and carries an SBOM like every other image, see container images.

What changes in FIPS mode​

AreaStandard imageFIPS image
Admin UI passwordsStored as scrypt hashesStored as PBKDF2-HMAC-SHA256 with 600,000 rounds and a random 16 byte salt, because the FIPS provider has no scrypt. Each check runs on a worker thread, so a burst of sign-ins does not hold up model traffic, and a sign-in for an unknown username costs the same check, so response times do not reveal which accounts exist
Secrets stored in the database (provider keys, SSO secrets, MCP credentials)Written with the cipher general_settings.encryption_algorithm picks, the legacy one by defaultAlways written with AES-256-GCM, whatever encryption_algorithm says
MCP bridge envelopes and gateway session keysKeys derived from the master key with scrypt, the upstream token sealed with the legacy cipherKeys derived with PBKDF2-HMAC-SHA256, the upstream token sealed with AES-256-GCM
TLS to providers and MCP serversssl_verify: false is allowedThe gateway refuses to start when certificate checks are turned off, and only FIPS approved cipher suites are offered
MD5, BLAKE2, ChaCha20 and other non-approved algorithmsAllowedRefused for any security use. The gateway still computes MD5 or BLAKE2 where they only build an identifier or a cache key, which the FIPS policy allows
The plaintext password migration at startupRuns in the backgroundRuns before the gateway serves, and a failure stops the start, so no password stays unhashed

Moving an existing gateway​

  1. Move the stored secrets to AES-256-GCM on the standard image first, with the credential encryption migration, until its check shows residual_legacy: 0. The FIPS image can still read values in the legacy format, but only the migration turns them into FIPS approved ciphertext.
  2. Plan for Admin UI passwords. A password stored as scrypt cannot be checked in FIPS mode, so its user cannot sign in with it. Have those users sign in with SSO, or set their password again after the switch so it is stored with PBKDF2. Plaintext passwords left by an old version are hashed with PBKDF2 at the first start.
  3. Expect MCP clients connected through the OAuth bridge or the gateway's own MCP sign-in to sign in again once, because their tokens were signed with keys derived the other way.
  4. Swap the image, keep every other setting, and run the steps above.

Limits​

  • The certificate covers the OpenSSL FIPS provider module, not the gateway. Spanway is not itself a validated module, and using the image does not make a system FIPS compliant on its own. Your assessor decides whether the module's certificate covers your platform. The certificate lists the operating environments NIST tested, and running the provider anywhere else, as with most container images, is the vendor affirmed use the provider's security policy describes.
  • Only spanway-ai-fips is built in FIPS mode. The componentised spanway-gateway, spanway-backend and spanway-migrations images, the spanway-ui image, the Lens worker image and the standalone Admin Assistant image have no FIPS variant yet, so a FIPS deployment uses the all-in-one image, for example with the spanway-helm chart.
  • OpenTelemetry exporters that speak gRPC use the gRPC library's own TLS code, which is not inside the FIPS boundary. Use the OTLP over HTTP exporter (otlp_http) for traces, logs and metrics.
  • Secrets written before the switch in the legacy format are still decrypted, with the libsodium library, so they can be migrated. Until the credential encryption migration has run, those values are not protected by FIPS approved cryptography.
  • The spanwayctl gateway migration command reads a source database through a Postgres driver that carries its own OpenSSL. Run it from a machine outside the FIPS boundary or over a connection without TLS inside a trusted network.
  • The default OpenSSL provider stays loaded for lookups that explicitly ask for a non-security algorithm, such as an MD5 checksum that only names a cache entry. Any lookup without that explicit opt out gets the FIPS provider or fails.
  • Model providers and MCP servers must accept TLS 1.2 or 1.3 with a FIPS approved cipher suite. All major model providers do. A self-hosted server with an old TLS setup can fail the handshake, which shows as a connection error in the request logs.

Settings​

SettingDefaultWhat it does
SPANWAY_FIPS_MODEtrue in spanway-ai-fips, unset in the other imagesTurns FIPS mode on. On: the gateway uses the FIPS approved algorithms above and refuses to start unless the process really enforces FIPS and TLS certificate checks are on. Off: the gateway behaves like the standard image. Leave it on in the FIPS image. Setting it to true on the standard image only makes the gateway refuse to start, because that image's OpenSSL does not enforce FIPS. Accepted values are true, false, 1, 0, yes, no, on and off.
OPENSSL_CONF/etc/ssl/openssl-fips.cnf in spanway-ai-fipsTells OpenSSL which configuration to read. Changing or unsetting it turns the FIPS provider off, and the self-check then fails. Do not change it.

Errors​

These stop the gateway at startup with exit status 1 and print the message on standard error. They come from the FIPS startup checks, which run only when SPANWAY_FIPS_MODE is on.

MessageMeaningFix
Spanway proxy refused to start: SPANWAY_FIPS_MODE=<value> is not a boolean.The variable holds something other than a true or false value.Set it to true or false, or unset it.
Spanway proxy refused to start: SPANWAY_FIPS_MODE is on but this Python does not enforce FIPS.FIPS mode was asked for on an image whose OpenSSL still allows non-approved algorithms, usually the standard spanway-ai image, or a FIPS image whose OPENSSL_CONF was changed.Run spanway-ai-fips with its default environment, or turn FIPS mode off.
Spanway proxy refused to start: SPANWAY_FIPS_MODE is on but TLS certificate verification is disabled by <source>.SSL_VERIFY=false or ssl_verify: false in spanway_settings turns off certificate checks, which FIPS deployments must keep.Remove the override, or point ssl_verify at a CA bundle file instead.
Password migration failed, so plaintext passwords stay unhashed in the database: <reason>. followed by a stopped startThe startup password migration could not hash a plaintext password with an approved algorithm. In FIPS mode the gateway does not serve with plaintext passwords left.Run the FIPS image with its default environment, then restart.

The self-check exits with status 1 and prints a FAIL <check>: <fix> line for every check that failed, followed by FIPS self-check failed, FIPS mode is off. Each line names what to fix, for example FAIL MD5 is refused for security use: a non-FIPS provider still answers, remove it from the OpenSSL configuration.

An Admin UI sign-in with a scrypt password answers 401 in FIPS mode, the same answer as a wrong password, so the reason is not given away to the person signing in. The gateway log says why, see below.

Logs​

LevelLineMeaningAction
OutputSpanway Proxy: FIPS mode is on, OpenSSL <version> enforces the FIPS 140-3 policyThe startup checks passed and the gateway runs in FIPS mode. It is printed at every log level.None. Keep the line as evidence for an audit.
WARNINGSign-in refused: this password was stored with scrypt, which FIPS mode cannot check. Set the user's password again, or sign in with SSO, so it is stored with PBKDF2-HMAC-SHA256A user whose password was set on the standard image tried to sign in.Reset that user's password, or have them use SSO.
ERRORPassword migration failed, so plaintext passwords stay unhashed in the database: <reason>. This is what an OpenSSL FIPS provider reports when the hashing algorithm is not approved.The startup password migration hit an algorithm the FIPS provider refused. In FIPS mode the start stops after this line.Run the FIPS image with its default environment, then restart.

The FIPS image adds no Prometheus metric and no audit row of its own, because FIPS mode is fixed for the life of the container and nobody can change it through the API or the Admin UI. The startup log line and the self-check output are the evidence an auditor asks for.