Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Vert.x 4.5.4 #2496

Merged
merged 2 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public AmqpClientOptions getNamedOptions() {
.setPemKeyCertOptions(keycert)
.setPemTrustOptions(trust)
.addEnabledSaslMechanism("EXTERNAL")
.setHostnameVerificationAlgorithm("")
.setHostnameVerificationAlgorithm("") // Disable hostname verification
.setConnectTimeout(30000)
.setReconnectInterval(5000)
.setContainerId("my-container");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public MqttClientSessionOptions getOptions() {
.setSsl(true)
.setPemKeyCertOptions(keycert)
.setPemTrustOptions(trust)
.setHostnameVerificationAlgorithm("")
.setHostnameVerificationAlgorithm("HTTPS")
.setConnectTimeout(30000)
.setReconnectInterval(5000);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public RabbitMQOptions getNamedOptions() {
.setSsl(true)
.setPemKeyCertOptions(keycert)
.setPemTrustOptions(trust)
.setHostnameVerificationAlgorithm("")
.setHostnameVerificationAlgorithm("HTTPS")
.setConnectTimeout(30000)
.setReconnectInterval(5000);
}
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>

<vertx.version>4.5.3</vertx.version>
<vertx.version>4.5.4</vertx.version>
<rxjava.version>2.2.21</rxjava.version>
<cloudevent.version>1.1.0</cloudevent.version>
<weld.version>5.1.2.Final</weld.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
@ConnectorAttribute(name = "auto-keep-alive", type = "boolean", direction = INCOMING_AND_OUTGOING, description = "Set if the MQTT client must handle `PINGREQ` automatically", defaultValue = "true")
@ConnectorAttribute(name = "health-enabled", type = "boolean", direction = INCOMING_AND_OUTGOING, description = "Whether health reporting is enabled (default) or disabled", defaultValue = "true")
@ConnectorAttribute(name = "ssl", type = "boolean", direction = INCOMING_AND_OUTGOING, description = "Set whether SSL/TLS is enabled", defaultValue = "false")
@ConnectorAttribute(name = "ssl.hostname-verification-algorithm", type = "string", direction = INCOMING_AND_OUTGOING, description = "Set the hostname verifier algorithm for the TLS connection.Accepted values are `HTTPS`, `LDAPS`, and `NONE` (defaults). `NONE` disables the hostname verification.", defaultValue = "NONE")
@ConnectorAttribute(name = "ssl.keystore.type", type = "string", direction = INCOMING_AND_OUTGOING, description = "Set the keystore type [`pkcs12`, `jks`, `pem`]", defaultValue = "pkcs12")
@ConnectorAttribute(name = "ssl.keystore.location", type = "string", direction = INCOMING_AND_OUTGOING, description = "Set the keystore location. In case of `pem` type this is the server ca cert path")
@ConnectorAttribute(name = "ssl.keystore.password", type = "string", direction = INCOMING_AND_OUTGOING, description = "Set the keystore password. In case of `pem` type this is the key path")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ private static MqttClientSessionOptions createMqttClientOptions(MqttConnectorCom
options.setPort(config.getPort().orElseGet(() -> config.getSsl() ? 8883 : 1883));
options.setReconnectDelay(getReconnectDelayOptions(config));
options.setSsl(config.getSsl());

String algorithm = config.getSslHostnameVerificationAlgorithm();
if ("NONE".equalsIgnoreCase(algorithm)) {
options.setHostnameVerificationAlgorithm("");
} else {
options.setHostnameVerificationAlgorithm(algorithm);
}

options.setKeyCertOptions(getKeyCertOptions(config));
options.setServerName(config.getServerName());
options.setTrustOptions(getTrustOptions(config));
Expand All @@ -53,6 +61,7 @@ private static MqttClientSessionOptions createMqttClientOptions(MqttConnectorCom
options.setWillRetain(config.getWillRetain());
options.setUnsubscribeOnDisconnect(config.getUnsubscribeOnDisconnection());
options.setMetricsName("mqtt|" + config.getChannel());

return options;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,11 @@ public MqttClientSessionOptions setReconnectInterval(long interval) {

@Override
public MqttClientSessionOptions setHostnameVerificationAlgorithm(String hostnameVerificationAlgorithm) {
super.setHostnameVerificationAlgorithm(hostnameVerificationAlgorithm);
if ("NONE".equalsIgnoreCase(hostnameVerificationAlgorithm)) {
super.setHostnameVerificationAlgorithm("");
} else {
super.setHostnameVerificationAlgorithm(hostnameVerificationAlgorithm);
}
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
@ConnectorAttribute(name = "port", direction = INCOMING_AND_OUTGOING, description = "The broker port", type = "int", alias = "rabbitmq-port", defaultValue = "5672")
@ConnectorAttribute(name = "addresses", direction = INCOMING_AND_OUTGOING, description = "The multiple addresses for cluster mode, when given overrides the host and port", type = "string", alias = "rabbitmq-addresses")
@ConnectorAttribute(name = "ssl", direction = INCOMING_AND_OUTGOING, description = "Whether or not the connection should use SSL", type = "boolean", alias = "rabbitmq-ssl", defaultValue = "false")
@ConnectorAttribute(name = "ssl.hostname-verification-algorithm", type = "string", direction = INCOMING_AND_OUTGOING, description = "Set the hostname verifier algorithm for the TLS connection. Accepted values are `HTTPS`, and `NONE` (defaults). `NONE` disables the hostname verification.", defaultValue = "NONE")
@ConnectorAttribute(name = "trust-all", direction = INCOMING_AND_OUTGOING, description = "Whether to skip trust certificate verification", type = "boolean", alias = "rabbitmq-trust-all", defaultValue = "false")
@ConnectorAttribute(name = "trust-store-path", direction = INCOMING_AND_OUTGOING, description = "The path to a JKS trust store", type = "string", alias = "rabbitmq-trust-store-path")
@ConnectorAttribute(name = "trust-store-password", direction = INCOMING_AND_OUTGOING, description = "The password of the JKS trust store", type = "string", alias = "rabbitmq-trust-store-password")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ static RabbitMQOptions getClientOptions(Vertx vertx, RabbitMQConnectorCommonConf
.setUseNio(config.getUseNio())
.setVirtualHost(config.getVirtualHost());

if ("NONE".equals(config.getSslHostnameVerificationAlgorithm())) {
options.setHostnameVerificationAlgorithm("");
} else {
options.setHostnameVerificationAlgorithm(config.getSslHostnameVerificationAlgorithm());
}

// JKS TrustStore
Optional<String> trustStorePath = config.getTrustStorePath();
if (trustStorePath.isPresent()) {
Expand Down
Loading