Skip to content

rust: allow TLS configuration with client cert#559

Open
nbuffon wants to merge 1 commit into
masterfrom
rust_client_cert
Open

rust: allow TLS configuration with client cert#559
nbuffon wants to merge 1 commit into
masterfrom
rust_client_cert

Conversation

@nbuffon

@nbuffon nbuffon commented Jul 10, 2026

Copy link
Copy Markdown
Member

What's new

  • rust : allow to configure TLS using client certificate

How to test

  1. Update the example configuration (examples/config.ini) to point to a broker requiring client certificate
  2. Run the json_counter example
    cargo run --example json_counter
    
    => You must see logs about message received

    Received 10 messages including 7 as JSON
    Received 20 messages including 17 as JSON
    Received 30 messages including 27 as JSON

Signed-off-by: Nicolas Buffon <nicolas.buffon@orange.com>
@nbuffon nbuffon requested a review from tigroo July 10, 2026 12:31

@tigroo tigroo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code ok. Test ko: no logs receive, no error trace:

/home/kvmk8371/.cargo/bin/cargo run --color=always --package libits-client --example json_counter --profile dev -- --config examples/htw-config.ini
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.16s
     Running `target/debug/examples/json_counter --config examples/htw-config.ini`
INFO [libits::client::logger] Logger ready on stdout
INFO [libits::transport::mqtt] Configuring TLS with client certificate (MQTTS)
INFO [libits::transport::mqtt::mqtt_router] Registered route for topic: #
DEBUG [libits::transport::mqtt::mqtt_client] Sent subscriptions
DEBUG [rustls::webpki::anchors] add_parsable_certificates processed 1 valid and 0 invalid certs
DEBUG [rustls::client::hs] No cached session for DnsName("fgvt-fw1.htwsaar.de")
DEBUG [rustls::client::hs] Not resuming any session
DEBUG [rustls::client::hs] Using ciphersuite TLS13_AES_256_GCM_SHA384
DEBUG [rustls::client::tls13] Not resuming
DEBUG [rustls::client::tls13] TLS1.3 encrypted extensions: []
DEBUG [rustls::client::hs] ALPN protocol is None
DEBUG [rustls::client::tls13] Got CertificateRequest CertificateRequestPayloadTls13 { context: , extensions: [SignatureAlgorithms([ECDSA_NISTP256_SHA256, ECDSA_NISTP384_SHA384, ECDSA_NISTP521_SHA512, ED25519, ED448, Unknown(2057), Unknown(2058), Unknown(2059), RSA_PSS_SHA256, RSA_PSS_SHA384, RSA_PSS_SHA512, RSA_PKCS1_SHA256, RSA_PKCS1_SHA384, RSA_PKCS1_SHA512, Unknown(771), Unknown(769)]), AuthorityNames([DistinguishedName(308187310b30090603550406130244453111300f06035504080c08536161726c616e643110300e060355040a0c0768747773616172310d300b060355040b0c04464756543117301506035504030c0e4647565420446576696365204341312b302906092a864886f70d010901161c6d617474686961732e7363686f6c74657340687477736161722e6465), DistinguishedName(30819c310b30090603550406130244453111300f06035504080c08536161726c616e643115301306035504070c0c5361617262727565636b656e3110300e060355040a0c0768747773616172310d300b060355040b0c04464756543115301306035504030c0c4647565420526f6f74204341312b302906092a864886f70d010901161c6d617474686961732e7363686f6c74657340687477736161722e6465)])] }
DEBUG [rustls::client::common] Attempting client auth
DEBUG [rumqttc::v5::state] Subscribe. Topics = [Filter { path: "#", qos: AtMostOnce, nolocal: false, preserve_retain: false, retain_forward_rule: OnEverySubscribe }], Pkid = 1
DEBUG [rumqttc::v5::state] SubAck Pkid = 1, QoS = AtMostOnce
DEBUG [rumqttc::v5::state] Pingreq, last incoming packet before 12.178578ms, last outgoing request before 60.000804783s

@tigroo tigroo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact, waiting 1000 messages instead of 10....it arrives!

Received 1000 messages including 989 as JSON
DEBUG [rumqttc::v5::state] Pingreq, last incoming packet before 184.496016ms, last outgoing request before 60.001049475s
DEBUG [rumqttc::v5::state] Pingreq, last incoming packet before 38.19714ms, last outgoing request before 60.000738554s
DEBUG [rumqttc::v5::state] Pingreq, last incoming packet before 625.203963ms, last outgoing request before 60.000866031s
DEBUG [rumqttc::v5::state] Pingreq, last incoming packet before 643.885008ms, last outgoing request before 60.001562233s
DEBUG [rumqttc::v5::state] Pingreq, last incoming packet before 159.382277ms, last outgoing request before 60.001933928s
Received 2000 messages including 1979 as JSON
DEBUG [rumqttc::v5::state] Pingreq, last incoming packet before 559.930673ms, last outgoing request before 60.001894081s
DEBUG [rumqttc::v5::state] Pingreq, last incoming packet before 163.309095ms, last outgoing request before 60.002105408s
DEBUG [rumqttc::v5::state] Pingreq, last incoming packet before 95.429916ms, last outgoing request before 60.001487659s
DEBUG [rumqttc::v5::state] Pingreq, last incoming packet before 652.051911ms, last outgoing request before 60.000979966s
DEBUG [rumqttc::v5::state] Pingreq, last incoming packet before 612.221475ms, last outgoing request before 60.001446875s
DEBUG [rumqttc::v5::state] Pingreq, last incoming packet before 198.559726ms, last outgoing request before 60.001919131s
Received 3000 messages including 2967 as JSON

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants