Open Charging Technology · Whitepapers

DNS over SSH

Version 0.2, Draft, 2026-11-13 CC-BY-SA 4.0 · OpenChargingTechnology/Whitepapers · building blocks in: Vanaheimr/Hermod (SSH stack, DNS client and server), OpenChargingCloud/WWCP_Node (shared SSH listener, DNS configuration), OpenChargingCloud/WWCP_OCPP (OCPP Device Model)

DNS over TLS (RFC 7858) puts the byte stream of DNS over TCP into a TLS connection, and inherits what TLS needs: a certificate issued for the name or the IP address the resolver is dialled at, a certificate authority that issued it, and a clock to check its validity. Secure Name Resolution answers these needs with certificates for IP addresses, root CAs installed for name servers, pins and trust on first use. In the private networks of a charging infrastructure, a station network behind a Local Controller, a private APN, a laboratory, the same three needs are as hard to meet as they are for OCPP itself.

OCPP over SSH and NTS Key Establishment over SSH replace TLS by SSH for OCPP and for time. This paper does the same for name resolution, and stays as close to DNS over TLS as it can:

This paper is part of the transport work of EVQI: its section 5 discovers endpoints through HTTPS, SVCB and SRV records, which are only as trustworthy as the channel they are fetched over (its section 5.2, step 6).

Status: this is a draft for discussion, version 0.2. It decides eight of the eleven questions of version 0.1 (chapter 12). Built is the client side (chapter 10): a DNS client in Hermod that asks over the subsystem, alone or as one of the servers of a client that asks several, on an SSH connection of its own or on one the station keeps anyway; the transport SSH of a node's name servers with the variables, configuration keys, key purpose and security events of chapter 7; and conformance tests of the client, against a scripted subsystem and against OpenSSH, socat and BIND (appendix B). Not built is what a Local Controller or a CSMS would do as a server: there the paper is a proposal still.

Contents

  1. Motivation
  2. Design
  3. The protocol
  4. Identity and authentication
  5. Authorization on the server
  6. Deployment profiles
  7. Configuration and the OCPP Device Model
  8. Security considerations
  9. Alternatives
  10. Implementation status and work plan
  11. Test criteria
  12. Decisions and open questions
  13. Relation to other white papers

1. Motivation

1.1 What DNS over TLS needs

DNS over TLS, strict profile DNS over SSH
Server authenticated by a certificate whose chain ends at a trusted root a host key, pinned or certified by an SSH CA
Name or address in the credential yes: a resolver dialled by its IP address needs that address in its certificate, or an authentication domain name (RFC 8310, section 6.1) no, for a pinned key
Certificate authority yes, public or one's own no, for a pinned key
Correct clock yes, for the validity of the certificate no, for a pinned key
Client identity none in practice; access lists by source address the SSH login and its key
Port 853 22, or the SSH listener a node runs anyway
Interoperable today yes with OpenSSH and socat in front of any resolver (appendix B); no native implementation yet

In a station network all four rows in the middle are a problem:

1.2 What SSH brings

The points of OCPP over SSH, section 1.2, hold here as well: bare public keys without validity periods, client keys as the normal case, confinement per service, one listener for everything a node serves, and the tooling of every operator. For name resolution, four of them weigh more:

1.3 Names, time and certificates at a cold start

A station that starts without a correct clock has to find its time before it can check a certificate, and often has to resolve names before it can find its time:

Step Over TLS Over SSH
1. Resolve the name of an NTS-KE server, e.g. nts1.cpo.example DNS over TLS: the resolver's certificate is valid from a date the station cannot compare with. Under the strict profile, the resolver is not used, and the name does not resolve. DNS over SSH: the host key is pinned; no clock is needed.
2. NTS key establishment TLS: the certificate's validity again. Only NoCertTimeCheckAfterReboot of Secure Time Synchronization gets past it, and only once step 1 has worked. NTS-KE over SSH: the host key is pinned.
3. Connect to the CSMS wss://: its certificate can be checked now. ssh:// with a pinned host key, or wss:// with the clock now correct.

Over TLS the chain breaks at step 1 unless the NTS-KE servers are given by IP address, or unless name servers get an exception from the time check of their certificates, which would give an attacker with an expired certificate a window at every reboot. Over SSH every step is anchored by a pin, and the clock is correct before anything needs it.

DNSSEC is not part of this: the signatures it validates have a validity period, and a station that validates them itself needs a correct clock, whatever the transport (section 8.3).

1.4 Where it is meant for

Scenario Who resolves through whom
Station network behind a Local Controller the stations through their Local Controller, as a channel of the one SSH connection they keep to it (section 6.3); the Local Controller resolves upwards itself (section 6.4)
CSMS behind a private APN or a VPN the stations through a resolver of the CPO with an SSH listener (section 6.1), or through the CSMS (section 6.2)
Local Controller to its CPO the Local Controller's own resolver through a resolver of the CPO, over DNS over SSH or DNS over TLS
Laboratories, test benches any node through any other, without a PKI

