fix(mqtt sink, mqtt source): honor tls.alpn_protocols instead of hardcoding "mqtt"#25807
Open
frank-hivewatch wants to merge 1 commit into
Open
fix(mqtt sink, mqtt source): honor tls.alpn_protocols instead of hardcoding "mqtt"#25807frank-hivewatch wants to merge 1 commit into
frank-hivewatch wants to merge 1 commit into
Conversation
…coding "mqtt" The MQTT sink and source built the rumqttc TLS transport with a hardcoded ALPN list of ["mqtt"], ignoring the user-configured tls.alpn_protocols even though it is a documented, accepted option. This prevented connecting to endpoints that require a specific ALPN protocol name, notably AWS IoT Core over port 443, which requires "x-amzn-mqtt-ca" for X.509 mutual-TLS auth. Both now read tls.alpn_protocols from the config and fall back to "mqtt" only when it is unset, preserving existing behavior. Fixes vectordotdev#25805
Contributor
|
Thank you for your contribution! Before we can merge this PR, please sign our Contributor License Agreement. To sign, copy and post the phrase below as a new comment on this PR.
I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
Author
|
I have read the CLA Document and I hereby sign the CLA |
Author
|
recheck |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
mqttsink and source built therumqttcTLS transport with a hardcoded ALPN list of["mqtt"], ignoring the user-configuredtls.alpn_protocolseven though it is a documented and accepted TLS option. As a result, settingtls.alpn_protocolshad no effect on MQTT connections.The most common impact is that the MQTT sink/source cannot connect to AWS IoT Core over port 443. On its default endpoints, AWS IoT Core requires clients using X.509 client-certificate authentication on port 443 to negotiate the ALPN protocol name
x-amzn-mqtt-ca; the baremqttname is only accepted for custom authentication. Port 443 is often the only reachable option for deployments behind firewalls that block the non-standard MQTT port 8883.This PR threads the configured
tls.alpn_protocolsinto therumqttcTlsConfiguration::Simple { alpn, .. }, falling back to["mqtt"]only when the option is unset — so existing behavior is preserved for anyone who did not set it.Vector configuration
How did you test this PR?
cargo check --no-default-features --features sinks-mqtt,sources-mqttpasses.tls.alpn_protocolsvalues are passed through as the ALPNprotocol list (each protocol name as raw bytes), and that an unset option still yields
the previous
["mqtt"]default.x-amzn-mqtt-caALPN onport 443 with the same X.509 client certificate via
openssl s_client -connect <endpoint>:443 -alpn x-amzn-mqtt-ca -servername <endpoint> -CAfile AmazonRootCA1.pem -cert thingCert.crt -key privKey.key(
Verify return code: 0), which is the negotiation Vector previously could not perform.Change Type
Is this a breaking change?
Does this PR include user facing changes?
no-changeloglabel to this PR.References
Notes
src/sinks/mqtt/config.rsandsrc/sources/mqtt/config.rs; both are fixed here.Cargo.lockuntouched).