&1', escapeshellarg($keyPath) ); exec($command, $output, $returnCode); if ($returnCode !== 0) { Log::error('Failed to generate SSH key', ['output' => implode("\n", $output)]); return false; } // Set proper permissions chmod($keyPath, 0600); chmod($keyPath.'.pub', 0644); Log::info('Jabali system SSH key generated'); return true; } catch (Exception $e) { Log::error('Failed to generate SSH key: '.$e->getMessage()); return false; } } /** * Get the fingerprint of the public key */ public static function getFingerprint(): ?string { $pubKeyPath = self::getPublicKeyPath(); if (! file_exists($pubKeyPath)) { return null; } exec('ssh-keygen -lf '.escapeshellarg($pubKeyPath).' 2>&1', $output, $returnCode); if ($returnCode !== 0) { return null; } return $output[0] ?? null; } }