1.5 Non-goals


2. Design

2.1 Layers

DNS message          header · question · answer · authority · additional
     │
two-octet length     uint16 length · message      (RFC 1035, section 4.2.2; RFC 7766)
     │
subsystem            "dns@open.charging.cloud" on a "session" channel (RFC 4254, section 6.5)
     │
SSH connection protocol  channels, flow control per channel             (RFC 4254)
SSH user authentication  login = the station's identity, public key     (RFC 4252)
SSH transport            host key, key exchange, encryption              (RFC 4253)
     │
TCP

Over TLS the same stream sits on TLS instead of the three SSH layers; over TCP on TCP directly.

2.2 Decisions and rejected alternatives

Alternative Decision Why
Port forwarding (direct-tcpip, ssh -L 5353:127.0.0.1:53), the usual way of DNS over SSH today rejected The resolver behind the tunnel sees a connection from localhost and no identity, and a login that may forward may forward anywhere. A station's login forwards nothing (chapter 5).
DNS over TLS inside the SSH channel rejected It brings back the certificate this paper removes.
The framing of OCPP over SSH (HELLO, WELCOME, BINARY frames) rejected DNS has a framing of its own, the two-octet length of DNS over TCP, and negotiates its versions and options inside its messages (EDNS(0)). A handshake would add a round trip, and code to every peer, for nothing it does not have. With the stream of DNS over TCP, a name server serves the subsystem with the code of its TCP listener, and an unmodified one with a relay (appendix B).
exec of a fixed command rejected It mixes the protocol name with a command line of the server, and is harder to filter than a subsystem.
A channel type of its own rejected Generic SSH clients and libraries can request subsystems, but rarely open custom channel types, and OpenSSH cannot hand them to a program.
DNS inside OCPP messages (DNS-over-OCPP, upcoming) complementary It works over any OCPP transport, WebSocket included. Over SSH, a channel of its own keeps DNS out of the queue of OCPP messages: OCPP 1.6 and 2.0.1 allow one outstanding CALL per direction, and the channel has a flow-control window of its own.
The stream of DNS over TCP in a subsystem channel chosen Everything DNS over TCP and DNS over TLS specify applies unchanged, and the SSH login is the identity.

3. The protocol

3.1 The subsystem

3.2 The byte stream

From SSH_MSG_CHANNEL_SUCCESS on, the channel carries in both directions what a TCP connection carries for DNS:

uint16  length    big-endian: the length of the message, without these two octets
byte[]  message   one DNS message

3.3 Rules carried over from DNS over TCP and TLS

3.4 EDNS(0) options

3.5 The end of a channel

3.6 Mapping from DNS over TLS

DNS over TLS DNS over SSH
tls://192.0.2.53:853 ssh://cs001@192.0.2.53:22, subsystem dns@open.charging.cloud
TCP port 853 the port of the SSH listener, 22 by default
ALPN dot the subsystem name
certificate, issued for the name or address dialled host key, pinned (section 4.1)
SPKI pin of the out-of-band key-pinned profile (RFC 7858, section 4.2) host key pin, SHA256:<base64>
certificate of a CA host certificate of an SSH CA, issued for the name or address dialled
no client authentication SSH login and key (section 4.2)
TLS session resumption a further channel of an open SSH connection (section 6.3)
the two-octet length and the message unchanged
close_notify and TCP FIN of an idle connection exit-status, EOF and CLOSE of the channel

3.7 Latency

Round trips to the first answer
DNS over TLS 1.3, new connection about 3: TCP, TLS, the query
DNS over SSH, new connection about 7 to 9: TCP, version and key exchange, user authentication, channel, subsystem, the query
DNS over SSH, a new channel of an open connection, e.g. the station's shared connection to its Local Controller about 3: channel, subsystem, the query
Either, on an open channel or connection 1

The handshake is paid once per connection, the subsystem once per channel. A station keeps both open, as it keeps a connection of DNS over TLS open (RFC 7858, section 3.4), so the steady state costs one round trip per query, the same as over TLS.


4. Identity and authentication

4.1 How the server proves it

Mechanism Trust anchor Needs a correct clock Needs the name or address dialled Suitable for
Pinned host key SSHHostKeyPins of the server (section 7.1) no no few resolvers; stations without a real-time clock; resolvers dialled by IP address
SSH host certificate SSHHostCAs; one CA key, signed with ssh-keygen -s -h only with a limited validity; -V always:forever is possible yes: the name or address dialled must be a principal of the certificate many resolvers; rotation without touching the stations
SSHFP record (RFC 4255) DNSSEC yes yes not for the resolver itself (below)
The host key of the shared connection the pins the SSH peer is held to: those of SSHClientController (OCPP over SSH, section 9.2) as there as there a channel of the station's connection to an SSH peer (section 6.3)

4.2 How the client proves it

4.3 What the identity buys

Over TLS a resolver knows the source address of a query, which behind a Local Controller, NAT or a private APN names a network, not a station. Over SSH it knows the login:

