Files
seaweedfs/weed/command/scaffold/security.toml
T
5e4b2fc42f docker: one FIPS mode for the Go processes and the Rust binaries (#13296)
* docker: one FIPS mode for the Go processes and the Rust binaries

In the image, Go processes ran with fips140=on by default (#7590) while the
Rust binaries, which take their mode from fips.mode alone, ran with
unrestricted TLS; and WEED_FIPS_MODE=off or strict made every Go process
refuse to start, since the entrypoint's fips140=on did not match.

The entrypoint now states the image's mode once, as
WEED_FIPS_MODE_DEFAULT=on, and gives Go processes the fips140 GODEBUG that
matches WEED_FIPS_MODE, else that default. The Rust binaries use the
default when neither WEED_FIPS_MODE nor fips.mode sets a mode; Go processes
check their GODEBUG against it and refuse to start on a mismatch, naming
WEED_FIPS_MODE as the way to pick another mode. Setting
WEED_FIPS_MODE_DEFAULT empty leaves every process in its own default, as
outside the image.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docker: take the image's FIPS mode from a fips140 the caller sets

GODEBUG=fips140=off, the entrypoint's advice since #7590, made every Go
process exit once the Rust binaries joined the image's mode. The entrypoint
now maps the caller's fips140 to WEED_FIPS_MODE_DEFAULT, so Go and Rust run
in that mode and the old advice keeps working.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docker: say fips.mode alone cannot change the image's FIPS mode

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docker: read an empty fips140 as off and debug as on, as Go does

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docker: warn when GODEBUG fips140 picks the image's FIPS mode

The entrypoint keeps translating a caller's fips140 into the mode for the
Rust binaries, so existing docker run setups keep starting, but logs that
WEED_FIPS_MODE is the setting that also covers launches without the
entrypoint.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docker: set the FIPS mode after dropping privileges

Running as root, the entrypoint re-runs itself through su-exec, and the
second pass took the fips140 the first pass had exported for the caller's
own, warning on default starts and prepending fips140 twice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
2026-12-03 10:29:05 -08:00

399 lines
19 KiB
TOML

# Put this file to one of the location, with descending priority
# ./security.toml
# $HOME/.seaweedfs/security.toml
# /etc/seaweedfs/security.toml
# this file is read by master, volume server, filer, and worker
# Any value below can also be supplied as an environment variable instead of
# living in this file: prefix the key with WEED_, upper-case it, and replace
# "." with "_". This is the recommended way to inject the secrets in here from
# a Kubernetes Secret (env valueFrom.secretKeyRef) rather than a ConfigMap.
# The JWT signing keys map to these env vars. When each component gets its own
# set, give it every key it signs or verifies with:
# WEED_JWT_SIGNING_KEY master, volume, filer, weed shell
# WEED_JWT_SIGNING_READ_KEY master, volume, and every process that
# reads chunks from volume servers: filer,
# s3, mount, webdav, sftp, filer.sync,
# filer.backup, workers, admin, weed shell
# WEED_JWT_FILER_SIGNING_KEY filer, s3, admin and workers (admin IAM and
# worker gRPC calls), and clients of the filer
# HTTP API
# WEED_JWT_FILER_SIGNING_READ_KEY filer, s3, and clients of the filer HTTP API
# WEED_JWT_FILER_SIGNING_SUBSCRIBE_KEY filer metadata subscriptions
# WEED_JWT_FILER_SIGNING_GRPC_KEY filer filesystem gRPC scope and assignment proofs
# WEED_JWT_FILER_SIGNING_GRPC_PREVIOUS_KEY
# previous gRPC scope and assignment-proof key during rotation
# A set env var wins over the file, so the file can stay empty (or absent).
# The FIPS 140-3 mode of every process that reads this file: "off", "on" or
# "strict" (WEED_FIPS_MODE). Unset, WEED_FIPS_MODE_DEFAULT applies, which the
# Docker image's entrypoint sets to "on"; without it each process stays as it
# is. Go processes take the mode from GODEBUG and refuse to start when it
# differs: "off" needs fips140=off, "on" needs fips140=on, "strict" needs
# fips140=only. The Rust
# volume server, workers and vector engine take it from here: under "on" and
# "strict" their TLS offers and accepts only the FIPS 140-3 versions, cipher
# suites, key exchange groups and signature schemes Go allows in that mode.
# This restricts behaviour only; the Rust binaries do not yet use a validated
# cryptographic module.
[fips]
mode = ""
# comma separated origins allowed to make requests to the filer and s3 gateway.
# enter in this format: https://domain.com, or http://localhost:port
[cors.allowed_origins]
values = "*"
# this jwt signing key is used for write operations on volume servers:
# - the Master server generates the JWT, which can be used to write a certain file on a volume server
# - the Filer generates it for the chunk writes it proxies to volume servers,
# and weed shell for fs.merge_volumes and fs.distribute_chunks
# - the Volume server validates the JWT on writing
# the jwt defaults to expire after 10 seconds.
[jwt.signing]
key = ""
expires_after_seconds = 10 # seconds
# Optional. A key that is still accepted when verifying, but never used to
# sign, so keys can rotate without rejected requests: set the new key as
# previous_key everywhere, then swap key and previous_key everywhere, then,
# once tokens signed with the old key have expired, clear previous_key.
# Reload (SIGHUP) or restart after each step. [jwt.signing.read],
# [jwt.filer_signing] and [jwt.filer_signing.read] take previous_key the same way.
# Env: WEED_JWT_SIGNING_PREVIOUS_KEY, WEED_JWT_SIGNING_READ_PREVIOUS_KEY,
# WEED_JWT_FILER_SIGNING_PREVIOUS_KEY, WEED_JWT_FILER_SIGNING_READ_PREVIOUS_KEY
previous_key = ""
# by default, if the signing key above is set, the Volume UI over HTTP is disabled.
# by setting ui.access to true, you can re-enable the Volume UI. Despite
# some information leakage (as the UI is not authenticated), this should not
# pose a security risk.
[access]
ui = false
# by default the filer UI is enabled. This can be a security risk if the filer is exposed to the public
# and the JWT for reads is not set. If you don't want the public to have access to the objects in your
# storage, and you haven't set the JWT for reads it is wise to disable access to directory metadata.
# This disables access to the Filer UI, and will no longer return directory metadata in GET requests.
[filer.expose_directory_metadata]
enabled = true
# HTTP Basic Auth on the filer HTTP ports (-port and -port.readonly). Once the
# password is set, every request needs these credentials or a valid filer JWT
# (see [jwt.filer_signing]), and an access level without a JWT key is no longer
# open. /healthz and /readyz stay open. A browser request from another website
# (an Origin other than the filer's own host) can use these credentials only if
# its origin is listed in cors.allowed_origins. Components that call the filer HTTP
# port (mount, filer.sync and filer.backup with -filerProxy, sftp, volume.fsck)
# authenticate with the filer JWT, so set jwt.filer_signing.key, and
# jwt.filer_signing.read.key for their reads, if you run them.
# Env: WEED_FILER_BASIC_AUTH_USER, WEED_FILER_BASIC_AUTH_PASSWORD
[filer.basic_auth]
user = ""
password = ""
# HTTP Basic Auth on the WebDAV gateway (weed webdav, weed server -webdav,
# weed mini). Without a password, anyone who can reach the WebDAV port reads,
# writes and deletes everything under its -filer.path, and weed mini binds
# WebDAV to 127.0.0.1 unless -webdav.allowInsecureBind is set. Basic Auth
# sends the password in every request, so serve WebDAV over TLS
# (-webdav.cert.file, -webdav.key.file) on an untrusted network.
# Env: WEED_WEBDAV_BASIC_AUTH_USER, WEED_WEBDAV_BASIC_AUTH_PASSWORD
[webdav.basic_auth]
user = ""
password = ""
# this jwt signing key is used for read operations on volume servers:
# - the Master server generates the JWT, which can be used to read a certain file on a volume server
# - every process that reads chunks straight from volume servers generates its
# own: filer, s3, mount, webdav, sftp, filer.sync, filer.backup, workers,
# admin and weed shell. Without the key, their reads fail with "wrong jwt".
# - the Volume server validates the JWT on reading
[jwt.signing.read]
key = ""
expires_after_seconds = 10 # seconds
previous_key = ""
# If this JWT key is configured, Filer only accepts writes over HTTP if they are signed with this JWT:
# - f.e. the S3 API Shim generates the JWT
# - the Filer server validates the JWT on writing
# NOTE: This key is ALSO used as a fallback signing key for S3 STS if s3.iam.config does not specify a signingKey.
# NOTE: This key also gates the filer IAM gRPC service (CreateUser, PutPolicy,
# CreateAccessKey, ...). When set, every IAM RPC must carry a Bearer
# token signed with this key in its "authorization" gRPC metadata; mint
# such a token with security.GenJwtForFilerAdmin. When empty, the IAM
# gRPC service runs unauthenticated and refuses its OIDC provider and
# role RPCs. When set, set it on both filer and admin.
# The key does not protect the other filer gRPC RPCs, which can read and
# write the IAM store under /etc/iam; if the filer gRPC port is reachable
# beyond a trusted network, enable [grpc.filer] mTLS below.
# the jwt defaults to expire after 10 seconds.
# Filesystem gRPC callers may send authorization: Bearer <token> signed with
# this key. allowed_prefixes grant read/write paths; read_prefixes grant reads.
# allowed_methods optionally restricts gRPC method names. Scoped tokens require
# jti and exp, need assignment proofs for new chunk ids, and cannot call unruled
# methods. New inline content is allowed within the token's writable paths.
# Calls without a token retain their existing behavior. This is scope enforcement,
# not mandatory authentication; restrict network access to the filer as before.
# Rolling upgrades: enable scoped writers only after every filer runs this
# version or newer. Scope-only filers refuse new chunk ids even with a proof;
# older filers without scope enforcement treat scoped tokens as unscoped.
[jwt.filer_signing]
key = ""
expires_after_seconds = 10 # seconds
previous_key = ""
# Optional filesystem gRPC signing key; when unset, key above is used. Setting
# this alone enables gRPC scope checks without changing HTTP authentication.
# When grpc_key is set, grpc_previous_key is also accepted for gRPC scope
# tokens and assignment proofs. The HTTP previous_key remains excluded from
# this separate trust domain. Keep grpc_previous_key configured for at least
# assign_expires_after_seconds plus the scoped token lifetime after rotating.
# When grpc_key is unset, the shared HTTP current/previous pair is used.
# grpc_key = ""
# grpc_previous_key = ""
# Require every filesystem gRPC call to carry a valid bearer token. This also
# refuses verified mTLS peers that do not present a token. The setting is off
# by default for compatibility with existing tokenless callers.
# grpc_require_token = false
# AssignVolume returns a proof bound to the holder, chunk-ID range and resolved
# collection in assign_auth. Return it under the chunk's file id in chunk_auth
# when storing the entry. Auth remains the separate volume-upload credential.
# Proofs always expire: zero or negative lifetime uses the default of 86400 seconds.
# assign_expires_after_seconds = 86400
# Clock-skew allowance for scope and proof validation; negative means zero.
# clock_leeway_seconds = 30
# If this JWT key is configured, Filer only accepts reads over HTTP if they are signed with this JWT:
# - f.e. the S3 API Shim generates the JWT
# - the Filer server validates the JWT on reading
# the jwt defaults to expire after 10 seconds.
[jwt.filer_signing.read]
key = ""
expires_after_seconds = 10 # seconds
previous_key = ""
# Optional. If this key is set, the filer's SubscribeMetadata and
# SubscribeLocalMetadata gRPC calls require an mTLS-verified peer, an admin
# token signed with jwt.filer_signing.key, or a read-only token signed with this
# key. That token is an HS256 JWT with "exp", "allowed_methods" (a subset of
# SubscribeMetadata and SubscribeLocalMetadata) and "allowed_prefixes"
# (absolute paths); its holder only receives events whose paths are all under
# one of the prefixes. Mint one with "fs.meta.token" in weed shell. Without
# mTLS, set jwt.filer_signing.key and this key on every filer, S3 gateway,
# mount and filer.sync too, so they keep full access.
[jwt.filer_signing.subscribe]
key = ""
# gRPC mTLS configuration
# All gRPC TLS authentications are mutual (mTLS)
# The values for ca, cert, and key are paths to the certificate/key files
# The host name is not checked, so the certificate files can be shared.
# Set verify_server_host = true under [grpc] or a [grpc.<component>] section to
# require that a server certificate is valid for the host or IP that component
# dials, as the Rust volume server always does.
# Each [grpc.<component>] section also accepts optional client_cert/client_key,
# presented when that component dials other servers. Set them when your CA
# issues separate serverAuth-only and clientAuth-only certificates; when unset,
# the component reuses cert/key for both directions.
# If client and server certificates come from different issuing CAs, put both
# CA certificates in the ca PEM file.
# Once a component's cert/key are set, any error loading them or grpc.ca is
# fatal: the component never falls back to plaintext.
[grpc]
ca = ""
verify_server_host = false
# Set wildcard domain for enable TLS authentication by common names
allowed_wildcard_domain = "" # .mycompany.com
# Optional allowlist a client checks the dialed server's certificate against:
# the subject common name, a DNS SAN, or a URI SAN (e.g. a SPIFFE id) must be
# listed, or match allowed_server_wildcard_domain, else the handshake fails.
# With a per-workload CA, list the identities each server may present so one
# workload cannot impersonate another component. Unset accepts any CA-signed
# server certificate, as before. Any [grpc.<component>] section may set its own
# allowed_server_commonNames to override this list. Only the filer scopes it
# further per dialed target: [grpc.filer] master_, volume_ and
# s3_allowed_server_commonNames. Other components dial every server with one
# allowlist and refuse to start when per-target keys are their only allowlist.
allowed_server_commonNames = "" # comma-separated server identities
allowed_server_wildcard_domain = "" # .mycompany.com
# Client certificate common names that every mTLS gRPC server accepts for the
# standard grpc.health.v1.Health service only. Give a monitoring probe a
# CA-signed client certificate with one of these names, e.g. blackbox_exporter's
# grpc prober, or grpc_health_probe with -tls-client-cert run as a Kubernetes
# exec probe (the built-in Kubernetes grpc probe cannot present a client
# certificate). The probe can check that the port serves and that the server
# certificate is valid, but any other RPC is refused with PermissionDenied. The
# names need no place in allowed_commonNames, and a name listed here stays
# confined even if it is.
health_check_commonNames = "" # comma-separated, e.g. "blackbox-exporter"
# Volume server gRPC options (server-side)
# Enables mTLS for incoming gRPC connections to volume server
[grpc.volume]
cert = ""
key = ""
client_cert = ""
client_key = ""
allowed_commonNames = "" # comma-separated SSL certificate common names
# Master server gRPC options (server-side)
# Enables mTLS for incoming gRPC connections to master server
[grpc.master]
cert = ""
key = ""
client_cert = ""
client_key = ""
allowed_commonNames = "" # comma-separated SSL certificate common names
# Filer server gRPC options (server-side)
# Enables mTLS for incoming gRPC connections to filer server
[grpc.filer]
cert = ""
key = ""
client_cert = ""
client_key = ""
allowed_commonNames = "" # comma-separated SSL certificate common names
# S3 server gRPC options (server-side)
# Enables mTLS for incoming gRPC connections to S3 server
[grpc.s3]
cert = ""
key = ""
client_cert = ""
client_key = ""
allowed_commonNames = "" # comma-separated SSL certificate common names
[grpc.msg_broker]
cert = ""
key = ""
client_cert = ""
client_key = ""
allowed_commonNames = "" # comma-separated SSL certificate common names
[grpc.msg_agent]
cert = ""
key = ""
client_cert = ""
client_key = ""
allowed_commonNames = "" # comma-separated SSL certificate common names
[grpc.admin]
cert = ""
key = ""
client_cert = ""
client_key = ""
allowed_commonNames = "" # comma-separated SSL certificate common names
[grpc.worker]
cert = ""
key = ""
client_cert = ""
client_key = ""
allowed_commonNames = "" # comma-separated SSL certificate common names
[grpc.mq]
cert = ""
key = ""
client_cert = ""
client_key = ""
allowed_commonNames = "" # comma-separated SSL certificate common names
# weed-vector gRPC options (server-side)
# Enables mTLS for incoming gRPC connections to the vector engine; the S3
# gateway dials it with [grpc.client], and the engine dials the masters with
# [grpc.client] too. The files are re-read every WEED_TLS_CERT_REFRESH_INTERVAL
# (default 5h) and on SIGHUP.
[grpc.vector]
cert = ""
key = ""
allowed_commonNames = "" # comma-separated SSL certificate common names
# gRPC client configuration for outgoing gRPC connections
# Used by clients (S3, mount, backup, benchmark, filer.copy, filer.replicate, upload, etc.)
# when connecting to any gRPC server (master, volume, filer)
[grpc.client]
cert = ""
key = ""
# HTTPS client configuration for outgoing HTTP connections
# Used by S3, mount, filer.copy, backup, and other clients when communicating with master/volume/filer
# Set enabled=true to use HTTPS instead of HTTP for data operations (separate from gRPC)
# If [https.filer] or [https.volume] are enabled on servers, clients must have [https.client] enabled=true
[https.client]
enabled = false # Set to true to enable HTTPS for all outgoing HTTP client connections
cert = "" # Client certificate for mTLS (optional if server doesn't require client cert)
key = "" # Client key for mTLS (optional if server doesn't require client cert)
ca = "" # CA certificate to verify server certificates (required when enabled=true)
insecure_skip_verify = false # Skip TLS certificate verification (NOT recommended for production)
# Volume server HTTPS options (server-side)
# Enables HTTPS for incoming HTTP connections to volume server
[https.volume]
cert = ""
key = ""
ca = ""
# Master server HTTPS options (server-side)
# Enables HTTPS for incoming HTTP connections to master server (web UI, HTTP API)
[https.master]
cert = ""
key = ""
ca = ""
# Filer server HTTPS options (server-side)
# Enables HTTPS for incoming HTTP connections to filer server (web UI, HTTP API)
[https.filer]
cert = ""
key = ""
ca = ""
# disable_tls_verify_client_cert = true|false (default: false)
# Admin server HTTPS options (server-side)
# Enables HTTPS for incoming HTTP connections to admin server
[https.admin]
cert = ""
key = ""
ca = ""
# Admin server authentication
# If password is set, users must login to access the admin interface
# These can be overridden by environment variables with WEED_ prefix:
# WEED_ADMIN_USER, WEED_ADMIN_PASSWORD
# WEED_ADMIN_READONLY_USER, WEED_ADMIN_READONLY_PASSWORD
[admin]
user = ""
password = ""
[admin.readonly]
user = ""
password = ""
# SSE-S3 server-side encryption key management
# These settings configure the Key Encryption Key (KEK) for S3 SSE-S3 encryption.
# Set exactly one of kek or key. If neither is set, SSE-S3 is disabled.
# Can also be set via env vars: WEED_S3_SSE_KEK, WEED_S3_SSE_KEY
[s3.sse]
# hex-encoded 256-bit key, same format as the legacy /etc/s3/sse_kek filer file.
# Use this to migrate from a filer-stored KEK: copy the value from /etc/s3/sse_kek.
# Generate a new one with: openssl rand -hex 32
kek = ""
# any secret string; a 256-bit key is derived automatically via HKDF-SHA256.
# Cannot be used while /etc/s3/sse_kek exists on the filer — delete it first.
key = ""
# Trusted reverse proxies allowed to set forwarding headers on behalf of the
# real client: X-Forwarded-For / X-Real-Ip for aws:SourceIp condition
# evaluation in S3 bucket and IAM policies, and X-Forwarded-Prefix for SigV4
# signature verification of prefix-stripped paths. When the direct TCP peer is
# in this list, these headers are honored; otherwise they are ignored. A
# trusted proxy must overwrite or strip client-supplied values of these
# headers, since honoring them means trusting them. Leave empty to always use
# the direct peer, which is the safe default.
# Can also be set via env var: WEED_S3_TRUSTED_PROXIES_WHITE_LIST
[s3.trusted_proxies]
white_list = "" # comma separated; bare IPs or CIDRs, e.g. "10.10.10.0/24"
# white list. It's checking request ip address.
[guard]
white_list = ""