Skip to main content

Platform Configuration

This guide provides details about the configuration setup for the platform, including the logger, services , and server configurations.

The platform leverages viper to help load configuration.

Deployment Mode

The platform is designed as a modular monolith, meaning that all services are built into and run from the same binary. However, these services can be grouped and run together based on specific needs. The available service groups are:

  • all: Runs every service that is registered within the platform.
  • core: Runs essential services, including policy, authorization, and wellknown services.
  • kas: Runs the Key Access Server (KAS) service.
FieldDescriptionDefaultEnvironment Variable
modeDrives which services to run. Following modes are supported. (all, core, kas)allOPENTDF_MODE

SDK Configuration

The sdk configuration is used when operating the service in mode kas. When running in mode core or all an in-process communication is leveraged over an in-memory grpc server.

Root level key sdk_config

FieldDescriptionDefaultEnvironment Variable
endpointThe core platform endpoint to connect toOPENTDF_SDK_CONFIG_ENDPOINT
plaintextUse a plaintext grpc connectionfalseOPENTDF_SDK_CONFIG_PLAINTEXT
client_idOAuth client idOPENTDF_SDK_CONFIG_CLIENT_ID
client_secretThe clients credentialsOPENTDF_SDK_CONFIG_CLIENT_SECRET

Logger Configuration

The logger configuration is used to define how the application logs its output.

Root level key logger

FieldDescriptionDefaultEnvironment Variable
levelThe logging level.infoOPENTDF_LOGGER_LEVEL
typeThe format of the log output.jsonOPENTDF_LOGGER_TYPE
outputThe output destination for logs.stdoutOPENTDF_LOGGER_OUTPUT

Example:

logger:
level: debug
type: text
output: stdout

Server Configuration

The server configuration is used to define how the application runs its server.

Root level key server

FieldDescriptionDefaultEnvironment Variable
auth.audienceThe audience for the IDP.OPENTDF_SERVER_AUTH_AUDIENCE
auth.issuerThe issuer for the IDP.OPENTDF_SERVER_AUTH_ISSUER
auth.cache_refreshInterval in which the IDP jwks should be refreshed15mOPENTDF_SERVER_AUTH_CACHE_REFRESH
auth.dpopskewThe amount of time drift allowed between when the client generated a dpop proof and the server time.1hOPENTDF_SERVER_AUTH
auth.skewThe amount of time drift allowed between a tokens exp claim and the server time.1mOPENTDF_SERVER_AUTH_SKEW
auth.public_client_idThe oidc client id. This is leveraged by otdfctl.OPENTDF_SERVER_AUTH_PUBLIC_CLIENT_ID
auth.enforceDPoPIf true, DPoP bindings on Access Tokens are enforced.falseOPENTDF_SERVER_AUTH_ENFORCEDPOP
cryptoProviderA list of public/private keypairs and their use. Described belowempty
enable_pprofEnable golang performance profilingfalseOPENTDF_SERVER_ENABLE_PPROF
grpc.reflectionThe configuration for the grpc server.trueOPENTDF_SERVER_GRPC_REFLECTION
hostThe host address for the server.""OPENTDF_SERVER_HOST
portThe port number for the server.9000OPENTDF_SERVER_PORT
tls.enabledEnable tls.falseOPENTDF_SERVER_TLS_ENABLED
tls.certThe path to the tls certificate.OPENTDF_SERVER_TLS_CERT
tls.keyThe path to the tls key.OPENTDF_SERVER_TLS_KEY

Example:

server:
grpc:
reflection: true
port: 8081
tls:
enabled: true
cert: /path/to/cert
key: /path/to/key
auth:
enabled: true
audience: https://example.com
issuer: https://example.com
cryptoProvider:
standard:
keys:
- kid: r1
alg: rsa:2048
private: kas-private.pem
cert: kas-cert.pem
- kid: e1
alg: ec:secp256r1
private: kas-ec-private.pem
cert: kas-ec-cert.pem

Crypto Provider

To configure the Key Access Server, you must define a set of one or more public keypairs and a method for loading and using them.

The crypto provider is implemented as an interface, allowing multiple implementations.

Root level key cryptoProvider

Environment Variable: OPENTDF_SERVER_CRYPTOPROVIDER_STANDARD='[{"alg":"rsa:2048","kid":"k1","private":"kas-private.pem","cert":"kas-cert.pem"}]'

FieldDescriptionDefault
cryptoProvider.typeThe type of crypto provider to use.standard
cryptoProvider.standard.*.algAn enum for the associated crypto type. E.g. rsa:2048 or ec:secp256r1
cryptoProvider.standard.*.kidA short, globally unique, stable identifier for this keypair.
cryptoProvider.standard.*.privatePath to the private key as a PEM file.
cryptoProvider.standard.*.cert(Optional) Path to a public cert for the keypair.

Database Configuration

The database configuration is used to define how the application connects to its database.

Root level key db

FieldDescriptionDefaultEnvironment Variables
hostThe host address for the database.localhostOPENTDF_DB_HOST
portThe port number for the database.5432OPENTDF_DB_PORT
databaseThe name of the database.opentdfOPENTDF_DB_DATABASE
userThe username for the database.postgresOPENTDF_DB_USER
passwordThe password for the database.changemeOPENTDF_DB_PASSWORD
sslmodeThe ssl mode for the databasepreferOPENTDF_DB_SSLMODE
schemaThe schema for the database.opentdfOPENTDF_DB_SCHEMA
runMigrationWhether to run the database migration or not.trueOPENTDF_DB_RUNMIGRATION

Example:

db:
host: localhost
port: 5432
database: opentdf
user: postgres
password: changeme
sslmode: require
schema: opentdf
runMigration: false

Services Configuration

Root level key services

Key Access Server (KAS)

Root level key kas

Environment Variable: OPENTDF_SERVICES_KAS_KEYRING='[{"kid":"k1","alg":"rsa:2048"},{"kid":"k2","alg":"ec:secp256r1"}]'

FieldDescriptionDefault
keyring.*.kidWhich key id this is binding
keyring.*.alg(Optional) Associated algorithm. (Allows reusing KID with different algorithms)
keyring.*.legacyIndicates this may be used for TDFs with no key ID; default if all unspecified.inferred

Example:

services:
kas:
enabled: true
keyring:
- kid: e2
alg: ec:secp256r1
- kid: e1
alg: ec:secp256r1
legacy: true
- kid: r2f
alg: rsa:2048
- kid: r1
alg: rsa:2048
legacy: true

Authorization

Root level key authorization

FieldDescriptionDefaultEnvironment Variables
rego.pathPath to rego policy fileLeverages embedded rego policyOPENTDF_SERVICES_AUTHORIZATION_REGO_PATH
rego.queryRego query to execute in policydata.opentdf.entitlements.attributesOPENTDF_SERVICES_AUTHORIZATION_REGO_QUERY

Example:

services:
authorization:
rego:
path: /path/to/policy.rego
query: data.opentdf.entitlements.attributes