4.4 Relation to the usage profiles of RFC 8310

RFC 8310 distinguishes a strict from an opportunistic profile. DNS over SSH knows only the strict one: the channel is encrypted, its server authenticated, or the server is not used. Of the profiles of DNS over TLS it is closest to the out-of-band key-pinned privacy profile of RFC 7858, section 4.2: a key, not a name, is what the client checks. The bootstrap problem of RFC 8310, section 6.1, "it will typically only know the IP address of its DNS server", is no problem for a pinned key, which needs nothing but that address.


5. Authorization on the server

5.1 Confinement

A login admitted for DNS opens dns@open.charging.cloud, the subsystems granted besides, and nothing else: no shell, no exec, no SFTP, no pseudo-terminal, no port forwarding, no agent forwarding. These are the rules of OCPP over SSH, chapter 5, and a node of the reference implementation holds station logins to them whatever their key lines say.

5.2 A grant per subsystem

DNS is granted to a station explicitly, like OCPP and NTS-KE: a key admitted for OCPP does not resolve names by itself, and a key admitted for DNS does not reach OCPP. On a Local Controller the stations of its network typically get all three, ocpp@, ntske/1@ and dns@, so that one SSH connection carries everything they need (section 6.2). On a Local Controller and a CSMS of the reference implementation the grant is the login group's (OCPP over SSH, section 5.2), and is made before the subsystem is served.

5.3 Access rules

The access rules of OCPP over SSH, section 5.4, take the service subsystem:dns@open.charging.cloud like any other. A Local Controller that serves names to its stations, but not to its uplink:

"ssh": {
  "accessRules": [
    { "action": "deny",  "service":   "subsystem:dns@open.charging.cloud", "localAddress": "192.0.2.10" },
    { "action": "allow", "principal": "station:*", "source": [ "10.10.0.0/16" ] },
    { "action": "deny",  "principal": "station:*" }
  ]
}

5.4 Limits

5.5 Revocation

Removing a station's DNS key, or the grant of dns@, ends its DNS channels: at once where the store reports the change, otherwise at the next recheck, as OCPP over SSH section 5.3 says for OCPP.


6. Deployment profiles

6.1 A name server with an SSH listener of its own

A resolver of the CPO gets an SSH listener next to its listeners for UDP, TCP and TLS. It is a special-purpose SSH server: it serves dns@open.charging.cloud to stations and, optionally, a command line to administrators, and refuses everything else. Its subsystem handler hands the channel's stream to the code of its TCP listener, together with the login, which selects the view. The SSH stack then shares a process with the resolver's cache, and needs to be as mature as its TLS stack; the SSH Conformance Tests test Hermod's against independent implementations.

6.2 A subsystem on the shared listener of a node

A Local Controller or a CSMS runs an SSH listener anyway, for its command line, SFTP, and OCPP and NTS-KE over SSH. DNS becomes one more subsystem of it:

SSH listener of a Local Controller (one port, one host key)
 ├─ shell                        administrators: the command line of the node
 ├─ sftp                         administrators
 ├─ ocpp@open.charging.cloud     charging stations
 ├─ wwcp@open.charging.cloud     neighbouring nodes
 ├─ ntske/1@open.charging.cloud  charging stations: the time server of the station network
 └─ dns@open.charging.cloud      charging stations: the resolver of the station network

6.3 A channel of the station's connection to an SSH peer

A station keeps one SSH connection to an SSH peer, e.g. its Local Controller (OCPP over SSH, section 7.2), and whatever goes to that host over SSH is a channel of it. A name server with SSHConnection Shared opens dns@ as one of them, as NTS over SSH section 7 does for time, and OCPP for its messages. The connection is the station's: none of the three owns it, and whichever needs it first has it made.

sequenceDiagram
    participant CS as Charging station
    participant LC as Local Controller
    CS->>LC: SSH: key exchange, host key matches the pin
    CS->>LC: user authentication: login "cs001", the station's key
    CS->>LC: channel 0: subsystem dns@open.charging.cloud
    CS->>LC: 00 80 · query A nts1.cpo.example
    LC-->>CS: 01 d4 · answer A 192.0.2.123
    Note over CS,LC: channel 0 stays open for further queries
    CS->>LC: channel 1: subsystem ntske/1@open.charging.cloud
    CS->>LC: channel 2: subsystem ocpp@open.charging.cloud
    Note over CS,LC: OCPP runs for days or weeks

6.4 The Local Controller as the resolver of its station network

A Local Controller between a station network and its uplink is the natural resolver of its stations, as it is their natural time server:

6.5 OpenSSH in front of an existing resolver

Because the subsystem carries the stream of DNS over TCP, an unmodified OpenSSH server can serve it today: sshd starts socat for the subsystem, and socat connects to the TCP port of any resolver, BIND, Unbound or the resolver of the operating system. A forced command per key binds each station's connection to a source address of its own, by which the resolver's views tell the stations apart. Appendix B gives a tested configuration. What is lost: the resolver sees no SSH connection, only a TCP connection from a loopback address, and a key withdrawn from authorized_keys does not end a channel that is already open.

