Consolidated Server legacy push setup (OpenHIM and mutual TLS)

Consolidated Server legacy push setup (OpenHIM and mutual TLS)

Part of the OpenELIS Consolidated Server guide: the certificate and OpenHIM steps of the earlier push design, which section D2 (push alternative) refers to. This design uses the repository DIGI-UW/Consolidated-Server and was not re-tested. The default deployment is the pull pipeline described in the main guide.

Architecture

LIS HIE.png

OpenHIM sits in front of the central FHIR server. Labs reach the FHIR server only through an OpenHIM channel, and authenticate with a client certificate (mutual TLS).

Deployment and ports

  • Deploy from the repository: git clone --recurse-submodules https://github.com/DIGI-UW/Consolidated-Server.git, run ./configure.sh, then docker compose -f docker-compose-production.yml up -d --build.

  • Inbound: 80 and 443 (nginx, OpenHIM console), 8080, 5000, 5001, 5050, 5051, 5052 and 7788 (OpenHIM core).

  • Between services only: 5432 (PostgreSQL), 8444 (FHIR server), 27017 (MongoDB).

Certificates

Create a CA, sign the server certificate with it, and make every server trust that CA. Using one certificate for all services also works.

mkdir openssl && cd openssl openssl genrsa -aes256 -out ca.key 4096 openssl req -x509 -new -nodes -key ca.key -sha256 -days 3652 -out ca.crt openssl genrsa -aes256 -out server.key 2048

Replace the values in < >, then create and sign the server certificate:

cat > csr.conf <<EOF [ req ] default_bits = 2048 prompt = no default_md = sha256 req_extensions = req_ext distinguished_name = dn [ dn ] C = <Country-Short-Name> ST = <State> L = <City> O = <Organization> OU = <Organization Unit> CN = CS Cert [ req_ext ] subjectAltName = @alt_names [ alt_names ] DNS.1 = <url-1> DNS.2 = *.openelis.org IP.1 = <ip-address-1> IP.2 = <ip-address-2> EOF openssl req -new -key server.key -out server.csr -config csr.conf openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out server.crt -days 1826 -extensions req_ext -extfile csr.conf cat server.crt ca.crt > server-chain.crt cd ..

Copy the files into the repository and build the keystore and truststore. Encrypt the key with the keystore password.

cp openssl/server-chain.crt prod/ssl/cs_frontend.crt cp openssl/server-chain.crt prod/ssl/cs.crt cp openssl/server.key prod/ssl/cs_frontend.key cp openssl/server.key prod/ssl/cs.key openssl pkcs12 -inkey prod/ssl/cs.key -in prod/ssl/cs.crt -export -out prod/ssl/cs.keystore chmod +r prod/ssl/cs.keystore keytool -import -alias csCert -file prod/ssl/cs.crt -storetype pkcs12 -keystore prod/ssl/cs.truststore

Load the CA (or the certificate) into the truststore of every OpenELIS instance. If a load balancer terminates TLS in front of the server, OpenELIS must trust the load balancer certificate or its CA instead.

OpenHIM

  1. Log in to the OpenHIM console as root@openhim.org (default password openhim-password) and change the password.

  2. Certificates: upload the server certificate and key. OpenHIM core then uses them.

  3. Clients: add the client certificate (and its CA chain) as trusted. Add a client for each lab with a client ID, a name, the roles fhir-pusher and fhir-puller, and client certificate authentication. A client used by a person or a script can use Basic authentication instead.

  4. Channels: add FHIR Channel: type HTTP, URL pattern /fhir.*, private, allowed roles fhir-pusher and fhir-puller. Route: name hapi-fhir-jpaserver, type HTTP, secured, CA trust, host <server-path>, port 8444.