Mosquitto の Bridge を SSL で試します
Mosquitto 間の Bridge 接続を SSL で試してみます。
「Mosquitto の SSL 対応を試してみる」で作成した独自認証局の CA 証明書を使用し、また、mosquitto-tls のクライアント証明書の作成手順で、ブリッジ接続するサーバー用にも証明書を作成しました。
ブリッジ接続するサーバー側の /etc/mosquitto/mosquitto.conf に追記します。
[shell]
#connection <name>
connection hoge-bridge
#address <host>[:<port>] [<host>[:<port>]]
address www.hoge.jp:8883
#topic <topic> [[[out | in | both] qos-level] local-prefix remote-prefix]
topic chat in 0 bridge-in/ test/
#username
username mqtt
#password
password mqttpasswd
#bridge_cafile
bridge_cafile /etc/mosquitto/tls/ca.crt
#bridge_capath
#bridge_certfile
bridge_certfile /etc/mosquitto/tls/bridge.crt
#bridge_keyfile
bridge_keyfile /etc/mosquitto/tls/bridge.key
bridge_tls_version tlsv1
[/shell]
(※ bridge_tls_version を追記しました。)
証明書の Common Name は重要で、接続先ホスト名でなければなりません。CA 証明書は、接続先のものと同じものをコピーしてもってきます。