TLS Configuration

Connections between Nuts nodes are secured using mutual TLS (both client and server present a X.509 certificate). This applies to both gRPC and HTTP connections. Your TLS configuration depends mostly on where you terminate the TLS connection. This page describes the different layouts for TLS and how to configure them for gRPC.

Note

HTTP connections between nodes (all calls to /n2n) must be secured using TLS which is not handled by the Nuts node. You need to have a reverse proxy in front of the Nuts node for terminating the (node-to-node) HTTPS traffic and forwarding it to the Nuts node. Refer to Interfaces/Endpoints for the requirements on this HTTP endpoint (and others).

In all layouts your node’s certificate must issued by a Certificate Authority, trusted by the other nodes in the network. Each layout requires network.certfile, network.certkeyfile and network.truststorefile to be configured.

You can also find working setups in the end-2-end test suite.

No TLS Offloading

By default, the TLS connection is terminated on the Nuts node. This means there is no system between the remote and local Nuts nodes that accepts TLS connections and forwards them as plain HTTP.

gRPC / HTTP2 over TLS %3CmxGraphModel%3E%3Croot%3E%3CmxCell%20id%3D%220%22%2F%3E%3CmxCell%20id%3D%221%22%20parent%3D%220%22%2F%3E%3CmxCell%20id%3D%222%22%20value%3D%22Behind%20reverse%20proxy%26lt%3Bbr%26gt%3BSSL%20terminator%22%20style%3D%22text%3Bhtml%3D1%3BstrokeColor%3Dnone%3BfillColor%3Dnone%3Balign%3Dleft%3BverticalAlign%3Dmiddle%3BwhiteSpace%3Dwrap%3Brounded%3D0%3BfontSize%3D20%3B%22%20vertex%3D%221%22%20parent%3D%221%22%3E%3CmxGeometry%20x%3D%22250%22%20y%3D%2240%22%20width%3D%22350%22%20height%3D%2220%22%20as%3D%22geometry%22%2F%3E%3C%2FmxCell%3E%3C%2Froot%3E%3C%2FmxGraphModel%3E 
gRPC / HTTP2 over TLS %3CmxGraphModel%3E%3Croot%3E%3CmxCell%20id%3D%220%22%2F%3E%3CmxCell%20id%3D%221%22%20parent%3D%220%22%2F%3E%3CmxCell%20id%3D%222%22%20value%3D%22Behind%20reverse%20proxy%26lt%3Bbr%26gt%3BSSL%20terminator%22%20style%3D%22text%3Bhtml%3D1%3BstrokeColor%3Dnone%3BfillColor%3Dnone%3Balign%3Dleft%3BverticalAlign%3Dmiddle%3BwhiteSpace%3Dwrap%3Brounded%3D0%3BfontSize%3D20%3B%22%20vertex%3D%221%22%20parent%3D%221%22%3E%3CmxGeometry%20x%3D%22250%22%20y%3D%2240%22%20width%3D%22350%22%20height%3D%2220%22%20as%3D%22geometry%22%2F%3E%3C%2FmxCell%3E%3C%2Froot%3E%3C%2FmxGraphModel%3E 
Nuts Node
Nuts Node
Public
Internet
Public...


Server Certificate
[ Private Key ]
Server Certificat...
Uses
Uses
Viewer does not support full SVG 1.1

No additional configuration is required.

TLS Pass-through

When using a (level 4) load balancer that does not inspect or alter requests, TLS is still terminated on the Nuts node.

