TLS and authorisation
This guide secures a MicroRTI server, the HLA 4 RTI: TLS on the Federate Protocol connections, a
certificate that federates can check, and a password that every federate must give to connect. It
covers the server, the microrti-cli and chat tools, and the Rust and Python clients. Every command
and output below comes from MicroRTI 0.5.0 with a throw-away certificate.
What each part does
TLS encrypts the connection between a federate and the RTI. The tls and wss transports carry it
(TLS 1.3, see 12.13.5.1 of IEEE 1516.1). On its own, TLS does not tell the federate who is at the other
end: for that the federate needs trust anchors, the certificates the RTI’s certificate must chain to.
Authorisation decides who may use the RTI (4.1.7, 12.5). MicroRTI has the predefined authorisation
service of the standard, HLAauthorizer (12.6): one global password, which each federate sends at
Connect as HLAplainTextPassword credentials. The password is sent as plain text, so over a tcp:// or
ws:// connection anyone on the path can read it. Use the password together with TLS.
Make a certificate
If your organisation runs a certificate authority, ask it for a certificate for the RTI host and skip to the next section. Otherwise, these commands make a small authority of your own and a certificate for the RTI signed by it:
# 1. A certificate authority. ca.pem goes to the federates; keep ca-key.pem to yourself.
openssl req -x509 -newkey rsa:2048 -nodes -days 365 -subj "/CN=Lab RTI CA" \
-keyout ca-key.pem -out ca.pem
# 2. The RTI's private key and a certificate request.
openssl req -newkey rsa:2048 -nodes -subj "/CN=rti.example.org" \
-keyout rti-key.pem -out rti.csr
# 3. The authority signs it, for every name federates will use to reach the RTI.
printf 'subjectAltName = DNS:rti.example.org, DNS:localhost, IP:127.0.0.1\n' > rti.ext
openssl x509 -req -in rti.csr -CA ca.pem -CAkey ca-key.pem -CAcreateserial -days 365 \
-extfile rti.ext -out rti-chain.pemDo not skip the subjectAltName line: a federate checks that the host part of its RTI address
(rti.example.org in tls://rti.example.org:15165) is one of these names. The common name (CN) is not
checked. If the RTI’s certificate comes from an intermediate authority, append the intermediate
certificate to rti-chain.pem after the RTI’s own: the file holds the chain, leaf first.
Of the files this leaves, ca.pem goes to the federates, and rti-chain.pem and rti-key.pem go to
the RTI host. ca-key.pem can sign more certificates, so keep it off both.
These commands were run with OpenSSL 1.1.1 and with LibreSSL 3.3.6, the openssl of macOS. Two other
recipes you may find need care with LibreSSL:
- An elliptic curve key made with
openssl req -newkey ec -pkeyopt ec_paramgen_curve:P-256describes its curve by explicit parameters, which TLS does not accept. Add-pkeyopt ec_param_enc:named_curve. - A certificate made in one step with
openssl req -x509is X.509 version 1 unless you give it an extension, and TLS needs version 3. Add-addext "subjectAltName=DNS:rti.example.org". (The certificate authority above is version 1 with LibreSSL; the MicroRTI clients accept it as a trust anchor.)
The RTI checks the certificate and the key at start and in check-config, and says what to change:
microrti: invalid setting `tls_private_key`: a-key.pem: its elliptic curve is given by explicit parameters instead of by name. TLS accepts named curves only (RFC 5480, 2.1.1). LibreSSL's `openssl req -newkey ec -pkeyopt ec_paramgen_curve:P-256` writes such keys and certificates: add `-pkeyopt ec_param_enc:named_curve`, or make the key with `openssl ecparam -name prime256v1 -genkey`, and issue the certificate again
microrti: invalid setting `tls_certificate_chain`: b-cert.pem: certificate chain: the certificate is an X.509 version 1 certificate; TLS peers require version 3. LibreSSL's `openssl req -x509` writes version 1 unless an extension is given: add for example `-addext subjectAltName=DNS:HOST`
microrti: invalid setting `tls_private_key`: d-key.pem: the key is encrypted; give it unencrypted (`openssl pkey -in KEY -out PLAIN`)Each of these stops the RTI with exit status 2 before it opens any port.
Start the RTI with TLS and a password
Put the certificate in a certs directory next to the RID, and the password in a file only the RTI’s
user can read:
printf 'correct horse\n' > rti-password
chmod 600 rti-password# microrti.toml: TLS only, and a password for every federate
tls_certificate_chain = "certs/rti-chain.pem"
tls_private_key = "certs/rti-key.pem"
[[listener]]
transport = "tls"
address = "0.0.0.0:15165"
[[listener]]
transport = "wss"
address = "0.0.0.0:8443"
[authorization]
enabled = true
password_file = "rti-password"Paths are relative to the RID file. Check the file first; check-config reads the password but never
shows it, and checks that TLS can use the certificate and the key:
microrti check-config microrti.toml# microrti.toml: the settings are valid. Effective settings:
log_level = "info"
tick_period_ms = 100
service_report_directory = "microrti-service-reports"
# no save_directory: federation saves are kept in memory, lost when the RTI stops
fom_urls = "all"
# FOM modules and MIMs named by file:, http: or https: URL are read wherever they are: restrict with fom_urls = "none" or fom_url_directory
fom_url_timeout = 30
# no fom_url_root_certificates: https servers are verified against the trust store of the system
max_message_size = 67108864
rti_timeout_heart = 180
rti_timeout_purge = 600
tls_certificate_chain = "certs/rti-chain.pem"
tls_private_key = "certs/rti-key.pem"
[[listener]]
transport = "tls"
address = "0.0.0.0:15165"
[[listener]]
transport = "wss"
address = "0.0.0.0:8443"
[authorization]
enabled = true
authorizer = "HLAauthorizer"
# password: set (not shown)Then start the RTI. The log says that authorisation is on, and warns that the RTI reads the FOM modules that federates name by URL, for other hosts too (see files and addresses the RTI reads):
microrti --config microrti.toml2026-12-02T20:57:55.005210Z INFO microrti: microrti starting version="0.5.0"
2026-12-02T20:57:55.005793Z WARN microrti::server: FOM modules and MIMs named by file:, http: or https: URL are read wherever they are, for federates of other hosts too: set fom_urls = "none" or fom_url_directory unless every host that reaches the RTI is trusted timeout=30s
2026-12-02T20:57:55.005812Z INFO microrti::server: federation saves are kept in memory and lost when the RTI stops: set save_directory to keep them in files
2026-12-02T20:57:55.006825Z INFO microrti::server: RTI listening endpoint=tls://0.0.0.0:15165
listening on tls://0.0.0.0:15165
listening on wss://0.0.0.0:8443
2026-12-02T20:57:55.006839Z INFO microrti::server: RTI listening endpoint=wss://0.0.0.0:8443
2026-12-02T20:57:55.006843Z INFO microrti::server: authorization is required authorizer=HLAauthorizer
2026-12-02T20:57:55.006861Z INFO microrti_fedpro::server: Federate Protocol listener ready address=0.0.0.0:15165 transport=tls
2026-12-02T20:57:55.006859Z INFO microrti_fedpro::server: Federate Protocol listener ready address=0.0.0.0:8443 transport=wssThe same without a RID file:
microrti -l tls://0.0.0.0:15165 -l wss://0.0.0.0:8443 \
--tls-cert certs/rti-chain.pem --tls-key certs/rti-key.pem \
--authorization true --password-file rti-passwordThe password can come from three places. In the RID, password_file reads a file (a line end at its
end is not part of the password), password_env names an environment variable of the RTI process, and
password writes it in the RID itself. Give only one of them. On the command line there are
--password-file and --password-env only, so the password never shows in the process list. Either
option replaces the password source of the file:
MICRORTI_PASSWORD='correct horse' microrti --config microrti.toml --password-env MICRORTI_PASSWORDIf the variable is not set, the RTI does not start:
microrti: invalid setting `authorization.password_env`: the environment variable MICRORTI_PASSWORD is not setEncryption only: a self-signed certificate
tls_self_signed = true in the RID, or --tls-self-signed, makes the RTI generate a certificate at every
start. It is valid for localhost, 127.0.0.1, ::1 and the addresses of listeners bound to a
specific address, and it is never written to disk.
microrti -l tls://0.0.0.0:15165 -l wss://0.0.0.0:8443 --tls-self-signedFederates cannot check this certificate: no authority signs it, and it changes at every start. They connect in the encryption-only mode of 12.13.5.1, which is what the MicroRTI clients do when you give them no trust anchors:
microrti-cli --rti wss://localhost:8443 pingwss://localhost:8443: connected in 11.086 ms, service round trip 0.525 ms, 12.581 ms in allA federate that does ask for a check is refused:
microrti-cli: cannot connect to the RTI at wss://localhost:8443: ConnectionFailed: cannot reach the RTI: wss://localhost:8443/: transport error: TLS handshake with wss://localhost:8443/ failed: invalid peer certificate: UnknownIssuerThis protects against someone who only listens to the network, but not against someone who can put a machine of their own between the federate and the RTI. Use it for tests and closed networks.
What federates need
A federate needs three things for the RTI above: a tls:// or wss:// RTI address, the trust anchors
(ca.pem), and the password.
microrti-cli, chat | Rust and Python clients | |
|---|---|---|
| RTI address | --rti tls://rti.example.org:15165 | the RTI address of the configuration |
| Trust anchors | --tls-trust-anchors ca.pem | TLS_TRUST_ANCHORS=ca.pem in the additional settings |
| Name to check, when it is not the host of the address | --setting TLS_SERVER_NAME=rti.example.org | TLS_SERVER_NAME=rti.example.org in the additional settings |
| Password | --password 'correct horse' or the environment variable MICRORTI_PASSWORD | Credentials of type HLAplainTextPassword given to Connect |
Without trust anchors the MicroRTI clients still encrypt, but they accept any certificate. For federates written in Java or C++ with Pitch FedProClient, see Java federates and C++ federates.
microrti-cli and chat
Both tools take the same connection options. With the right trust anchors and password:
microrti-cli --rti tls://localhost:15165 --tls-trust-anchors ca.pem --password 'correct horse' pingtls://localhost:15165: connected in 16.901 ms, service round trip 0.481 ms, 18.194 ms in allThe password can also come from the environment variable MICRORTI_PASSWORD. That keeps it off the
command line of each tool, where other users of the machine could read it in the process list:
export MICRORTI_PASSWORD='correct horse'
microrti-cli --rti wss://localhost:8443 --tls-trust-anchors ca.pem ping
chat --rti tls://localhost:15165 --tls-trust-anchors ca.pem --name aliceWhen you reach the RTI by an address that is not in its certificate, through a tunnel for example, give the name to check:
microrti-cli --rti tls://127.0.0.1:15165 --tls-trust-anchors ca.pem --setting TLS_SERVER_NAME=rti.example.org pingThe TLS errors you are likely to meet, as microrti-cli prints them:
# the RTI's certificate was not signed by any certificate of ca.pem
microrti-cli: cannot connect to the RTI at tls://localhost:15165: ConnectionFailed: cannot reach the RTI: tls://localhost:15165: transport error: TLS handshake with tls://localhost:15165 failed: invalid peer certificate: UnknownIssuer
# the name checked (here --setting TLS_SERVER_NAME=lab.example.org) is not in the certificate
microrti-cli: cannot connect to the RTI at tls://127.0.0.1:15165: ConnectionFailed: cannot reach the RTI: tls://127.0.0.1:15165: transport error: TLS handshake with tls://127.0.0.1:15165 failed: invalid peer certificate: certificate not valid for name "lab.example.org"; certificate is only valid for DnsName("rti.example.org"), DnsName("localhost") or IpAddress(127.0.0.1)
# a tcp:// address pointed at the TLS port
microrti-cli: cannot connect to the RTI at tcp://127.0.0.1:15165: ConnectionFailed: cannot reach the RTI: tcp://127.0.0.1:15165: transport error: connection closed in the middle of a messageThe RTI logs each failed handshake at the info level, with the address of the peer and what went
wrong. For the three cases above, in the same order:
INFO microrti_fedpro::server: TLS handshake failed; connection dropped peer=127.0.0.1:58656 transport=tls error=transport error: TLS handshake: received fatal alert: UnknownCA
INFO microrti_fedpro::server: TLS handshake failed; connection dropped peer=127.0.0.1:58657 transport=tls error=transport error: TLS handshake: received fatal alert: BadCertificate
INFO microrti_fedpro::server: TLS handshake failed; connection dropped peer=127.0.0.1:58658 transport=tls error=transport error: TLS handshake: received corrupt message of type InvalidContentTypeFor the last case the client tried three connections before it gave up, and only the first one is at
info. The RTI reports the same failure from the same address once a minute at info; the repetitions
are debug lines marked repeated=true. With --log-level debug, the same tcp:// ping gave:
INFO microrti_fedpro::server: TLS handshake failed; connection dropped peer=127.0.0.1:58682 transport=tls error=transport error: TLS handshake: received corrupt message of type InvalidContentType
DEBUG microrti_fedpro::server: TLS handshake failed; connection dropped peer=127.0.0.1:58683 transport=tls error=transport error: TLS handshake: received corrupt message of type InvalidContentType repeated=true
DEBUG microrti_fedpro::server: TLS handshake failed; connection dropped peer=127.0.0.1:58684 transport=tls error=transport error: TLS handshake: received corrupt message of type InvalidContentType repeated=trueThe address is compared without the port, since each new connection comes from another port. A
connection closed during the handshake, as a port scan does, is not logged. The messages of the TLS
library itself (rustls) are kept out of the default log: they are debug lines with the target
rustls, and its detailed messages are at trace.
Rust
The TLS settings go in the additional settings of the RtiConfiguration, one KEY=VALUE per line, and
the password goes in Credentials. This program was built against microrti-client 0.5.0:
use microrti_client::{
CallbackModel, Credentials, ExceptionKind, NullFederateAmbassador, RtiAmbassador, RtiConfiguration,
};
fn main() {
let address = std::env::args().nth(1).unwrap_or_else(|| "tls://rti.example.org".to_owned());
let password = std::env::var("RTI_PASSWORD").unwrap_or_default();
let configuration = RtiConfiguration::new()
.with_rti_address(address.as_str())
.with_additional_settings("TLS_TRUST_ANCHORS=ca.pem\nFED_TIMEOUT_CONNECT=5");
let credentials = Credentials::plain_text_password(&password);
let rti = RtiAmbassador::new();
match rti.connect_with_configuration_and_credentials(
NullFederateAmbassador,
CallbackModel::Evoked,
&configuration,
&credentials,
) {
Ok(_) => {
println!("connected to {address}");
let _ = rti.disconnect();
}
Err(error) if error.kind == ExceptionKind::Unauthorized => println!("refused: {}", error.message),
Err(error) => println!("cannot connect: {error}"),
}
}RTI_PASSWORD='correct horse' cargo run -- tls://localhost:15165
RTI_PASSWORD='nope' cargo run -- tls://localhost:15165connected to tls://localhost:15165
refused: wrong passwordca.pem is read from the working directory of the federate; give an absolute path in real use.
Over tls:// and wss://, a TLS_ line the client cannot use fails Connect with ConnectionFailed, so
that a misspelt trust anchor setting never leaves the RTI unchecked. With TLS_TRUST_ANCHOR=ca.pem
(the final S missing):
cannot connect: ConnectionFailed: cannot reach the RTI: additional settings, line 1: TLS_TRUST_ANCHOR: unknown setting (known: FED_INT_HEART, FED_TIMEOUT_HEART, FED_TIMEOUT_RECONNECT, FED_INT_RECONNECT, FED_TIMEOUT_CONNECT, TLS_TRUST_ANCHORS, TLS_SERVER_NAME): over TLS such a line may be the trust anchors written wrong, and the RTI certificate cannot be validated as asked; no connection is madeThis departs on purpose from Connect as 4.2 describes it, where a setting that cannot be parsed is
reported in the result and the connection is made anyway; that is what happens with every other
setting (Rust client). The same settings exist in code, on microrti_client::fedpro::FedProOptions:
FedProOptions::new().with_trust_anchors_file("ca.pem").with_tls_server_name("rti.example.org"), handed
to RtiAmbassador::with_connector(FedProConnector::new(options)). The Rust client
page lists the other settings.
Python
The Python package takes the same keys in RtiConfiguration and the same Credentials. This ran with
version 0.3.0 of the package (it is not on PyPI, see Python client):
import os
import sys
import microrti
from microrti import CallbackModel, Credentials, RtiAmbassador, RtiConfiguration
configuration = RtiConfiguration(
sys.argv[1],
additional_settings="TLS_TRUST_ANCHORS=ca.pem\nTLS_SERVER_NAME=rti.example.org",
)
credentials = Credentials.plain_text_password(os.environ["RTI_PASSWORD"])
rti = RtiAmbassador()
try:
rti.connect(None, CallbackModel.EVOKED, configuration, credentials)
print("connected")
rti.disconnect()
except microrti.Unauthorized as error:
print("refused:", error)
except microrti.ConnectionFailed as error:
print("cannot connect:", error)RTI_PASSWORD='correct horse' python secure_connect.py tls://127.0.0.1:15165
RTI_PASSWORD='wrong' python secure_connect.py tls://127.0.0.1:15165connected
refused: wrong passwordWhat a refused federate sees
The Connect service raises Unauthorized (4.2). The message says why:
microrti-cli --rti tls://localhost:15165 --tls-trust-anchors ca.pem --password 'battery staple' ping
microrti-cli --rti tls://localhost:15165 --tls-trust-anchors ca.pem pingmicrorti-cli: cannot connect to the RTI at tls://localhost:15165: Unauthorized: wrong password
hint: the password comes from --password or from the environment variable MICRORTI_PASSWORD; this RTI requires authorization and does not accept that password
microrti-cli: cannot connect to the RTI at tls://localhost:15165: Unauthorized: this RTI requires credentialsThe tools add a hint: line to every refusal of a password they sent, chosen from the words of the
refusal: here the RTI requires a password and this one is wrong. An RTI that words its refusal in
another way gets a hint that names both possible causes.
In Rust the error has kind == ExceptionKind::Unauthorized; in Python it is the exception class
microrti.Unauthorized. Credentials whose data is not a valid HLAunicodeString give
InvalidCredentials instead.
The reverse case is easy to trip over. An RTI without authorisation refuses a federate that sends a password, as 12.5 asks:
MICRORTI_PASSWORD='correct horse' microrti-cli --rti tcp://127.0.0.1:58685 pingmicrorti-cli: cannot connect to the RTI at tcp://127.0.0.1:58685: Unauthorized: this RTI is not configured for authorization but credentials were supplied
hint: the password comes from --password or from the environment variable MICRORTI_PASSWORD; this RTI does not require authorization and refuses every password (IEEE 1516.1-2025, 12.5), so leave both outchat prints the same. If you see it, look for a MICRORTI_PASSWORD left set in your shell.
The RTI logs every refusal as a warning, with the address of the peer:
WARN microrti::service: authorization refused session=5635d7b6beedb72e peer=127.0.0.1:58664 service="Connect" exception=Unauthorized details=wrong password
WARN microrti::service: authorization refused session=d137fd187c275b8a peer=127.0.0.1:58686 service="Connect" exception=Unauthorized details=this RTI is not configured for authorization but credentials were suppliedThe HLAauthorizer also checks Create Federation Execution, Destroy Federation Execution and Join
Federation Execution, with the credentials given at Connect. With one global password, a federate that
got through Connect passes those checks too.
Files and addresses the RTI reads
A federate can name a FOM module by URL instead of sending its content (12.13.3.3), and the RTI then
reads the module itself. By default the microrti server reads every file:, http: and https: URL,
wherever it leads. On your own machine, or among federates that are all yours, that is convenient. A
federate you do not trust can use it in three ways:
- It can have the RTI open any file that the RTI’s process may read. The content never comes back in a
message, but the answer tells whether the file exists and whether it is XML
(
No such file or directory (os error 2)againstnot a well-formed XML document at line 1, column 1), and a file that happens to be a valid FOM module becomes part of the FDD that the MOM shows to the federation execution. - It can have the RTI send an HTTP request to any address the RTI’s host reaches, servers inside its own network included. The answer tells whether the connection was refused, got no answer in time, or which HTTP status came back.
- It can keep the 8 readers of the RTI busy, so that the modules other federates name by URL wait until their time limit.
With authorisation on, the RTI reads nothing for a federate that has not connected with the password: the authorisation service is asked before the modules of a Create or Join Federation Execution are read, and again when the service is carried out.
Restrict the reading when federates you do not trust can reach the RTI: a listener on a network that
others share, a port reachable from the internet, or a reverse proxy in front of a loopback listener.
The RTI warns at start when a listener accepts other hosts (the WARN line above), but it cannot see
the proxy case, where every connection comes from the loopback interface. Two settings restrict it:
fom_urls = "none"(or--fom-urls none): no module named by URL is read, and federates send the content. The MicroRTI clients do that unless you ask for a URL withFomModule::url, and Pitch FedProClient does it whenever it finds the file where the federate runs.fom_url_directory(or--fom-url-directory): only thefile:URLs of the files under one directory are read, and everything else is refused,..and symbolic links that lead out included. Keep the certificate, the private key, the password file and the save directory outside it.
The details and the exact messages are in Configure the RTI.
Limits
- There is one password for every federate. There are no user accounts, no roles and no per-federation
rights, and
HLAauthorizeris the only authorisation service of themicrortibinary. A Rust program that hosts the RTI as a library can give the engine an authorisation service of its own (Rti::with_authorizer) and start it withRtiServer::start_with_rti. - The RTI does not ask federates for client certificates.
- The certificate and the password are read at start. To change them, restart the RTI; federates still joined at that moment are lost for their federation execution.
Next steps
- Configure the RTI: every other setting of the RID.
- Watch and operate a federation:
microrti-cliagainst this RTI. - Rust client and Python client: the full connection settings.