Skip to content

fix(mqtt source): pass client certificates to rumqttc for mTLS#24929

Merged
thomasqueirozb merged 5 commits intovectordotdev:masterfrom
mr-:fix-mqtt-mtls
May 8, 2026
Merged

fix(mqtt source): pass client certificates to rumqttc for mTLS#24929
thomasqueirozb merged 5 commits intovectordotdev:masterfrom
mr-:fix-mqtt-mtls

Conversation

@mr-
Copy link
Copy Markdown
Contributor

@mr- mr- commented Mar 14, 2026

Summary

This PR fixes a bug in the MQTT source where user-provided TLS client certificates (crt_file / key_file) were being silently ignored, breaking mTLS connections to strict brokers like AWS IoT Core.

Vector configuration


sources:
  aws_iot_subscriber:
    type: "mqtt"
    host: "foo-ats.iot.eu-central-1.amazonaws.com"
    port: 8883
    client_id: "MARTIN"

    topic:
      - "v1/sensors"


    tls:
      enabled: true
      ca_file:  "AmazonBundle.pem"
      crt_file: "AWS-IoT-Client.crt"
      key_file: "AWS-IoT-Client-pkcs8.key"
    decoding:
      codec: "bytes"


sinks:
  console_output:
    type: "console"
    inputs:
      - "aws_iot_subscriber"
    target: "stdout"
    encoding:
      codec: "text"

How did you test this PR?

It was tested manually by providing valid certificates.

Change Type

  • Bug fix
  • New feature
  • Dependencies
  • Non-functional (chore, refactoring, docs)
  • Performance

Is this a breaking change?

  • Yes
  • No

Does this PR include user facing changes?

Not sure. Not unless people depended on certificates being ignored.

  • Yes. Please add a changelog fragment based on our guidelines.
  • No. A maintainer will apply the no-changelog label to this PR.

References

Notes

  • Please read our Vector contributor resources.
  • Do not hesitate to use @vectordotdev/vector to reach out to us regarding this PR.
  • Some CI checks run only after we manually approve them.
    • We recommend adding a pre-push hook, please see this template.
    • Alternatively, we recommend running the following locally before pushing to the remote branch:
      • make fmt
      • make check-clippy (if there are failures it's possible some of them can be fixed with make clippy-fix)
      • make test
  • After a review is requested, please avoid force pushes to help us review incrementally.
    • Feel free to push as many commits as you want. They will be squashed into one before merging.
    • For example, you can run git merge origin master and git push.
  • If this PR introduces changes Vector dependencies (modifies Cargo.lock), please
    run make build-licenses to regenerate the license inventory and commit the changes (if any). More details here.

@mr- mr- requested a review from a team as a code owner March 14, 2026 20:37
@github-actions github-actions Bot added the domain: sources Anything related to the Vector's sources label Mar 14, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 14, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@mr-
Copy link
Copy Markdown
Contributor Author

mr- commented Mar 14, 2026

@vectordotdev/vector when debugging this, I've noticed that all errors are silently ignored.
I've added logs now, but I'm not sure if there's more error handling that should be done. As far as I know, rumqttc's EventLoop/poll will try to reconnect, but not all errors are transient.

@mr-
Copy link
Copy Markdown
Contributor Author

mr- commented Mar 14, 2026

I have read the CLA Document and I hereby sign the CLA

@mr- mr- changed the title fix(mqtt): pass client certificates to rumqttc for mTLS fix(mqtt source): pass client certificates to rumqttc for mTLS Mar 14, 2026
Comment thread src/sources/mqtt/source.rs Outdated
Comment thread src/sources/mqtt/source.rs
Comment thread changelog.d/mqtt_source_mutual_TLS.fix.md Outdated
@thomasqueirozb thomasqueirozb added meta: awaiting author Pull requests that are awaiting their author. source: mqtt labels Mar 16, 2026
@github-actions github-actions Bot removed the meta: awaiting author Pull requests that are awaiting their author. label Mar 17, 2026
@mr-
Copy link
Copy Markdown
Contributor Author

mr- commented Apr 26, 2026

Hey @vectordotdev/vector, can I have a review please? It's only a 1 line change now :)

Copy link
Copy Markdown
Contributor

@thomasqueirozb thomasqueirozb left a comment

Choose a reason for hiding this comment

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

Thank you!

@thomasqueirozb thomasqueirozb enabled auto-merge May 8, 2026 17:11
@thomasqueirozb thomasqueirozb added this pull request to the merge queue May 8, 2026
Merged via the queue into vectordotdev:master with commit f2f1921 May 8, 2026
58 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators May 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

domain: sources Anything related to the Vector's sources source: mqtt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants