Service Configuration

The AI Guard service is configured via a YAML file. All values support shell-style environment variable expansion using ${VAR} syntax, which is resolved at startup.

Configuration File

The default configuration is located at /etc/ai-guard/config.yaml inside the Docker image. Override it by mounting a custom config file or setting environment variables.

Environment Variable Syntax

SyntaxBehavior
${VAR}Replaced with the value of VAR. If VAR is unset, the server exits with an error.
${VAR:-default}Replaced with the value of VAR. If VAR is unset, uses default.

This makes it straightforward to parameterize a single config file across environments.

Configuration Reference

Service Section

Config PathEnv VarDefaultDescription
service.timeoutβ€”10HTTP request timeout in seconds
service.listenAI_GUARD_SERVICE_PORT0.0.0.0:4443Server listen address and port

Authorization Section

See Authentication & Authorization for full details.

Config PathEnv VarDefaultDescription
service.authorization.typeβ€”onetrustAuthorization mode: onetrust or shared-secret

TLS Section

See TLS & Certificate Pinning for full details.

Config PathEnv VarDefaultDescription
service.tls.key-pathTLS_KEY_PATH/etc/ssl/litenode/tls.keyTLS private key path (PEM)
service.tls.certificate-pathCERTIFICATE_PATH/etc/ssl/litenode/tls.crtTLS certificate path (PEM)
πŸ“˜

Disabling TLS

If the tls section is omitted from the config file, the server falls back to plain HTTP. You can also pass the --no-tls CLI flag to explicitly disable TLS.

Classification Section

Config PathEnv VarDefaultDescription
classification.min-allowed-likelihoodβ€”LIKELYMinimum confidence threshold for classification matches
classification.client.typeβ€”clientClassification client type: client (HTTP) or fs (file-based)
classification.client.classifier-base-urlJOB_EXECUTOR_BASE_URLhttp://scan-job-manager:8080URL or path for classification profiles

Classification Client Types

TypeDescription
fsFile-based classifiers loaded from a local path
clientHTTP client connecting to a remote OneTrust classifier service

Metrics Section

See Metrics Exporters for full details.

Config PathEnv VarDefaultDescription
metrics.allowed-attributesβ€”β€”Optional additional attribute keys beyond agent_id and platform
metrics.exporter.typeβ€”onetrustExporter type: onetrust or otlp
metrics.exporter.collector-endpointDATADISCOVERY_ONPREM_AGENT_URIhttp://datadiscovery-onprem-agent:8080Metrics collector endpoint
metrics.exporter.intervalMETRICS_EXPORT_INTERVALhourExport interval
πŸ“˜

Disabling Metrics

If the metrics section is omitted entirely, metrics collection is disabled and POST /metric will return 400 Bad Request.

Complete Configuration Example

service:
  timeout: 10
  listen: 0.0.0.0:${AI_GUARD_SERVICE_PORT:-4443}
  authorization:
    type: onetrust
    validation-endpoint: "${OT_SERVICE_BASE_URL}/api/label-manager/v2/custom-classifiers?searchTerm=4a72ec89d3b4798c"
    initial-backoff: 0.15
    max-retry-duration: 2.0
    cache-max-capacity: 1000
    cache-ttl: 300
  tls:
    key-path: "${TLS_KEY_PATH}"
    certificate-path: "${CERTIFICATE_PATH}"

classification:
  min-allowed-likelihood: LIKELY
  client:
    type: client
    classifier-base-url: "${JOB_EXECUTOR_BASE_URL:-http://scan-job-manager:8080}"

metrics:
  exporter:
    type: onetrust
    collector-endpoint: "${DATADISCOVERY_ONPREM_AGENT_URI:-http://datadiscovery-onprem-agent:8080}"
    interval: ${METRICS_EXPORT_INTERVAL:-hour}
    initial-backoff: 0.15
    max-retry-duration: 30.0

Debugging β€” Trusted Root Overrides

These optional settings allow overriding the CA certificate and endpoint address for each outbound connection. Useful for debugging TLS issues, routing through proxies, or testing against alternate endpoints.

Config PathEnv VarDescription
service.authorization.trusted-root-pathVALIDATION_ENDPOINT_TRUSTED_ROOT_PATHPEM CA cert for validation endpoint
service.authorization.trusted-root-addressVALIDATION_ENDPOINT_TRUSTED_ROOT_ADDRESSOverride host:port for validation endpoint
classification.client.trusted-root-pathJOB_EXECUTOR_ENDPOINT_TRUSTED_ROOT_PATHPEM CA cert for scan job manager
classification.client.trusted-root-addressJOB_EXECUTOR_ENDPOINT_TRUSTED_ROOT_ADDRESSOverride host:port for scan job manager
metrics.exporter.trusted-root-pathMETRICS_ENDPOINT_TRUSTED_ROOT_PATHPEM CA cert for collector endpoint
metrics.exporter.trusted-root-addressMETRICS_ENDPOINT_TRUSTED_ROOT_ADDRESSOverride host:port for collector endpoint

Logging

Logs are formatted using Elastic Common Schema (ECS) format. Log level is controlled by the RUST_LOG environment variable:

RUST_LOG=info   # Default
RUST_LOG=debug  # Verbose logging for troubleshooting
RUST_LOG=warn   # Reduced logging

What's Next?