我尝试使用带有Node的TLS连接到我的MQTT代理时遇到问题,当我使用其工作的相同证书连接另一个客户端时,但使用以下代码:
var caFile = fs.readFileSync(caPath);
var certFile = fs.readFileSync(certPath);
var keyFile = fs.readFileSync(keyPath);
this._client = mqtt.connect(Meteor.settings.mqtt.url, tls.connect({
ca: [ caFile ],
cert: certFile,
key: keyFile,
rejectUnauthorized: false,
port: Meteor.settings.mqtt.port,
host: Meteor.settings.mqtt.host,
secureProtocol: 'TLSv1_method'
}));
我收到此错误:
W20160629-09:21:02.336(-3)? (STDERR)
W20160629-09:21:02.336(-3)? (STDERR) events.js:72
W20160629-09:21:02.336(-3)? (STDERR) throw er; // Unhandled 'error' event
W20160629-09:21:02.336(-3)? (STDERR) ^
W20160629-09:21:02.339(-3)? (STDERR) Error: 140735208951808:error:04091068:rsa routines:INT_RSA_VERIFY:bad signature:../deps/openssl/openssl/crypto/rsa/rsa_sign.c:229:
W20160629-09:21:02.339(-3)? (STDERR) 140735208951808:error:1408D07B:SSL routines:SSL3_GET_KEY_EXCHANGE:bad signature:../deps/openssl/openssl/ssl/s3_clnt.c:1912:
W20160629-09:21:02.340(-3)? (STDERR)
W20160629-09:21:02.340(-3)? (STDERR) at SlabBuffer.use (tls.js:235:18)
W20160629-09:21:02.340(-3)? (STDERR) at CleartextStream.read [as _read] (tls.js:455:29)
W20160629-09:21:02.340(-3)? (STDERR) at CleartextStream.Readable.read (_stream_readable.js:341:10)
W20160629-09:21:02.340(-3)? (STDERR) at EncryptedStream.write [as _write] (tls.js:369:25)
W20160629-09:21:02.341(-3)? (STDERR) at doWrite (_stream_writable.js:226:10)
W20160629-09:21:02.341(-3)? (STDERR) at writeOrBuffer (_stream_writable.js:216:5)
W20160629-09:21:02.341(-3)? (STDERR) at EncryptedStream.Writable.write (_stream_writable.js:183:11)
W20160629-09:21:02.341(-3)? (STDERR) at write (_stream_readable.js:602:24)
W20160629-09:21:02.342(-3)? (STDERR) at Array.forEach (/Users/joaquinleonelrobles/.meteor/packages/es5-shim/.4.5.11.1tr4jml++os+web.browser+web.cordova/npm/node_modules/es5-shim/es5-shim.js:435:21)
W20160629-09:21:02.342(-3)? (STDERR) at flow (_stream_readable.js:613:19)
W20160629-09:21:02.342(-3)? (STDERR) at Socket.pipeOnReadable (_stream_readable.js:643:5)
W20160629-09:21:02.342(-3)? (STDERR) at Socket.emit (events.js:92:17)
W20160629-09:21:02.342(-3)? (STDERR) at emitReadable_ (_stream_readable.js:427:10)
W20160629-09:21:02.343(-3)? (STDERR) at emitReadable (_stream_readable.js:423:5)
W20160629-09:21:02.343(-3)? (STDERR) at readableAddChunk (_stream_readable.js:166:9)
W20160629-09:21:02.343(-3)? (STDERR) at Socket.Readable.push (_stream_readable.js:128:10)
W20160629-09:21:02.343(-3)? (STDERR) at TCP.onread (net.js:529:21)
这是我的Mosquitto MQTT配置:
listener 8883
protocol mqtt
mount_point asdqwe/
cafile /etc/mosquitto/ca_certificates/ca.crt
certfile /etc/mosquitto/certs/host.crt
keyfile /etc/mosquitto/certs/host.key
tls_version tlsv1
require_certificate true
allow_anonymous false
use_identity_as_username true
use_username_as_clientid true
acl_file /etc/mosquitto/acl
有什么想法吗?感谢
更新 这是我的蚊子日志
1467201492: New connection from 1.1.1.1 on port 8883.
1467201492: OpenSSL Error: error:140A1159:SSL routines:SSL_BYTES_TO_CIPHER_LIST:scsv received when renegotiating
1467201492: Socket error on client <unknown>, disconnecting.