6.6 Further uses of the channel


7. Configuration and the OCPP Device Model

7.1 DNSServerController: the transport SSH

Secure Name Resolution section 3.1.2 defines one instance of the component DNSServerController per name server. DNS over SSH adds a value to its Transport and the following variables, named like those of the NTP Client Controller in NTS over SSH section 7:

Variable Name req/opt Mutability Data Type Default Value Values List / Limits Description
SSHUserName optional rw string "" ≤ 32 characters The login of the SSH user authentication. Empty: the station's own identity (SecurityCtrlr.Identity).
SSHHostKeyPins optional rw string "" comma separated, ≤ 16 SHA-256 fingerprints of the host keys the server may show, in the notation SHA256:<base64> of ssh-keygen -l. An MD5 fingerprint is Rejected with reasonCode InvalidValue.
SSHHostCAs optional rw string "" comma separated, ≤ 4 SHA-256 fingerprints of SSH CA keys that may sign the server's host certificate, for its Address as a principal.
SSHConnection optional rw OptionList Dedicated Dedicated, Shared Dedicated: an SSH connection of the name server's own. Shared: the subsystem is one more channel of the SSH connection the station keeps to the SSH peer Address names (section 6.3).
SSHClientPublicKey optional ro string "" - The public key the station authenticates with, as a line of authorized_keys: SSHClientController.ClientPublicKey[DNS], or with SSHConnection Shared the key of the connection to that SSH peer.
SSHHostKeyFingerprint optional ro string "" - The SHA-256 fingerprint of the host key the server showed at its last handshake.
SSHStatus optional ro OptionList "" Accepted, PinMismatch, Untrusted, WeakAlgorithms, AuthenticationFailed, SubsystemRefused, NoSSHPeer The outcome of the last attempt: believed and served; a host key that neither a pin nor a CA vouches for; a host certificate that is invalid or not for Address; no strict KEX or only algorithms the station must not use (section 8.2); the station's key not taken; the subsystem refused; Address is no SSH peer of the station with SSHConnection Shared. Empty before the first attempt.

The existing variables of DNSServerController keep their meaning, with these exceptions for SSH:

7.2 Rules for SetVariablesRequest

The rules of Secure Name Resolution section 3.1.3 apply: with ACID or BASE the variables of a server are checked and applied as one change, and an IndependentRequests change is checked entry by entry against the configuration as it is after the entries before it. For SSH they are joined by:

7.3 Keys: the purpose DNS of SSHClientController

OCPP over SSH gives the station one SSH key per purpose, Station, NTS and SFTP (its decision 9), as instances of the variables ClientPublicKey, ClientPendingPublicKey, ClientCertificate and ClientKeyMaxAge of SSHClientController. This paper adds the purpose DNS:

DNS has a key of its own, as time has one (decision 2 of chapter 12): it is withdrawn at a name server without the station's own key being touched, and a name server that is not the station's CSMS or Local Controller never holds the key that opens OCPP. A name server with SSHConnection Shared needs none: it is a channel of a connection the station signed in to with its own key.

7.4 Security events

Security event Critical When
InvalidNameServerHostKey yes A name server over SSH showed a host key that neither a pin nor a CA vouches for, or an invalid host certificate; the analogue of InvalidNameServerCertificate of Secure Name Resolution and of InvalidCsmsHostKey of OCPP over SSH. TechInfo: the server, e.g. ssh://192.0.2.53:22, and the fingerprint shown. Sent once per change of the verdict, not at every attempt.
NameServerHostKeyChanged no A name server was believed with another host key than before, e.g. the second key of its pin set.
NameServerAuthenticationFailed no A name server did not take the station's key.
InvalidSSHAlgorithms yes (OCPP over SSH, section 9.4) A name server offered only algorithms the station must not use, or no strict KEX. TechInfo names the server.
ReconfigurationOfSecurityParameters no (existing) The DNS configuration, a pin or the station's DNS key changed.

Like those of Secure Name Resolution section 3.1.4, they wait in a queue kept on disk while the CSMS is out of reach: with name resolution broken is when they matter.

7.5 OCPP 1.6

The configuration keys of Secure Name Resolution section 3.2 take the same extensions:

Key Name req/opt Accessibility Type Default Value Example Description
dns.transports optional rw CSL String "UDP" "SSH, TLS" Takes SSH as well.
dns.sshUserNames optional rw CSL String "" ", cs001" See SSHUserName; an empty entry is the station's identity.
dns.sshConnection optional rw CSL String "Dedicated" "Shared, Dedicated" See SSHConnection.
dns.sshHostKeyPins.n optional rw CSL String "" "SHA256:N09Y…fsUI" The host key pins of the n-th server. A SHA256: fingerprint has 50 characters, so 9 fit into the 500 characters of a value.
dns.sshHostCAs.n optional rw CSL String "" - The SSH CAs of the n-th server.
dns.sshHostKeyFingerprints optional r CSL String "" - See SSHHostKeyFingerprint, per server.

