4.1.5. Configuration#

This chapter explains KyCH’s configuration as a whole, with worked examples. Every option is described once, in the manual pages: kych.conf(5) for the gateway, and for the helpers kych-trust.conf(5), kych-oid4vp.conf(5), kych-eid.conf(5), eudi-verifier(1), waltid-verifier(1), kych-eumw-bridge(1) and eidas-node-connector-setup(1).

4.1.5.1. Files and format#

KyCH and its Rust helpers read their configuration in the GNU Taler format: INI-like, with @inline@ includes and $VAR expansion in paths. The gateway reads every file in /usr/share/kych/config.d/ first – the package’s defaults, which define every option that has no built-in default – and then /etc/kych/kych.conf, which wins. -c FILE names another file. Nothing is re-read at run time: restart the service after editing. The whole configuration is checked when it is loaded, references between sections included, and an error names the file, the line, the section and the option.

Three rules of the format catch most mistakes:

  • A comment stands on a line of its own. PORT = 8080  # the port makes # the port part of the value, and a comment after a section header stops the line from being a section header at all.

  • A directive ends the current section. An option written after @inline@ or @inline-secret@ needs its section header repeated.

  • Secrets go into files of their own, pulled in with @inline-secret@ SECTION FILE, which takes only that section from the file: the main file can then be readable, and only the secret files are restricted. The helpers’ packages generate their API secrets in exactly that form.

Lists are written {a, b, c} (braces optional, commas or spaces); durations as 15 min, 1 h or PT90S – hours, minutes and seconds, not days (24 h, not 1 d).

The JVM helpers are configured through environment files instead: /etc/eudi-verifier/local.env, /etc/kych-eumw-bridge/local.env (each read after the package’s own), walt.id’s HOCON files in /etc/waltid-verifier/, and, for the Governikus middleware and the eIDAS-Node Connector, their own admin interface or setup tool.

4.1.5.2. The section families#

[kych-oauth2-gateway]

The service itself: how it listens, its database, the sizes and lifetimes of nonces, codes and tokens, which vocabularies are enabled, the purge, its public URL, where kych-trust is.

[vocabulary-NAME]

One source of identity: its kind, format, credential types, every claim under its native name, its helper and its trust.

[helper-NAME]

One helper program, its adapter type and how KyCH reaches it.

[trust-NAME]

Which issuers a vocabulary accepts; shared with kych-trust.

[profile-NAME]

The claims one purpose needs, per vocabulary, each required or optional.

[client_NAME]

An OAuth 2.0 client and the vocabularies and profiles it may use.

They refer to each other by name without the prefix: HELPER = eudi-ref names [helper-eudi-ref].

4.1.5.3. The main section#

The shipped defaults are right for a Debian installation; what an operator usually sets is VOCABULARIES, BASE_URL and, rarely, DATABASE:

/usr/share/kych/config.d/00-kych-defaults.conf (excerpt)#
[kych-oauth2-gateway]
SERVE = unix
UNIXPATH = /run/kych/kych.sock
UNIXPATH_MODE = 660
DATABASE = postgres:///kych?host=/var/run/postgresql
SQL_DIR = $DATADIR/sql
NONCE_BYTES = 32
TOKEN_BYTES = 32
AUTH_CODE_BYTES = 32
AUTH_CODE_TTL_MINUTES = 10
VOCABULARIES = {swiyu}
KYCH_TRUST_URL = http://127.0.0.1:18090

SERVE

unix (the default: UNIXPATH with the octal UNIXPATH_MODE), tcp (BIND_TO and PORT, for development) or systemd (socket activation through kych.socket).

NONCE_BYTES, TOKEN_BYTES, AUTH_CODE_BYTES

The entropy of the session nonce in /authorize/NONCE, of the access token and of the authorization code; 32 bytes (256 bits) each.

AUTH_CODE_TTL_MINUTES

How long an authorization code may be exchanged (10 minutes); it is single-use in any case.

VOCABULARIES

The vocabularies this installation offers. A vocabulary that is defined but not listed is checked for errors and otherwise ignored.

BASE_URL

The public URL of the gateway, ending in /. Helpers need it for the absolute /return URL a same-device wallet or a redirect helper sends the browser back to.

PURGE_GRACE, PURGE_INTERVAL

How long claims and evidence are kept after the first /info (1 h), and how often the sweeper runs (5 min; 0 s leaves it to kych-client-management purge from cron). Data retention and purge.

KYCH_TRUST_URL, KYCH_TRUST_UNIXPATH

Where kych-trust answers, for the EUDI verifier’s and walt.id’s adapters.

ALLOWED_SCOPES

A ceiling on the claims a client may name directly in its scope; profiles are not affected. Worth setting wherever clients name claims.

4.1.5.4. Vocabularies#

