Broker distant et MQTTS

Bonjour,
pour remplacer jeelink qui permettait de gérer l’interaction entre le jeedom de mon pere et le mien j’ai mis en place le mécanisme via le plugin mqtt2.
Pour ce faire j’ai exposé un broker à l’extérieur avec le protocol mqtts mais j’ai l’impression que le plugin ne gère pas la partie certificat pour les brokers distants.

Dans le code du plugin

 if (config::byKey('mode', __CLASS__) == 'local' || config::byKey('mode', __CLASS__) == 'docker' ) {
         $cmd .= ' --mqtt_server mqtts://127.0.0.1:8883';
         $cmd .= ' --client_key ' . $path_ssl . '/client.key';
         $cmd .= ' --client_crt ' . $path_ssl . '/client.crt';
         $cmd .= ' --ca ' . $path_ssl . '/ca.crt';
      } else {
         $cmd .= ' --mqtt_server ' . config::byKey('remote::protocol', __CLASS__) . '://' . config::byKey('remote::ip', __CLASS__) . ':' . config::byKey('remote::port', __CLASS__);
      }

Le passage des certificats au daemon (qui fait la connexion mqtt) est faite uniquement pour un broker local ou docker mais pas distant
Du coup j’ai modifé en ce sens

 if (config::byKey('mode', __CLASS__) == 'local' || config::byKey('mode', __CLASS__) == 'docker' ) {
         $cmd .= ' --mqtt_server mqtts://127.0.0.1:8883';
         $cmd .= ' --client_key ' . $path_ssl . '/client.key';
         $cmd .= ' --client_crt ' . $path_ssl . '/client.crt';
         $cmd .= ' --ca ' . $path_ssl . '/ca.crt';
      } else {
         if (config::byKey('remote::protocol', __CLASS__) == 'mqtts') {
           	$cmd .= ' --mqtt_server ' . config::byKey('remote::protocol', __CLASS__) . '://' . config::byKey('remote::ip', __CLASS__) . ':8883';
           	$path_ssl = realpath(__DIR__ . '/../../data/ssl');
           
           	$cmd .= ' --client_key ' . $path_ssl . '/client.key';
         	$cmd .= ' --client_crt ' . $path_ssl . '/client.crt';
         	$cmd .= ' --ca ' . $path_ssl . '/ca.crt';
         } else {
           	$cmd .= ' --mqtt_server ' . config::byKey('remote::protocol', __CLASS__) . '://' . config::byKey('remote::ip', __CLASS__) . ':' . config::byKey('remote::port', __CLASS__);
         }
      }

Et j’ai positionné les certificats dans le répertoire attendu, à savoir /data/ssl

A mon sens le plugin ne gère pas ce cas et ma modif est nécessaire ou alors j’ai loupé un truc … non ?

@+
@chris94440

Je pense que tu mélanges 2 choses:

  • encryption ssl de la connexion pour lequel aucun certif client n’est nécessaire => ca fonctionne sans soucis avec le plugin en l’état actuel
  • authentification via certificat client

oui en effet tu as raison … merci

Ce sujet a été automatiquement fermé après 24 heures suivant le dernier commentaire. Aucune réponse n’est permise dorénavant.