The station's DNS key is SSHClient.ClientPublicKey.DNS of OCPP over SSH section 9.5; the messages of section 7.3 travel as DataTransfer, and the security events by the security whitepaper's SecurityEventNotification.

7.6 Example

A station behind the Local Controller 10.10.0.1, which it dials with ssh://10.10.0.1:22 for OCPP, resolves through that connection; as a second server it has a resolver of the CPO over SSH, pinned with its current and its next host key. Only encrypted servers are asked.

OCPP 2.x SetVariablesRequest with "dataConsistencyModel": "ACID":

{
  "setVariableData": [
    { "component": { "name": "DNSClientController" },                      "variable": { "name": "Servers"              }, "attributeValue": "lc,cpo-1" },
    { "component": { "name": "DNSServerController", "instance": "lc" },    "variable": { "name": "Address"              }, "attributeValue": "10.10.0.1" },
    { "component": { "name": "DNSServerController", "instance": "lc" },    "variable": { "name": "Transport"            }, "attributeValue": "SSH" },
    { "component": { "name": "DNSServerController", "instance": "lc" },    "variable": { "name": "SSHConnection" }, "attributeValue": "Shared" },
    { "component": { "name": "DNSServerController", "instance": "cpo-1" }, "variable": { "name": "Address"              }, "attributeValue": "192.0.2.53" },
    { "component": { "name": "DNSServerController", "instance": "cpo-1" }, "variable": { "name": "Transport"            }, "attributeValue": "SSH" },
    { "component": { "name": "DNSServerController", "instance": "cpo-1" }, "variable": { "name": "SSHHostKeyPins"       }, "attributeValue": "SHA256:N09YbIseXi6qHT4L2l3MQ1bXfYFg8SSZmtmYTdOfsUI,SHA256:5xAUFY6gLcuSnCQmJPjuXZdQVcRWcgT72ayb8firQQ4" },
    { "component": { "name": "DNSClientController" },                      "variable": { "name": "EncryptedOnly"        }, "attributeValue": "true" }
  ]
}

The station then shows its DNS key in DNSServerController[cpo-1].SSHClientPublicKey, and the CSMS enrolls it at the CPO's resolver. The server lc shows the station's OCPP key.

The section dns of the configuration file of the reference implementation, as proposed:

"dns": {
  "servers": [
    { "id": "lc",    "address": "10.10.0.1",  "transport": "SSH", "ssh": { "connection": "shared" } },
    { "id": "cpo-1", "address": "192.0.2.53", "transport": "SSH",
      "sshHostKeys": [ "SHA256:N09YbIseXi6qHT4L2l3MQ1bXfYFg8SSZmtmYTdOfsUI",
                       "SHA256:5xAUFY6gLcuSnCQmJPjuXZdQVcRWcgT72ayb8firQQ4" ] }
  ],
  "encryptedOnly": true
}

8. Security considerations

8.1 Authentication

8.2 Algorithms and traffic analysis

8.3 What SSH does not authenticate

SSH authenticates the resolver, not the data. A resolver that is compromised, or misconfigured, answers wrongly over the best channel. DNSSEC authenticates the data itself:

8.4 Confinement, identity and privacy

8.5 Availability and denial of service

8.6 Downgrade


9. Alternatives

The problems of section 1.1 can partly be solved within TLS, and interoperably:

Approach Without CA Without correct clock Without the address in a credential Client identity Interoperable today
DNS over SSH (this paper) yes yes yes, with a pin yes with OpenSSH in front of a resolver (appendix B)
DNS over TLS, certificate for the IP address from one's own CA no no no no yes
DNS over TLS, pinned certificate (Secure Name Resolution, CertificatePins) only with a self-signed certificate installed as its own root no no no yes
DNS over TLS, SPKI pin of RFC 7858, section 4.2 yes depends on the client yes no partly; Secure Name Resolution lists the notation as a ToDo
DNS over TLS with raw public keys (RFC 7250; Key Pins and Raw Public Keys) yes yes yes possible hardly
DNS over QUIC (RFC 9250) as DNS over TLS as DNS over TLS as DNS over TLS no partly
DNS inside OCPP (DNS-over-OCPP, upcoming) as the OCPP transport as the OCPP transport as the OCPP transport the OCPP identity no

10. Implementation status and work plan

10.1 What exists to build on