The package defines all five vocabularies of Sources of identity: vocabularies; an operator rarely changes more than their HELPER and TRUST. A vocabulary section holds:

KIND

oid4vp (a wallet, QR code and deep link), eid-server (the German card, browser redirect) or eidas-saml (the eIDAS network, browser redirect).

FORMAT, VCT, DOCTYPE, NAMESPACE, ALGORITHMS

For oid4vp: dc+sd-jwt with the accepted vct values, or mso_mdoc with the doctype; the signature algorithms.

WALLET_SCHEMES

The URL schemes the wallet page may link to besides https (openid4vp, haip-vp, swiyu-verify, …); anything else a helper returns is refused before it is rendered.

CLAIMS

Every claim that may be requested, by its native name or path (address.locality, nationalities[]). No vocabulary may define a claim called vocabulary, missing or evidence, which /info reserves.

HELPER, TRUST

The helper section that serves it, and for oid4vp the trust section of its issuers.

For the EU PID the shipped VCT list holds the base type urn:eudi:pid:1 and the 27 national types urn:eudi:pid:CC:1, since a wallet may match the types exactly rather than following type inheritance.

4.1.5.4.1. The Swiss e-ID’s claims#

The swiyu vocabulary carries the Swiss Beta ID’s claims: personal data (family_name, given_name, birth_date, sex, portrait), Swiss attributes (place_of_origin, birth_place, nationality, personal_administrative_number, the AHV number), age claims (age_over_16, age_over_18, age_over_65, age_birth_year), document data (document_number, issuance_date, expiry_date, issuing_authority, issuing_country) and verification metadata (verification_type, verification_organization, reference_id_type, reference_id_expiry_date, additional_person_info). For an age check alone, age_over_18 is enough.

4.1.5.5. Helpers#

A helper section names its adapter (TYPE) and where KyCH reaches its management API: UNIXPATH, or URL for a loopback address (KyCH warns at start about a helper reached over the network). The package defines one section per packaged helper, each on the socket its package uses:

Section

TYPE

Options beyond UNIXPATH/URL

[helper-swiyu]

swiyu

MANAGEMENT_API_PATH

[helper-eudi-ref]

eudi-verifier

CLIENT_ID_PREFIX (x509_hash), RESPONSE_MODE (direct_post.jwt), REQUEST_URI_METHOD (get), REGISTRATION_CERTIFICATE, INTENDED_USE_ID

[helper-waltid]

waltid-verifier2

TRUST (kych-trust or self), RESPONSE_MODE, NOTIFY_URL, MAX_AGE

[helper-kych-oid4vp], [helper-kych-eid], [helper-eumw]

kych-native

API_SECRET (from the helper’s secret file), NOTIFY_URL, MAX_AGE, REGISTRATION_CERTIFICATE

The helper type must suit the vocabulary’s kind; a kych-native helper says in its /config which kinds it serves, and a session of another kind is refused at /authorize. KyCH refuses to start with an eudi-verifier or kych-native oid4vp vocabulary that is not trusted through a list kych-trust serves, and with a swiyu vocabulary whose profile line has an optional claim.

