Comments (3)
Hi @dlowrey,
thank you for using the mqtt-cli!
This behavior is quite strange as both the properties configuration as well as the command line options use the same logic to setup mTLS..
Could you please give more details about the used formats and encryption algorithms used in your certificates and private key as well as your TLS properties file setup?
For reference, here are the supported TLS configurations and setup possibilities: https://hivemq.github.io/mqtt-cli/docs/tls
A possible issue could be:
In order to use TLS with your default values inside the properties configuration file, simply add -s or --secure.
More details:
The keystore loading uses a natural hierarchy to determine precedence over the security provider possibilities.
- A keystore provided as input parameter
- A private key and related certificate provided as input parameter
- A keystore provided as default option inside the cli configuration file
- A private key and related certificate provided as default option inside the cli configuration file
Since #125 we created system tests that include multiple tests for TLS and mTLS.
For example:
src/systemTest/java/com/hivemq/cli/commands/cli/publish/PublishConnectMTlsST.java
@CartesianTest
@Timeout(value = 3, unit = TimeUnit.MINUTES)
void test_properties_encrypted_pem_private_keys_mutualTls(
@CartesianTest.Values(chars = {'3', '5'}) final char mqttVersion,
@CartesianTest.Enum final @NotNull TlsVersion tlsVersion,
@CartesianTest.Values(strings = {
"pkcs1.aes256.pem",
//"pkcs1.camellia256.pem",
//"pkcs1.des.pem",
"pkcs1.des3.pem", "pkcs8.aes256.pem",
//"pkcs8.camellia256.pem",
//"pkcs8.des.pem",
"pkcs8.des3.pem"}) final @NotNull String clientKeyType) throws Exception {
final String certificateAuthorityPublicKey = Resources.getResource("tls/certificateAuthority/ca.pem").getPath();
final String clientPublicKey = Resources.getResource("tls/client/client-cert.pem").getPath();
final String clientPrivateKey = Resources.getResource("tls/client/client-key." + clientKeyType).getPath();
final Map<String, String> properties = Map.of("auth.client.cert",
clientPublicKey,
"auth.client.key",
clientPrivateKey,
"auth.server.cafile",
certificateAuthorityPublicKey,
"auth.client.key.password",
"clientKeyPassword");
final List<String> publishCommand = List.of("pub",
"-h",
hivemq.getHost(),
"-p",
String.valueOf(hivemq.getMqttTlsPort()),
"-V",
String.valueOf(mqttVersion),
"-i",
"cliTest",
"-t",
"test",
"-m",
"message",
"-s",
"--tls-version",
tlsVersion.toString(),
"-d");
final ExecutionResultAsync executionResult = mqttCli.executeAsync(publishCommand, Map.of(), properties);
executionResult.awaitStdOut("finish PUBLISH");
assertConnectPacket(hivemq.getConnectPackets().get(0),
connectAssertion -> connectAssertion.setMqttVersion(MqttVersionConverter.toExtensionSdkVersion(
mqttVersion)));
assertPublishPacket(hivemq.getPublishPackets().get(0), publishAssertion -> {
publishAssertion.setTopic("test");
publishAssertion.setPayload(ByteBuffer.wrap("message".getBytes(StandardCharsets.UTF_8)));
});
}
from mqtt-cli.
https://hivemq.kanbanize.com/ctrl_board/22/cards/23977/details/
from mqtt-cli.
I am closing this issue for now. Feel free to reopen anytime if the issue still persists after applying my proposed solution.
from mqtt-cli.
Related Issues (20)
- Error while running mqtt swarm on uBuntu 18.04 HOT 2
- Can't install deb package on systems with a headless jre HOT 1
- Use private key in DER format HOT 1
- Can't pipe to `head`
- Problems using secure connection HOT 1
- Cannot connect to AWS IoT core: "Exception while decoding CONNACK: remaining length too short" HOT 1
- Windows Command Line Verbiage Gibberish HOT 3
- Allow publish with empty payload to delete a retained message
- PUBACK missing in debug/verbose mode
- Unable to run on Windows - JRE 1.8 required HOT 1
- GraalVM Native Image in addition to runnable jar HOT 1
- Tests red, on local source code build HOT 3
- Test Command: username/password from config.properties ignored HOT 1
- Print topic for incoming messages HOT 1
- Link points to the oldest version HOT 1
- Unknown option: '--ws' HOT 2
- Dependency Dashboard
- MQTT Usage Error on Nvidia Jetson HOT 3
- Raspberry pi version, PLEASE! HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mqtt-cli.