4.1.3. Installation#
4.1.3.1. What to install#
KyCH is one source tree that builds ten Debian binary packages. Which of them a host needs follows from the vocabularies it offers:
To offer |
Install |
|---|---|
anything |
|
|
|
|
|
|
|
|
|
Several helpers for one vocabulary may be installed side by side; the configuration says which one serves new sessions (Switching helpers).
4.1.3.1.1. Prerequisites#
Debian 13 (“trixie”). Every test run of this manual’s results was on Debian 13 with the packages built from the release tarball.
PostgreSQL 14 or later for
kych,kych-trust,kych-oid4vp,kych-eidandswiyu-verifier, each with a database of its own. The Governikus middleware brings its own embedded HSQLDB; the EUDI verifier, walt.id, the bridge and the Connector keep their state in memory.A reverse proxy that terminates TLS – the examples are for nginx – and a public host name with a certificate.
Java runtimes: OpenJDK 25 for
swiyu-verifier,eudi-verifier,governikus-eumwandkych-eumw-bridge; OpenJDK 21 forwaltid-verifierandeidas-node-connector(which also needs Debian’stomcat11-userandpython3). The packages depend on them.Memory: the Rust programs need a few tens of MB each (kych-eid 18 MB resident in the tests); each JVM helper needs between 0.6 and 1.2 GB with default heap sizing (Capacity).
For
npaandeidasin production: the authorisations and certificates of Authorisations, certificates and whom to ask. Development and the tests need none of them.
4.1.3.2. Building the packages#
The packages are built from a source tarball or a git checkout:
$ git clone https://git.taler.net/kych.git
$ cd kych
$ ./bootstrap
$ ./debian/stamp-version.sh
$ dpkg-buildpackage -b -uc -us
./bootstrap fetches the upstream helpers’ submodules (it is not needed in
an unpacked release tarball, which ships them), and
./debian/stamp-version.sh writes the version derived from
git describe into debian/changelog. Building needs cargo and
rustc 1.85 or later, libssl-dev, pkg-config, python3-sphinx
(the manual pages), maven, OpenJDK 25 and 21, and network access or a warm
cache for Maven and for walt.id’s Gradle build, which also fetches a JDK 17
for upstream’s libraries unless one is installed. The upstream helpers are
never built in their submodules: each is copied and KyCH’s patches are applied
to the copy first, so the submodule stays at its release tag.
Without packages, the same tree installs with
$ ./bootstrap
$ ./configure --prefix=/usr/local
$ make
$ make check # needs DATABASE_URL for the database tests
# make install
./configure detects which helpers it can build; --enable-NAME
makes a missing toolchain an error and --disable-NAME leaves the helper
out, for trust, oid4vp, eid, verifier (swiyu-verifier),
eudi-verifier, waltid-verifier, eumw (the middleware and the
bridge) and eidas. make help lists the targets. The rest of this
manual assumes the Debian packages; Running from a source installation says what differs.
4.1.3.3. Order of installation#
PostgreSQL and nginx, and a TLS certificate for the public name.
kych-trust, if EU wallets are to be accepted: its database, the lists (Trust), started and refreshed once.
The helpers, each set up as Setting up the helpers describes, and started.
kych: its database, the vocabularies, helpers, trust and the clients in
/etc/kych/kych.conf,kych-client-management sync, started.The reverse proxy sites for KyCH and each helper, reloaded.
The clients: the exchange’s KYC configuration, Beekeeper’s
beekeeper-kych(The exchange and Beekeeper).A test identification end to end, then monitoring (Monitoring).
4.1.3.4. Databases#
Each program with a database has a -dbconfig tool that creates the role
and the database on the local PostgreSQL and loads the schema, and a
-dbinit tool that applies the schema patches a database does not have
yet. The packages run the latter from their postinst on every upgrade.
[root@server]# kych-dbconfig
[root@server]# kych-trust-dbconfig
[root@server]# kych-oid4vp-dbconfig
[root@server]# kych-eid-dbconfig
[root@server]# swiyu-verifier-dbconfig
Each daemon runs as its own system user and connects over the local socket
with peer authentication, so no password is stored anywhere. For a server on
another port, set DATABASE in the program’s configuration before
running its -dbconfig, in this shape:
[kych-oauth2-gateway]
DATABASE = postgres://localhost:5433/kych?host=/var/run/postgresql
?host= with a path selects the socket directory, while the port is only
read from the authority part (?port= is ignored). For a remote database
with a password, keep the line in a file of its own, readable by
root:kych only, and pull it in with
@inline-secret@ kych-oauth2-gateway /etc/kych/secrets/database.conf.
kych-oid4vp can read kych-trust’s snapshots directly from kych-trust’s
database instead of asking kych-trust over HTTP; that needs
kych-trust-dbconfig -g kych-oid4vp, which grants the role read access
(kych-trust-dbconfig(1)).
kych-dbinit, kych-trust-dbinit, kych-oid4vp-dbinit and
kych-eid-dbinit are idempotent and take --dry-run; they exit with
status 2 when the database or the role does not exist yet, instead of
failing. A purge of a package leaves its database alone: it is site state.
4.1.3.5. The reverse proxy: public and private paths#
Every helper ships an example nginx site in /usr/share/PACKAGE/nginx/
that publishes exactly the paths the outside world needs, with KyCH beside
it on the same name; the source tree keeps them in contrib/nginx/. The
rule they follow is simple: publish nothing but the listed paths; a
management API must never be proxied.
Program |
Published (method, path) |
Never published |
|---|---|---|
KyCH |
|
– |
eudi-verifier |
|
|
waltid-verifier |
|
everything else on its socket |
kych-oid4vp |
|
its management socket |
kych-eid |
|
its management socket |
governikus-eumw + bridge |
|
the admin interface (port 8096), the bridge’s API socket |
eidas-node-connector + bridge |
|
Hazelcast, the bridge’s API socket |
Further points the examples get right:
Notifications. Helpers cannot call KyCH’s Unix socket, so the examples add a server on
127.0.0.1:18444that passesPOST /notification, and nothing else, to KyCH. Keep one such server for all helpers.Body sizes. Wallet requests are small; responses may carry an mdoc with a portrait. The examples allow 64 KiB for requests and up to 32 MiB for kych-oid4vp’s responses; the EUDI verifier and walt.id examples refuse bodies over 1 MiB, which leaves a session open until it expires (Features and limitations, known limitations).
One TLS endpoint for the eID server. AusweisApp fetches the tcToken and then resumes that TLS session for the PAOS connection; both must be served from the same TLS endpoint.
The eID server’s TLS certificate is entangled with the authorisation certificate. The certificate description lists the hash of the TLS certificate, and AusweisApp refuses a server whose certificate is not listed. A new TLS certificate – every renewal, even with the same key – needs a new authorisation certificate with that hash. The middleware can request it automatically with a request signer certificate;
kych-eid-bercacannot yet. Serve the eID server from a name of its own with a certificate whose renewal you plan with the BerCA, rather than one an automatic 90-day renewal replaces behind your back.Restricting ``/notification``. It accepts unauthenticated posts by design (the helper is asked for the outcome; a forged notification changes nothing). Where swiyu-verifier calls it over the network, restrict it to the verifier’s address.
For KyCH alone, the essential part is
upstream kych {
server unix:/run/kych/kych.sock;
}
server {
listen 443 ssl;
http2 on;
server_name kych.example.com;
ssl_certificate /etc/letsencrypt/live/kych.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/kych.example.com/privkey.pem;
location / {
proxy_pass http://kych;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
nginx’s user www-data must be a member of KyCH’s socket group
kych-api, which the kych package arranges (Sockets and groups).
The reachability of every path from outside was checked on the test host,
43 of 43 as expected (testing/system/RESULTS.md, nginx-split.py).
4.1.3.6. The kych package#
[root@server]# apt install ./kych_*.deb
[root@server]# kych-dbconfig
The package installs the service disabled, since it has nothing to serve
before at least one client is registered. Its defaults are in
/usr/share/kych/config.d/00-kych-defaults.conf, read before
/etc/kych/kych.conf, which ships holding only comments: put only your
own settings there, and an upgrade of the defaults never prompts about a
conffile. The package creates the group kych-api for its socket and puts
www-data into it.
Then configure (Configuration), register the clients and start:
[root@server]# kych-client-management -c /etc/kych/kych.conf sync
[root@server]# systemctl enable --now kych
Upgrades apply new schema patches and restart a running service by
themselves. /usr/share/doc/kych/README.Debian repeats these steps.
4.1.3.7. A minimal deployment for a German institution#
For KYC under German anti-money-laundering law the Swiss e-ID is off (it is not an eIDAS means), and the EU PID, the German eID card and, optionally, the eIDAS network are on. A minimal set, on one host:
[root@server]# apt install ./kych_*.deb ./kych-trust_*.deb ./kych-oid4vp_*.deb \
./kych-eid_*.deb ./kych-eumw-bridge_*.deb ./eidas-node-connector_*.deb
kych-trustwith the Commission’s list of PID providers and its signer certificate, andLEVEL_OF_ASSURANCE = highin that trust section (Trust);kych-oid4vp(oreudi-verifier, orwaltid-verifier) with the access certificate from the registration as a wallet-relying party, and the profilekycwith its registration certificate;kych-eid(orgovernikus-eumwwithkych-eumw-bridge) with the Berechtigung and the BerCA’s authorisation certificate;eidas-node-connectorandkych-eumw-bridgewith the Metadata-Signer certificate and the trusted member states;in
/etc/kych/kych.conf:[kych-oauth2-gateway] VOCABULARIES = {eupid, eupid-mdoc, npa, eidas} BASE_URL = https://kych.example.com/ @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 [vocabulary-eupid] HELPER = kych-oid4vp TRUST = pid-providers [vocabulary-eupid-mdoc] HELPER = kych-oid4vp TRUST = pid-providers [vocabulary-npa] HELPER = kych-eid [profile-kyc] REGISTRATION_CERTIFICATE = /etc/kych/registration/kyc.jwt [client_exchange] CLIENT_ID = exchange CLIENT_SECRET = secret-token:... REDIRECT_URI = https://exchange.example.com/kyc-proof/kych VOCABULARIES = {eupid, eupid-mdoc, npa, eidas} PROFILES = {kyc}
in the exchange: measures that accept the methods
eupid,eupid-mdoc,npaandeidasat level high (or substantial and high), with the documents through Beekeeper as the fallback (The exchange and Beekeeper).
What production needs beyond the software – the registration, the Berechtigung, the BerCA contract, the eIDAS network’s metadata – is in Authorisations, certificates and whom to ask.
4.1.3.8. A test deployment on simulated trust#
Until the registrations exist, KyCH runs on the simulated trust
infrastructure of its test suite (testing/trust/README): a test list of
PID providers with its signer, test PID providers and status lists, a test
access-certificate authority with KyCH’s access certificate, and a
registration certificate for the profile kyc. It is generated fresh,
with unprotected keys, and trusted by nothing but the tests:
$ cargo run -p kych-testing --bin kych-test-trust -- generate \
--dns kych.example.test --base-url http://127.0.0.1:18080
The lists and status lists are served from --base-url (trust/README
has the nginx site, including the content negotiation that hands an mdoc
verifier the CWT form of the status list). kych-test-wallet presents
test PIDs to any of the three EU helpers. For the German card,
testing/npa/ builds a test PKI, a mock BerCA and AusweisApp’s simulator;
for eIDAS, testing/eidas/ builds a second, foreign eIDAS node.
The level of assurance on simulated trust. A simulated list does not make a PID high, so the shipped configuration states no level for it, and the evidence then carries none. An exchange whose measures accept only substantial or high – as the example configuration’s do – therefore sends every such identification to the documents fallback. To exercise the whole flow on a test system, state the level for the simulated list explicitly:
[trust-pid-providers]
LEVEL_OF_ASSURANCE = high
(testing/system/use-loa.sh does this.) Never on a production list
other than the Commission’s list of PID providers, and never in a
configuration that may reach production: every PID the test PID provider
signs would then be reported as high. Conversely, forgetting the option on
the real list sends every real PID to the fallback; KyCH deliberately has no
default for it.
4.1.3.9. Running from a source installation#
make install puts the programs under the prefix, the defaults into
$PREFIX/share/kych/config.d/ and the schema into $PREFIX/share/kych/sql,
but creates no users, groups or units. Two things the packaged unit gets
right are easy to miss: the daemon serves its QR-code JavaScript from
js/ relative to its working directory, so WorkingDirectory must
point at the directory holding it; and with the configuration readable only
by root:kych, a unit that sets Group= also needs
SupplementaryGroups=kych, since Group= replaces the primary group.
[root@server]# adduser --system --group --no-create-home kych
[root@server]# addgroup --system kych-api
[root@server]# adduser www-data kych-api
[Unit]
Description=KyCH OAuth2 Gateway
After=network.target postgresql.service
[Service]
Type=simple
User=kych
Group=kych-api
SupplementaryGroups=kych www-data
RuntimeDirectory=kych
WorkingDirectory=/usr/local/share/kych
ExecStart=/usr/local/bin/kych-oauth2-gateway --config /etc/kych/kych.conf
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
[root@server]# sudo -u kych kych-dbinit -c /etc/kych/kych.conf
[root@server]# systemctl daemon-reload
[root@server]# systemctl enable --now kych
[root@server]# systemctl reload nginx
The database is created by hand in this case (createuser kych,
createdb -O kych kych as postgres), or by kych-dbconfig.
kych-dbinit reads the patches from SQL_DIR, which defaults to
$DATADIR/sql; in a source tree they are in
kych_oauth2_gateway/oauth2_gatewaydb/ (--sql-dir).
4.1.3.9.1. Socket activation#
With SERVE = unix the daemon binds /run/kych/kych.sock itself, and
kych.socket must stay disabled. To let systemd own the socket instead
(it then exists from boot, and the daemon starts on the first connection),
set SERVE = systemd and swap the units:
[root@server]# systemctl disable --now kych.service
[root@server]# systemctl enable --now kych.socket
The path, group and mode are the same either way; in this mode they are set
in kych.socket, and UNIXPATH_MODE is not consulted.