<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Storage node availability check ignores &#96;FOG_SSH_PORT&#96; (hardcoded port 22)]]></title><description><![CDATA[<h1>Storage node availability check ignores <code>FOG_SSH_PORT</code> (hardcoded port 22)</h1>
<h2>Environment</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>FOG version</td>
<td>1.6.0-beta (branch <code>working-1.6</code>)</td>
</tr>
<tr>
<td>Upgraded from</td>
<td>1.5.10.1826</td>
</tr>
<tr>
<td>OS</td>
<td>Ubuntu (Apache 2.4.66, PHP-FPM)</td>
</tr>
<tr>
<td>Storage node</td>
<td>single master node, same host as the FOG server</td>
</tr>
<tr>
<td>SSH</td>
<td>sshd listening on a non-standard port (not 22)</td>
</tr>
</tbody>
</table>
<h2>Summary</h2>
<p dir="auto"><code>StorageNode::loadOnline()</code> probes the node on a hardcoded TCP port 22 instead of reading the <code>FOG_SSH_PORT</code> 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.</p>
<p dir="auto">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).</p>
<h2>Steps to reproduce</h2>
<ol>
<li>Configure sshd on the FOG server to listen on a non-standard port (e.g. <code>Port 35002</code>), with <code>Subsystem sftp internal-sftp</code> enabled.</li>
<li>Set the matching value in the database:<pre><code class="language-sql">UPDATE globalSettings SET settingValue='35002' WHERE settingKey='FOG_SSH_PORT';
</code></pre>
</li>
<li>Open the dashboard and look at the storage node status.</li>
<li>PXE boot a client and select any task (registration or deployment).</li>
</ol>
<h2>Expected behaviour</h2>
<p dir="auto">The availability probe uses the port configured in <code>FOG_SSH_PORT</code>, the node is reported as online, and tasks proceed normally.</p>
<h2>Actual behaviour</h2>
<ul>
<li>The dashboard shows the storage node as <strong>unavailable</strong>, even though the node is enabled, is the master node, has free client slots, and accepts SFTP connections normally on its configured port.</li>
<li>Saving the storage node in the web UI returns <code>Warning Unable to connect using ip, user, and/or password provided!</code> (this part is fixed once <code>FOG_SSH_PORT</code> is set, since <code>fogssh.class.php</code> reads it correctly — but the dashboard status remains wrong).</li>
<li>Any task selected from the iPXE menu fails with HTTP 5xx. Apache logs:</li>
</ul>
<pre><code>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-&gt;getOptimalStorageNode()
#1 /var/www/fog/lib/fog/bootmenu.class.php(1468): BootMenu-&gt;falseTasking()
#2 /var/www/fog/lib/fog/bootmenu.class.php(1400): BootMenu-&gt;setTasking()
#3 /var/www/fog/lib/fog/bootmenu.class.php(541): BootMenu-&gt;verifyCreds()
#4 /var/www/fog/service/ipxe/boot.php(52): BootMenu-&gt;__construct()
</code></pre>
<h2>Root cause</h2>
<p dir="auto"><code>packages/web/lib/fog/storagenode.class.php</code>, method <code>loadOnline()</code>:</p>
<pre><code class="language-php">public function loadOnline()
{
    $test = self::$FOGURLRequests-&gt;isAvailable($this-&gt;get('ip'), '0.1', 22, 'tcp');
    $this-&gt;set('online', array_shift($test));
}
</code></pre>
<p dir="auto">The port is a literal <code>22</code>. The <code>FOG_SSH_PORT</code> setting is never consulted here, although <code>packages/web/lib/fog/fogssh.class.php</code> does read it correctly:</p>
<pre><code class="language-php">list($portOverride) = FOGCore::getSetting(['FOG_SSH_PORT']);
if (!$port) {
    if ($portOverride) {
        $port = $portOverride;
    } else {
        $port = $this-&gt;port;
    }
}
</code></pre>
<p dir="auto"><code>online</code> being <code>false</code> makes <code>StorageGroup::getOptimalStorageNode()</code> skip the node on its first <code>continue</code>, leaving <code>$winner</code> null and throwing <code>No nodes available</code>.</p>
<h2>Proposed fix</h2>
<p dir="auto">Mirror the logic already present in <code>fogssh.class.php</code>:</p>
<pre><code class="language-php">public function loadOnline()
{
    list($sshPort) = FOGCore::getSetting(['FOG_SSH_PORT']);
    $sshPort = $sshPort ?: 22;
    $test = self::$FOGURLRequests-&gt;isAvailable($this-&gt;get('ip'), '0.1', $sshPort, 'tcp');
    $this-&gt;set('online', array_shift($test));
}
</code></pre>
<p dir="auto">Verified on my install: the node immediately reports as online and deployment tasks are created normally.</p>
<h2>Additional note</h2>
<p dir="auto"><code>FOG_SSH_PORT</code> exists in <code>globalSettings</code> (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.</p>
<h2>Workaround</h2>
<p dir="auto">Either patch <code>loadOnline()</code> as above, or add <code>Port 22</code> to the sshd configuration alongside the custom port.</p>
<p dir="auto">French version :</p>
<h1>Le contrôle de disponibilité du nœud de stockage ignore <code>FOG_SSH_PORT</code> (port 22 en dur)</h1>
<h2>Environnement</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>Version FOG</td>
<td>1.6.0-beta (branche <code>working-1.6</code>)</td>
</tr>
<tr>
<td>Migré depuis</td>
<td>1.5.10.1826</td>
</tr>
<tr>
<td>OS</td>
<td>Ubuntu (Apache 2.4.66, PHP-FPM)</td>
</tr>
<tr>
<td>Nœud de stockage</td>
<td>nœud maître unique, sur le même hôte que le serveur FOG</td>
</tr>
<tr>
<td>SSH</td>
<td>sshd à l’écoute sur un port non standard (pas 22)</td>
</tr>
</tbody>
</table>
<h2>Résumé</h2>
<p dir="auto"><code>StorageNode::loadOnline()</code> teste la disponibilité du nœud sur le port TCP 22 écrit en dur, au lieu de lire le réglage global <code>FOG_SSH_PORT</code>. 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.</p>
<p dir="auto">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).</p>
<h2>Étapes de reproduction</h2>
<ol>
<li>Configurer sshd sur le serveur FOG pour écouter sur un port non standard (par exemple <code>Port 35002</code>), avec <code>Subsystem sftp internal-sftp</code> activé.</li>
<li>Renseigner la valeur correspondante en base :</li>
</ol>
<pre><code class="language-sql">   UPDATE globalSettings SET settingValue='35002' WHERE settingKey='FOG_SSH_PORT';
</code></pre>
<ol start="3">
<li>Ouvrir le tableau de bord et observer l’état du nœud de stockage.</li>
<li>Démarrer un client en PXE et sélectionner n’importe quelle tâche (enregistrement ou déploiement).</li>
</ol>
<h2>Comportement attendu</h2>
<p dir="auto">Le test de disponibilité utilise le port configuré dans <code>FOG_SSH_PORT</code>, le nœud est signalé en ligne, et les tâches se déroulent normalement.</p>
<h2>Comportement constaté</h2>
<ul>
<li>Le tableau de bord affiche le nœud de stockage comme <strong>indisponible</strong>, 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é.</li>
<li>L’enregistrement du nœud de stockage dans l’interface web retourne <code>Warning Unable to connect using ip, user, and/or password provided!</code> (ce point-là est résolu une fois <code>FOG_SSH_PORT</code> renseigné, puisque <code>fogssh.class.php</code> le lit correctement — mais l’état affiché au tableau de bord reste erroné).</li>
<li>Toute tâche sélectionnée depuis le menu iPXE échoue en HTTP 5xx. Journaux Apache :</li>
</ul>
<pre><code>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-&gt;getOptimalStorageNode()
#1 /var/www/fog/lib/fog/bootmenu.class.php(1468): BootMenu-&gt;falseTasking()
#2 /var/www/fog/lib/fog/bootmenu.class.php(1400): BootMenu-&gt;setTasking()
#3 /var/www/fog/lib/fog/bootmenu.class.php(541): BootMenu-&gt;verifyCreds()
#4 /var/www/fog/service/ipxe/boot.php(52): BootMenu-&gt;__construct()
</code></pre>
<h2>Cause racine</h2>
<p dir="auto"><code>packages/web/lib/fog/storagenode.class.php</code>, méthode <code>loadOnline()</code> :</p>
<pre><code class="language-php">public function loadOnline()
{
    $test = self::$FOGURLRequests-&gt;isAvailable($this-&gt;get('ip'), '0.1', 22, 'tcp');
    $this-&gt;set('online', array_shift($test));
}
</code></pre>
<p dir="auto">Le port est un littéral <code>22</code>. Le réglage <code>FOG_SSH_PORT</code> n’est jamais consulté ici, alors que <code>packages/web/lib/fog/fogssh.class.php</code> le lit correctement :</p>
<pre><code class="language-php">list($portOverride) = FOGCore::getSetting(['FOG_SSH_PORT']);
if (!$port) {
    if ($portOverride) {
        $port = $portOverride;
    } else {
        $port = $this-&gt;port;
    }
}
</code></pre>
<p dir="auto"><code>online</code> étant à <code>false</code>, <code>StorageGroup::getOptimalStorageNode()</code> écarte le nœud dès son premier <code>continue</code>, laisse <code>$winner</code> à null et lève <code>No nodes available</code>.</p>
<h2>Correctif proposé</h2>
<p dir="auto">Reprendre la logique déjà présente dans <code>fogssh.class.php</code> :</p>
<pre><code class="language-php">public function loadOnline()
{
    list($sshPort) = FOGCore::getSetting(['FOG_SSH_PORT']);
    $sshPort = $sshPort ?: 22;
    $test = self::$FOGURLRequests-&gt;isAvailable($this-&gt;get('ip'), '0.1', $sshPort, 'tcp');
    $this-&gt;set('online', array_shift($test));
}
</code></pre>
<p dir="auto">Vérifié sur</p>
]]></description><link>http://forums.fogproject.org/topic/18210/storage-node-availability-check-ignores-fog_ssh_port-hardcoded-port-22</link><generator>RSS for Node</generator><lastBuildDate>Fri, 31 Jul 2026 17:17:48 GMT</lastBuildDate><atom:link href="http://forums.fogproject.org/topic/18210.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 31 Jul 2026 13:06:53 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Storage node availability check ignores &#96;FOG_SSH_PORT&#96; (hardcoded port 22) on Fri, 31 Jul 2026 14:13:31 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="http://forums.fogproject.org/uid/49547">@Lucas26</a> Thanks for letting us know and should be fixed in the latest.</p>
<p dir="auto">Also found a similar class of bug for FTP ports and we are porting the FTP side to dev-branch as we speak.</p>
<p dir="auto">Please let us know if this is working now?</p>
]]></description><link>http://forums.fogproject.org/post/158434</link><guid isPermaLink="true">http://forums.fogproject.org/post/158434</guid><dc:creator><![CDATA[Tom Elliott]]></dc:creator><pubDate>Fri, 31 Jul 2026 14:13:31 GMT</pubDate></item></channel></rss>