• Recent
    • Unsolved
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Storage node availability check ignores `FOG_SSH_PORT` (hardcoded port 22)

    Scheduled Pinned Locked Moved Unsolved Bug Reports
    2 Posts 2 Posters 4 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • L
      Lucas26
      last edited by

      Storage node availability check ignores FOG_SSH_PORT (hardcoded port 22)

      Environment

      FOG version 1.6.0-beta (branch working-1.6)
      Upgraded from 1.5.10.1826
      OS Ubuntu (Apache 2.4.66, PHP-FPM)
      Storage node single master node, same host as the FOG server
      SSH sshd listening on a non-standard port (not 22)

      Summary

      StorageNode::loadOnline() probes the node on a hardcoded TCP port 22 instead of reading the FOG_SSH_PORT global setting. On a server whose sshd listens on a non-standard port, every storage node is permanently reported as offline, which makes all imaging and registration tasks fail.

      This is the SSH counterpart of the FTP issue already fixed in PR #801 (“Remove hardcoded ftp port for storage node availability check”, released in 1.5.10.1812).

      Steps to reproduce

      1. Configure sshd on the FOG server to listen on a non-standard port (e.g. Port 35002), with Subsystem sftp internal-sftp enabled.
      2. Set the matching value in the database:
        UPDATE globalSettings SET settingValue='35002' WHERE settingKey='FOG_SSH_PORT';
        
      3. Open the dashboard and look at the storage node status.
      4. PXE boot a client and select any task (registration or deployment).

      Expected behaviour

      The availability probe uses the port configured in FOG_SSH_PORT, the node is reported as online, and tasks proceed normally.

      Actual behaviour

      • The dashboard shows the storage node as unavailable, even though the node is enabled, is the master node, has free client slots, and accepts SFTP connections normally on its configured port.
      • Saving the storage node in the web UI returns Warning Unable to connect using ip, user, and/or password provided! (this part is fixed once FOG_SSH_PORT is set, since fogssh.class.php reads it correctly — but the dashboard status remains wrong).
      • Any task selected from the iPXE menu fails with HTTP 5xx. Apache logs:
      PHP Fatal error:  Uncaught Exception: No nodes available in /var/www/fog/lib/fog/storagegroup.class.php:338
      Stack trace:
      #0 /var/www/fog/lib/fog/bootmenu.class.php(1021): StorageGroup->getOptimalStorageNode()
      #1 /var/www/fog/lib/fog/bootmenu.class.php(1468): BootMenu->falseTasking()
      #2 /var/www/fog/lib/fog/bootmenu.class.php(1400): BootMenu->setTasking()
      #3 /var/www/fog/lib/fog/bootmenu.class.php(541): BootMenu->verifyCreds()
      #4 /var/www/fog/service/ipxe/boot.php(52): BootMenu->__construct()
      

      Root cause

      packages/web/lib/fog/storagenode.class.php, method loadOnline():

      public function loadOnline()
      {
          $test = self::$FOGURLRequests->isAvailable($this->get('ip'), '0.1', 22, 'tcp');
          $this->set('online', array_shift($test));
      }
      

      The port is a literal 22. The FOG_SSH_PORT setting is never consulted here, although packages/web/lib/fog/fogssh.class.php does read it correctly:

      list($portOverride) = FOGCore::getSetting(['FOG_SSH_PORT']);
      if (!$port) {
          if ($portOverride) {
              $port = $portOverride;
          } else {
              $port = $this->port;
          }
      }
      

      online being false makes StorageGroup::getOptimalStorageNode() skip the node on its first continue, leaving $winner null and throwing No nodes available.

      Proposed fix

      Mirror the logic already present in fogssh.class.php:

      public function loadOnline()
      {
          list($sshPort) = FOGCore::getSetting(['FOG_SSH_PORT']);
          $sshPort = $sshPort ?: 22;
          $test = self::$FOGURLRequests->isAvailable($this->get('ip'), '0.1', $sshPort, 'tcp');
          $this->set('online', array_shift($test));
      }
      

      Verified on my install: the node immediately reports as online and deployment tasks are created normally.

      Additional note

      FOG_SSH_PORT exists in globalSettings (category “General Settings”) but is not exposed anywhere in the web UI, so it can only be set through direct SQL. Exposing it under FOG Settings would make this configuration discoverable.

      Workaround

      Either patch loadOnline() as above, or add Port 22 to the sshd configuration alongside the custom port.

      French version :

      Le contrôle de disponibilité du nœud de stockage ignore FOG_SSH_PORT (port 22 en dur)

      Environnement

      Version FOG 1.6.0-beta (branche working-1.6)
      Migré depuis 1.5.10.1826
      OS Ubuntu (Apache 2.4.66, PHP-FPM)
      Nœud de stockage nœud maître unique, sur le même hôte que le serveur FOG
      SSH sshd à l’écoute sur un port non standard (pas 22)

      Résumé

      StorageNode::loadOnline() teste la disponibilité du nœud sur le port TCP 22 écrit en dur, au lieu de lire le réglage global FOG_SSH_PORT. Sur un serveur dont sshd écoute sur un port non standard, tous les nœuds de stockage sont durablement considérés comme hors ligne, ce qui fait échouer l’ensemble des tâches de déploiement et d’enregistrement.

      C’est l’équivalent SSH du problème FTP déjà corrigé par la PR #801 (« Remove hardcoded ftp port for storage node availability check », livrée en 1.5.10.1812).

      Étapes de reproduction

      1. Configurer sshd sur le serveur FOG pour écouter sur un port non standard (par exemple Port 35002), avec Subsystem sftp internal-sftp activé.
      2. Renseigner la valeur correspondante en base :
         UPDATE globalSettings SET settingValue='35002' WHERE settingKey='FOG_SSH_PORT';
      
      1. Ouvrir le tableau de bord et observer l’état du nœud de stockage.
      2. Démarrer un client en PXE et sélectionner n’importe quelle tâche (enregistrement ou déploiement).

      Comportement attendu

      Le test de disponibilité utilise le port configuré dans FOG_SSH_PORT, le nœud est signalé en ligne, et les tâches se déroulent normalement.

      Comportement constaté

      • Le tableau de bord affiche le nœud de stockage comme indisponible, alors qu’il est activé, qu’il est bien le nœud maître, qu’il dispose de créneaux clients libres et qu’il accepte les connexions SFTP sans problème sur son port configuré.
      • L’enregistrement du nœud de stockage dans l’interface web retourne Warning Unable to connect using ip, user, and/or password provided! (ce point-là est résolu une fois FOG_SSH_PORT renseigné, puisque fogssh.class.php le lit correctement — mais l’état affiché au tableau de bord reste erroné).
      • Toute tâche sélectionnée depuis le menu iPXE échoue en HTTP 5xx. Journaux Apache :
      PHP Fatal error:  Uncaught Exception: No nodes available in /var/www/fog/lib/fog/storagegroup.class.php:338
      Stack trace:
      #0 /var/www/fog/lib/fog/bootmenu.class.php(1021): StorageGroup->getOptimalStorageNode()
      #1 /var/www/fog/lib/fog/bootmenu.class.php(1468): BootMenu->falseTasking()
      #2 /var/www/fog/lib/fog/bootmenu.class.php(1400): BootMenu->setTasking()
      #3 /var/www/fog/lib/fog/bootmenu.class.php(541): BootMenu->verifyCreds()
      #4 /var/www/fog/service/ipxe/boot.php(52): BootMenu->__construct()
      

      Cause racine

      packages/web/lib/fog/storagenode.class.php, méthode loadOnline() :

      public function loadOnline()
      {
          $test = self::$FOGURLRequests->isAvailable($this->get('ip'), '0.1', 22, 'tcp');
          $this->set('online', array_shift($test));
      }
      

      Le port est un littéral 22. Le réglage FOG_SSH_PORT n’est jamais consulté ici, alors que packages/web/lib/fog/fogssh.class.php le lit correctement :

      list($portOverride) = FOGCore::getSetting(['FOG_SSH_PORT']);
      if (!$port) {
          if ($portOverride) {
              $port = $portOverride;
          } else {
              $port = $this->port;
          }
      }
      

      online étant à false, StorageGroup::getOptimalStorageNode() écarte le nœud dès son premier continue, laisse $winner à null et lève No nodes available.

      Correctif proposé

      Reprendre la logique déjà présente dans fogssh.class.php :

      public function loadOnline()
      {
          list($sshPort) = FOGCore::getSetting(['FOG_SSH_PORT']);
          $sshPort = $sshPort ?: 22;
          $test = self::$FOGURLRequests->isAvailable($this->get('ip'), '0.1', $sshPort, 'tcp');
          $this->set('online', array_shift($test));
      }
      

      Vérifié sur

      Tom ElliottT 1 Reply Last reply Reply Quote 0
      • Tom ElliottT
        Tom Elliott @Lucas26
        last edited by

        @Lucas26 Thanks for letting us know and should be fixed in the latest.

        Also found a similar class of bug for FTP ports and we are porting the FTP side to dev-branch as we speak.

        Please let us know if this is working now?

        Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

        Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

        Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post

        93

        Online

        12.7k

        Users

        17.6k

        Topics

        156.8k

        Posts
        Copyright © 2012-2026 FOG Project