Repository What
Hermod, Hermod/DNS/Server/DNSServer.cs HandleFramedDNSStreamAsync(Stream, …), the one handler of the length-prefixed stream that serves both TCP and DNS over TLS, open to other transports as ServeFramedStreamAsync
Hermod, Hermod/DNS/Client/DNSStreamPipeline.cs pipelined queries and answers out of order on one stream, used by the clients of TCP and DNS over TLS
Hermod, Hermod/DNS/Server/DNSMessagePipeline.cs the zone, TSIG, SIG(0) and padding shared by every transport of the server
Hermod, Hermod/SSH subsystems on the server (SshSubsystemFactory, SshSubsystemContext with the session and the channel), SshClient.OpenSubsystemAsync, a channel as a Stream (SshMuxChannel.AsStream())
WWCP_Node the shared SSH listener with subsystems per kind of login, access rules and limits (OCPP over SSH, section 12.1); the dns configuration with pins (Secure Name Resolution)
Hermod (SshSharedConnection), WWCP_Node (SSHPeer), ChargingStation, Norn one SSH connection of the station to an SSH peer, made by whoever needs it first, with OCPP and the key exchange of NTS as channels of it (SSHConnection Shared of NTS over SSH, section 7)

10.2 What is built

10.3 What is missing

Not part of this work, and a task of its own:

10.4 Work plan

  1. (done) Hermod: the client, and the server side for it to talk to.
  2. (done) WWCP_Node and WWCP_OCPP: Transport SSH, the variables, SSHConnection, the key purpose and the security events.
  3. (done) DNSConformanceTests: the test criteria of chapter 11 that concern the client as conformance tests of Hermod, and OpenSSH, socat and BIND as an independent server.

11. Test criteria