NOTIFY_URL is where the helper posts its notification: a loopback location of the reverse proxy (http://localhost:18444/notification), or KyCH’s own socket as http+unix://%2Frun%2Fkych%2Fkych.sock/notification, which the helper’s user must then be allowed to open (adduser kych-oid4vp kych-api).

4.1.5.6. Trust#

4.1.5.6.1. Who decides that an issuer is trusted#

Every EU PID carries its issuer’s certificate chain (x5c in the SD-JWT VC, x5chain in the mdoc). A valid signature proves only that someone signed; the chain must also end at a provider the European Commission lists as a PID provider, on its signed list of trusted entities (ETSI TS 119 602 [ETSI-119602]), and the provider must be listed for that class: a credential that claims to be a PID but is signed by a mere attestation provider must fail. The status list a PID names must likewise be signed by a revocation service the list authorises.

If each verifier fetched the lists itself, they would disagree exactly where it matters – a list rollover, a suspended provider, an expired list, a list whose signature fails – and three codebases would check the root of the whole chain. So one helper, kych-trust, fetches and verifies the lists, keeps versioned snapshots, refuses rollbacks, and answers all three verifiers; every evidence object names the snapshot it used. The EUDI verifier asks it through its Trust Validator protocol, kych-oid4vp through the same endpoint (or its library on kych-trust’s database), and KyCH hands walt.id the snapshot’s anchors per session (x509-trust). Only walt.id can do without kych-trust (TRUST = self), at the price of the snapshot in the evidence and of rollback protection. The npa and eidas routes are not affected: their trust (CSCA, block list, SAML metadata) lives inside the eID server or the Connector.

4.1.5.6.2. The trust sections#

A [trust-NAME] section holds exactly one of ACCEPTED_ISSUER_DIDS (for swiyu) and a list of trusted entities:

/etc/kych-trust/trust.conf#
[trust-pid-providers]
CLASS = PID
LOTE_URL = https://.../PIDProviders.jwt
LOTE_SIGNER = /etc/kych-trust/signers/pid-lote-signer.pem
LEVEL_OF_ASSURANCE = high

LOTE_URL (or LOTE_FILE, a local copy kept current by other means) names the list; LOTE_SIGNER the scheme operator’s certificate it must be signed with, or chain to – required, since an unverified trust list is no trust list. CLASS is the verification context (PID, PubEAA, …). kych-trust also reads USE_CASE, LOTE_TYPE, ISSUANCE_SERVICE_TYPE and REVOCATION_SERVICE_TYPE (kych-trust.conf(5)); KyCH alone reads LEVEL_OF_ASSURANCE.

LEVEL_OF_ASSURANCE deliberately has no default. It states the eIDAS level a credential reaches whose issuer is on this list and whose holder binding the helper verified: high for the Commission’s list of PID providers. Without it the evidence carries no level, and an exchange that accepts only substantial or high sends the person to its fallback; on a simulated list it must stay unset outside test systems (A test deployment on simulated trust).

Both programs read the same sections, so keep them in one file and pull it into both configurations:

/etc/kych/kych.conf and /etc/kych-trust/kych-trust.conf#
@inline@ /etc/kych-trust/trust.conf

and name the section in the vocabularies (TRUST = pid-providers).

4.1.5.7. Profiles and scopes#

A profile names the claims one purpose needs, per vocabulary, so that a client asks for scope=kyc instead of listing claims and gets the right ones whichever identification the person uses. A claim ending in ? is optional: asked for, but not required to be present; /info reports the optional claims a credential lacked in missing. Each line needs at least one required claim.

[profile-adult]
SWIYU = {age_over_18}
EUPID = {birthdate}
NPA = {DateOfBirth}

RETAIN = YES says that the client keeps what it receives, as a KYC client under AML law does; it is sent to mdoc wallets as intent_to_retain (the shipped kyc has it). REGISTRATION_CERTIFICATE names the registration certificate of the intended use the profile is registered as (below).

Optional claims are sent to OpenID4VP helpers as DCQL claim_sets: every combination of them, most complete first, so that the wallet discloses all that the credential has. The combinations double with each optional claim and are cut off at 64: six optional claims always fit; beyond that, list them most-likely-present first. A claim given by a path asks for that member only (address.locality), a claim given by its parent for the whole object (place_of_birth) – wallets differ in what a parent path discloses, which is why the shipped kyc asks for leaves where it can.

A client may use only the profiles its PROFILES option lists. It may still name claims directly in the scope, as KyCH clients did before profiles, when the session’s vocabulary is already fixed (the client is allowed only one, or /setup preselected it); a scope mixing a profile with claim names, or naming two profiles, is refused. ALLOWED_SCOPES in the main section limits the claims a scope may name:

[kych-oauth2-gateway]
ALLOWED_SCOPES = {age_over_18, age_over_16}

Which vocabulary a session uses is decided in this order: the client fixes it in the body of /setup; a client registered for one vocabulary, or a profile with a line for only one of the client’s vocabularies, leaves nothing to decide; otherwise the person picks on KyCH’s page among the client’s vocabularies the profile covers. Vocabularies of one helper that can offer several credentials at once (the two PID encodings at the EUDI verifier, walt.id or kych-oid4vp) are one choice. Names for the shipped vocabularies are built in; any other vocabulary is offered under its section name.

4.1.5.7.1. Registration certificates and intended uses#

An EU Digital Identity Wallet shows the person who asks and for what, and compares the request with the relying party’s registration: each profile must therefore match an intended use registered for the operator, and the registration certificate (a signed JWT, rc-wrp+jwt, ETSI TS 119 475 [ETSI-119475]; the registry’s data model is EUDI Technical Specification 5 [TS5]) of that intended use goes with every request:

[profile-kyc]
REGISTRATION_CERTIFICATE = /etc/kych/registration/kyc.jwt

Keep a profile and its registration identical: a profile that asks for a claim the registration does not list may be refused by the wallet. The EUDI verifier requires a registration certificate for every transaction (from the profile, the helper’s REGISTRATION_CERTIFICATE, or an intended use configured in the verifier and named by INTENDED_USE_ID); kych-oid4vp sends one when it has one. For npa the corresponding limit is the Berechtigung’s attribute set, which the authorisation certificate enforces on the card.

4.1.5.8. Clients#

The running gateway reads its clients from the database, not from the configuration. [client_*] sections are the declarative input to kych-client-management sync, which creates or updates the clients they describe; forgetting sync after a change is the usual cause of unauthorized or client_not_found.

/etc/kych/kych.conf#
@inline-secret@ client_exchange /etc/kych/secrets/exchange.conf

[client_exchange]
CLIENT_ID = exchange
REDIRECT_URI = https://exchange.example.com/kyc-proof/kych
VOCABULARIES = {eupid, eupid-mdoc, npa, eidas}
PROFILES = {kyc}

with /etc/kych/secrets/exchange.conf (root:kych 0640) holding [client_exchange] and CLIENT_SECRET = secret-token:.... The secret is the bearer token of /setup and the client_secret of /token; KyCH stores only its bcrypt hash. REDIRECT_URI may list several URIs, separated by commas; a request must name one of them exactly.

$ kych-client-management -c /etc/kych/kych.conf sync
$ kych-client-management -c /etc/kych/kych.conf list
$ kych-client-management -c /etc/kych/kych.conf show exchange

sync --prune also deletes clients no longer in the configuration, with their sessions and tokens. Clients can be managed without the configuration too (create, update, delete; kych-client-management(1)). sync does not rotate an existing client’s secret: delete and re-create the client for that.

The per-client VERIFIER_URL, VERIFIER_MANAGEMENT_API_PATH and ACCEPTED_ISSUER_DIDS of earlier versions are gone: the verifier is a [helper-*] section and the issuers a [trust-*] section, configured once for all clients. A configuration that still has them is refused with an error naming the option (/usr/share/doc/kych/NEWS.Debian.gz).

4.1.5.9. Switching helpers#

A session records its vocabulary and its helper section the moment the vocabulary is fixed, and finishes there. Changing a vocabulary’s HELPER and restarting kych therefore affects new sessions only:

/etc/kych/kych.conf#
[vocabulary-eupid]
HELPER = waltid

[vocabulary-eupid-mdoc]
HELPER = waltid

Keep the old helper running until the sessions it has are done (15 minutes at most), then stop it if you like. This was tested both ways for every pair of EU PID helpers, and between the two eID servers (testing/e2e/use-helper.sh, testing/npa/use-eid-server.sh). Changing the options of a helper section in place (walt.id’s TRUST, say) keeps the section, so sessions already started at it are read in the mode they started with.

4.1.5.10. A worked example#

An exchange and a Beekeeper instance on the same host as KyCH; EU PIDs through kych-oid4vp, the German card through kych-eid, eIDAS through the bridge; the Swiss e-ID off. The defaults supply everything else.

/etc/kych/kych.conf#
[kych-oauth2-gateway]
VOCABULARIES = {eupid, eupid-mdoc, npa, eidas}
BASE_URL = https://kych.example.com/
ALLOWED_SCOPES = {family_name, given_name}

@inline@ /etc/kych-trust/trust.conf
@inline-secret@ helper-kych-oid4vp /etc/kych-oid4vp/secrets/api.secret.conf
@inline-secret@ helper-kych-eid /etc/kych-eid/secrets/api.secret.conf
@inline-secret@ helper-eumw /etc/kych-eumw-bridge/secrets/api.secret.conf
@inline-secret@ client_exchange /etc/kych/secrets/exchange.conf
@inline-secret@ client_beekeeper /etc/kych/secrets/beekeeper.conf

[vocabulary-eupid]
HELPER = kych-oid4vp
TRUST = pid-providers

[vocabulary-eupid-mdoc]
HELPER = kych-oid4vp
TRUST = pid-providers

[vocabulary-npa]
HELPER = kych-eid

[helper-kych-oid4vp]
NOTIFY_URL = http://localhost:18444/notification

[helper-kych-eid]
NOTIFY_URL = http://localhost:18444/notification

[profile-kyc]
REGISTRATION_CERTIFICATE = /etc/kych/registration/kyc.jwt

[client_exchange]
CLIENT_ID = exchange
REDIRECT_URI = https://exchange.example.com/kyc-proof/kych
VOCABULARIES = {eupid, eupid-mdoc, npa, eidas}
PROFILES = {kyc}

[client_beekeeper]
CLIENT_ID = beekeeper
REDIRECT_URI = https://forms.example.com/eid/return
VOCABULARIES = {eupid, eupid-mdoc, npa, eidas}
PROFILES = {kyc}

/etc/kych-trust/trust.conf#
[trust-pid-providers]
CLASS = PID
LOTE_URL = https://.../PIDProviders.jwt
LOTE_SIGNER = /etc/kych-trust/signers/pid-lote-signer.pem
LEVEL_OF_ASSURANCE = high

Then:

[root@server]# kych-client-management -c /etc/kych/kych.conf sync
[root@server]# systemctl restart kych
[root@server]# journalctl -u kych -n 20

A configuration that cannot work stops the gateway at start, and the journal names the file, line, section and option it refused. GET /config lists the enabled vocabularies and profiles as clients see them. Beekeeper’s return URI is the one its own configuration names (The exchange and Beekeeper).