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
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, thendocker 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 2048Replace 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.truststoreLoad 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
Log in to the OpenHIM console as
root@openhim.org(default passwordopenhim-password) and change the password.Certificates: upload the server certificate and key. OpenHIM core then uses them.
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-pusherandfhir-puller, and client certificate authentication. A client used by a person or a script can use Basic authentication instead.Channels: add FHIR Channel: type HTTP, URL pattern
/fhir.*, private, allowed rolesfhir-pusherandfhir-puller. Route: namehapi-fhir-jpaserver, type HTTP, secured, CA trust, host<server-path>, port 8444.