# Test Expected result
T1 A query over the channel. The same answer as over TCP from the same server.
T2 Three queries in one write (appendix A). Three answers, each matched to its query by ID and question, in whatever order they come.
T3 A query written one octet per SSH_MSG_CHANNEL_DATA; an answer of 60,000 octets. Both arrive whole. The server does not close the channel because a read held only part of a message.
T4 A server answers two long messages in parallel. Neither interleaves with the other on the channel.
T5 A host key that is not pinned. Not used; SSHStatus PinMismatch, Problem true, InvalidNameServerHostKey once; no query over UDP, TCP or TLS to that server.
T6 The server changes to the second key of its pin set. Used; NameServerHostKeyChanged; KnownSince updated.
T7 A host certificate of a CA in SSHHostCAs, for the address dialled; then for another address. Used; then not used, SSHStatus Untrusted.
T8 A server without strict KEX. Not used; SSHStatus WeakAlgorithms, InvalidSSHAlgorithms.
T9 The server does not know the station's key. SSHStatus AuthenticationFailed, NameServerAuthenticationFailed; no password sent.
T10 A station's DNS login asks for a shell, exec, SFTP, direct-tcpip and tcpip-forward. All refused.
T11 A station admitted for OCPP only opens dns@. SSH_MSG_CHANNEL_FAILURE; SSHStatus SubsystemRefused.
T12 SSHConnection Shared: a query before OCPP is connected, then OCPP over the same peer. The query has the connection made; one SSH authentication for both (the server's log); the connection and OCPP go on after the DNS channel ends.
T13 SSHConnection Shared to an Address that is no SSH peer, e.g. while OCPP runs over wss://. The server is not asked; SSHStatus NoSSHPeer.
T14 Transport SSH with no pins, no CAs and SSHConnection Dedicated, with ACID. Every entry of that server Rejected, InvalidSSHHostKeyConfig; nothing changed.
T15 CertificatePins for an SSH server; SSHHostKeyPins for a TLS server. Rejected, InvalidValue.
T16 SSHConnection Shared with an Address that is no SSH peer of the station. Rejected, InvalidValue.
T17 The CSMS is dialled at ssh://lc.example:22, and the only name server is SSHConnection Shared to lc.example. Rejected, CSMSUnreachable, although lc.example resolves now.
T18 A cold start with the clock at 1970, name servers over SSH with pinned host keys. Names resolve before the time is synchronized.
T19 The server closes an idle DNS channel on a shared connection. exit-status 0, EOF, CLOSE of that channel; the connection and OCPP go on; the next query opens a new channel.
T20 Two stations ask for the same name at a server with a view per login. Each gets the answer of its view.
T21 The pins of a server change while its channel is open. The connection is closed; the next query makes a new handshake judged by the new pins.
T22 Queries with EDNS padding. Queries padded to a multiple of 128 octets, answers to a multiple of 468.
T23 The station's DNS key is withdrawn at the server while its channel is open. The channel ends within the server's recheck interval.

12. Decisions and open questions

Version 0.1 asked eleven questions. Version 0.2 decides eight of them:

  1. The subsystem name is dns@open.charging.cloud, and dns once it is registered (section 3.1). It carries DNS as TCP carries it, between whoever asks and whoever answers, and says nothing of stub or recursive.
  2. A key for DNS. A purpose DNS of SSHClientController, for name servers with an SSH connection of their own (section 7.3), as NTS is the key for time servers with one. A name server on a shared connection has no key: the connection is the station's, signed in to with the station's key.
  3. OnPinMismatch applies to host keys, as it does for time servers over SSH: Refuse by default, Record and Accept for test benches and migrations (sections 7.1, 8.1). Version 0.1 proposed Refuse only, because for an SSH server the pin is the only check. One rule for names and time is worth more than a second one for names alone, and what Record and Accept cost is said where they are set.
  4. No trust on first use for the host key of a name server, as for a time server over SSH: TrustOnFirstUse stays None. A name server on probation would answer the very names the station needs to reach the CSMS that is to confirm it. And nothing but OCPP goes over a shared connection whose host key is on probation, so no name is asked there before a signed pin set confirms the key.
  5. The default login is the station's identity (section 7.1), which views, limits and logs per station need. A resolver behind OpenSSH with one account takes SSHUserName (appendix B.2).
  6. Which SSH peer. SSHConnection Shared names its peer by Address. It does not follow whichever host OCPP is connected to: the SSH peers are the station's, not OCPP's (OCPP over SSH, sections 7.2 and 7.3), and a name server has nothing to do with OCPP. A station that shall keep a name server whatever its network connection profile says has the peer in SSHPeerController.
  7. SetNetworkProfile is not checked for DNS. A profile that removes an ssh:// connection removes an SSH peer only where the profile was the one thing that made the host a peer; the name server is then out of reach (SSHStatus NoSSHPeer) like any server that is, and the others are asked. The rule that a CSMS must not cut itself off (section 7.2) stays a rule for changes of the DNS configuration.
  8. Views per identity are part of this paper as something a server can do (section 4.3); the reference implementation tells a request handler who asked, and builds no views yet (chapter 10). There is no variable that tells a station which view it is in: a station asks, and the operator of the resolver knows.

Three stay open:

  1. Padding. Recommended, as in RFC 8467, or required over SSH?
  2. DNS Push Notifications for the HTTPS and SRV records of EVQI (section 6.6): a section here, or a paper of its own?
  3. Standardization. A private specification for now, and a proposal together with OCPP over SSH later? Or an Internet-Draft of its own, as DNS over SSH is not specific to charging?

13. Relation to other white papers

References


Appendix A: Test vectors

The DNS messages below were written by a Python script after RFC 1035 and RFC 7830, sent with the key of cs001 through ssh -s … dns@open.charging.cloud to OpenSSH 10.0, relayed by socat to BIND 9.20 (appendix B), and BIND's answers read back. BIND answered all three queries, so it parsed them; the answers are BIND's, octet for octet. The first two octets of each block are the length of DNS over TCP, which is all the subsystem adds to a DNS message.

A.1 Query: csms.example.org, type A

ID 0x0001, RD set, an OPT record with a UDP size of 1232 and a Padding option of 79 octets, which pads the message to 128 octets (RFC 8467).

0000  00 80 00 01 01 00 00 01 00 00 00 00 00 01 04 63
0010  73 6d 73 07 65 78 61 6d 70 6c 65 03 6f 72 67 00
0020  00 01 00 01 00 00 29 04 d0 00 00 00 00 00 53 00
0030  0c 00 4f 00 00 00 00 00 00 00 00 00 00 00 00 00
0040  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0050  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0060  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0070  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0080  00 00

130 octets: the length 0x0080, then the 128 octets of the message.

A.2 Answer to A.1

csms.example.org. 300 IN A 192.0.2.10, with an OPT record whose Padding option of 403 octets pads the message to 468 octets. Flags 0x8500: QR, AA, RD.

0000  01 d4 00 01 85 00 00 01 00 01 00 00 00 01 04 63
0010  73 6d 73 07 65 78 61 6d 70 6c 65 03 6f 72 67 00
0020  00 01 00 01 c0 0c 00 01 00 01 00 00 01 2c 00 04
0030  c0 00 02 0a 00 00 29 04 d0 00 00 00 00 01 97 00
0040  0c 01 93 00 00 00 00 00 00 00 00 00 00 00 00 00
....  zeros up to and including offset 01d5

470 octets: the length 0x01d4, then the 468 octets of the message.

A.3 Answer to a query for nosuch.example.org, type A

ID 0x0003, sent in the same write as A.1 and a query of ID 0x0002 for type AAAA. NXDOMAIN, with the SOA record of the zone; padded to 468 octets as well.

0000  01 d4 00 03 85 03 00 01 00 00 00 01 00 01 06 6e
0010  6f 73 75 63 68 07 65 78 61 6d 70 6c 65 03 6f 72
0020  67 00 00 01 00 01 c0 13 00 06 00 01 00 00 01 2c
0030  00 26 02 6e 73 c0 13 0a 68 6f 73 74 6d 61 73 74
0040  65 72 c0 13 00 00 00 01 00 00 0e 10 00 00 02 58
0050  00 01 51 80 00 00 01 2c 00 00 29 04 d0 00 00 00
0060  00 01 73 00 0c 01 6f 00 00 00 00 00 00 00 00 00
....  zeros up to and including offset 01d5

470 octets.

A.4 SSH_MSG_CHANNEL_REQUEST for the subsystem

The request of RFC 4254, section 6.5 for recipient channel 0, with want reply, as the payload of an SSH packet before encryption: message number 98, the channel, string "subsystem", boolean TRUE, string "dns@open.charging.cloud". Written by the same script after RFC 4254, not by an SSH implementation; OpenSSH sent this request for every ssh -s of appendix B.

0000  62 00 00 00 00 00 00 00 09 73 75 62 73 79 73 74
0010  65 6d 01 00 00 00 17 64 6e 73 40 6f 70 65 6e 2e
0020  63 68 61 72 67 69 6e 67 2e 63 6c 6f 75 64

46 octets.


Appendix B: DNS over SSH with OpenSSH, socat and BIND

Everything in this appendix was run on 2026-11-10 on Debian 13 with OpenSSH 10.0p2, socat 1.8.0.3, BIND 9.20.29, and dig and kdig (Knot 3.4.6) as clients, all on one host. Addresses and ports are those of the test; a Local Controller would listen on its station network. Paths and the account stations are shown as they would be installed: the test ran from a temporary directory, under an existing account, with StrictModes no for that directory.

B.1 The server: sshd in front of BIND

sshd knows the subsystem by a Subsystem line, which is also what makes it accept the name at all:

# sshd_config (excerpt)
Port 2222
HostKey /etc/dns-ssh/ssh_host_ed25519_key
AuthorizedKeysFile /etc/dns-ssh/authorized_keys
PasswordAuthentication no
KbdInteractiveAuthentication no
AllowUsers stations
Subsystem dns@open.charging.cloud /usr/bin/socat STDIO TCP:127.0.0.1:5300

One account, stations, holds the keys of all stations, each with restrict and a forced command. The forced command connects to BIND from a loopback address of the station's own, so that BIND knows who is asking:

restrict,command="/usr/bin/socat STDIO TCP:127.0.0.1:5300,bind=127.0.1.1" ssh-ed25519 AAAA… cs001
restrict,command="/usr/bin/socat STDIO TCP:127.0.0.1:5300,bind=127.0.1.2" ssh-ed25519 AAAA… cs002

BIND holds a view per station, or per group of stations, by those addresses:

options {
    listen-on port 5300 { 127.0.0.1; };
    response-padding { any; } block-size 468;
    …
};
view "tenant-b" {
    match-clients { 127.0.1.2; };
    zone "example.org" { type primary; file "b.zone"; };   // csms → 198.51.100.10
};
view "tenant-a" {
    match-clients { any; };
    zone "example.org" { type primary; file "a.zone"; };   // csms → 192.0.2.10
};

B.2 The client: any DNS client, through ssh -s

ssh -s connects a subsystem to its standard input and output, and socat turns every TCP connection of a local DNS client into one ssh -s. Any client of DNS over TCP then works unchanged:

#!/bin/sh
# dns-over-ssh-cs001.sh
exec ssh -i cs001 -o IdentitiesOnly=yes -o BatchMode=yes \
         -o StrictHostKeyChecking=yes -o UserKnownHostsFile=known_hosts \
         -p 2222 -s stations@127.0.0.1 dns@open.charging.cloud
socat TCP-LISTEN:5353,bind=127.0.0.1,reuseaddr,fork EXEC:./dns-over-ssh-cs001.sh

known_hosts holds the pinned host key, e.g. [127.0.0.1]:2222 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBjFQJRI0L0M9LckjDfArX4qMR47YMMTTdRhx5dKJ3PY.

B.3 Results

Test Result
dig +tcp +keepalive +padding=128 @127.0.0.1 -p 5353 csms.example.org A as cs001 NOERROR, 192.0.2.10; TCP-KEEPALIVE: 30.0 secs and a Padding option of 369 octets in BIND's answer, which is 468 octets long
the same as cs002 198.51.100.10: the view of cs002
kdig +tcp +keepopen with three questions three answers on one connection: NOERROR with the address, NXDOMAIN, NOERROR without data
three queries in one write to ssh -s (appendix A) three answers, matched by ID; ssh exits with 0 after its standard input ends
a host key that is not in known_hosts Host key verification failed, exit code 255; nothing sent
a key sshd does not know Permission denied (publickey), exit code 255
the subsystem foo@open.charging.cloud subsystem request failed on channel 0, exit code 255
ssh … id with a station key the forced socat runs; no output of id
ssh -N -L 5400:127.0.0.1:5300 with a station key channel 1: open failed: administratively prohibited; dig on port 5400 gets no answer

BIND padded its answers because it saw the queries arrive over TCP. The idle timeout BIND announced with edns-tcp-keepalive became, through the relay, the idle timeout of the channel (section 3.4).


License

© 2026 GraphDefined GmbH

This document is published under the Creative Commons Attribution Share Alike 4.0 International (CC-BY-SA 4.0). You are free to share, adapt, and build upon it, even for commercial purposes, as long as you give appropriate credit and distribute your work and contributions under the same license.

Verbatim quotations from the OCPP specifications remain © Open Charge Alliance and are subject to their license (CC BY-ND 4.0).