gRPC / HTTP2 over TLS%3CmxGraphModel%3E%3Croot%3E%3CmxCell%20id%3D%220%22%2F%3E%3CmxCell%20id%3D%221%22%20parent%3D%220%22%2F%3E%3CmxCell%20id%3D%222%22%20value%3D%22Behind%20reverse%20proxy%26lt%3Bbr%26gt%3BSSL%20terminator%22%20style%3D%22text%3Bhtml%3D1%3BstrokeColor%3Dnone%3BfillColor%3Dnone%3Balign%3Dleft%3BverticalAlign%3Dmiddle%3BwhiteSpace%3Dwrap%3Brounded%3D0%3BfontSize%3D20%3B%22%20vertex%3D%221%22%20parent%3D%221%22%3E%3CmxGeometry%20x%3D%22250%22%20y%3D%2240%22%20width%3D%22350%22%20height%3D%2220%22%20as%3D%22geometry%22%2F%3E%3C%2FmxCell%3E%3C%2Froot%3E%3C%2FmxGraphModel%3E
gRPC / HTTP2 over TLS%3CmxGraphModel%3E%3Croot%3E%3CmxCell%20id%3D%220%22%2F%3E%3CmxCell%20id%3D%221%22%20parent%3D%220%22%2F%3E%3CmxCell%20id%3D%222%22%20value%3D%22Behind%20reverse%20proxy%26lt%3Bbr%26gt%3BSSL%20terminator%22%20style%3D%22text%3Bhtml%3D1%3BstrokeColor%3Dnone%3BfillColor%3Dnone%3Balign%3Dleft%3BverticalAlign%3Dmiddle%3BwhiteSpace%3Dwrap%3Brounded%3D0%3BfontSize%3D20%3B%22%20vertex%3D%221%22%20parent%3D%221%22%3E%3CmxGeometry%20x%3D%22250%22%20y%3D%2240%22%20width%3D%22350%22%20height%3D%2220%22%20as%3D%22geometry%22%2F%3E%3C%2FmxCell%3E%3C%2Froot%3E%3C%2FmxGraphModel%3E
Nuts Node
Nuts Node
Public
Internet
Public...
gRPC / HTTP2 over TLS
gRPC / HTTP2 over TLS
Load Balancer
Load Balancer
Uses
Uses


Server Certificate
[ Private Key ]
Server Certificat...
Viewer does not support full SVG 1.1

This set up does not need additional configuration.

Configuration for HAProxy could look like this:

listen grpc
    bind *:5555
    mode tcp

    use_backend nuts_node_grpc

backend nuts_node_grpc
    mode tcp

    server node1 nodeA-backend:5555 check

Refer to the HAProxy documentation for more information.

TLS Offloading

In many setups TLS is terminated on a reverse proxy in front of the backend services over plain HTTP (HTTP/2 in our case).

gRPC / HTTP2 over TLS
gRPC / HTTP2 over TLS
Authenticates
server certs. using
Authenticates...
Nuts Node
Nuts Node
Public
Internet
Public...
Plain gRPC / HTTP2
Plain gRPC / HTTP2
TLS offloader
[ HAProxy / Nginx ]
TLS offloader...
Uses
(inbound connections)
Uses...


Server Certificate
[ Private Key ]
Server Certificate...
Authenticates
client certs. using
Authenticates...


Truststore
[ X.509 certificate bundle ]
Truststore...
Uses
(outbound connections)
Uses...
Text is not SVG - cannot display

To configure this setup your proxy needs to support HTTP/2 or gRPC traffic. Your proxy must add the TLS client certificate as request header. The certificate must be in PEM format and URL encoded.

In addition to the general TLS configuration, you need to configure the following options:

  • tls.offload needs to be set to incoming

  • tls.certheader needs to be set to the name of the header in which your proxy sets the certificate (e.g. X-SSl-CERT). The certificate must in be PEM or base64 encoded DER format.

The certificate and truststore will still need to be available to the Nuts node for making outbound connections.

For NGINX the proxy configuration could look as follows:

upstream nuts-node {
  server nuts-node:5555;
}

server {
  server_name nuts;
  listen                    5555 ssl http2;
  ssl_certificate           /etc/nginx/ssl/server.pem;
  ssl_certificate_key       /etc/nginx/ssl/key.pem;
  ssl_client_certificate    /etc/nginx/ssl/truststore.pem;
  ssl_verify_client         on;
  ssl_verify_depth          1;

  location / {
    grpc_pass grpc://nuts-node;
    grpc_set_header X-SSL-CERT $ssl_client_escaped_cert;
  }
}

For HAProxy the proxy configuration could look as follows:

frontend grpc_service
    mode http
    bind :5555 proto h2 ssl crt /certificate.pem ca-file /truststore.pem verify required
    default_backend grpc_servers

backend grpc_servers
    mode http
    http-request set-header X-SSL-CERT %{+Q}[ssl_c_der,base64]
    server node1 nuts_node:5555 check proto h2

No TLS

You can disable TLS by setting network.enabletls to false, but this feature is only meant for development/demo purposes. It should never be used in a production environment. If you disable TLS, you can only connect to nodes that have disabled TLS as well.