An open source, self-hosted, real-time port monitoring and discovery tool.
Fix/system ports regression (#77)
Mostafa Wahied3e382fa5d375
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 80fb4c7..fdddebd 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -8,6 +8,10 @@ All notable changes to portracker will be documented in this file.- **Reverse Proxy Support**: New `HOST_OVERRIDE` environment variable allows specifying the hostname used in port links when running behind a reverse proxy (fixes #51)+### Fixed++- **System Port Detection**: Restored system port detection (SSH, SMB, etc.) when running in containerized environments.+### UI- **Favicon**: Dark mode support - favicon now adapts to system theme (black on light, white on dark)diff --git a/backend/collectors/truenas_collector.js b/backend/collectors/truenas_collector.jsindex 068b764..68c7e99 100644--- a/backend/collectors/truenas_collector.js+++ b/backend/collectors/truenas_collector.js@@ -641,9 +641,10 @@ class TrueNASCollector extends BaseCollector {const isContainerized = this._detectContainerizedEnvironment();this.logInfo(`Container environment detected: ${isContainerized}`);- if (this.procParser && !isContainerized) {+ if (this.procParser) {try {this.logInfo('Attempting primary method: Enhanced /proc filesystem parsing');+ this.logInfo('Note: With pid:host, proc-parser uses /proc/1/net/tcp to access host network namespace');const procWorks = await this.procParser.testProcAccess();if (procWorks) {@@ -673,8 +674,6 @@ class TrueNASCollector extends BaseCollector {} catch (procErr) {this.logWarn('Failed to get ports via enhanced /proc parsing:', procErr.message);}- } else if (isContainerized) {- this.logInfo('Containerized environment detected, skipping /proc method and using network commands');}try {@@ -682,8 +681,9 @@ class TrueNASCollector extends BaseCollector {let ssOutput = '';let ssMethod = 'container';- if (!isContainerized) {+ if (isContainerized) {try {+ this.logInfo('Containerized: trying nsenter to access host network namespace');const { stdout: nsenterOutput } = await execAsync('nsenter -t 1 -n ss -tulpn 2>/dev/null');if (nsenterOutput && nsenterOutput.trim().length > 100) {ssOutput = nsenterOutput;@@ -691,14 +691,18 @@ class TrueNASCollector extends BaseCollector {this.logInfo('Successfully accessed host network namespace via nsenter');}} catch (nsenterErr) {- this.logInfo(`nsenter method failed: ${nsenterErr.message}, falling back to container ss`);+ this.logWarn(`nsenter method failed: ${nsenterErr.message}, falling back to container ss`);+ const msg = String(nsenterErr?.message || '').toLowerCase();+ if (msg.includes('permission denied') || msg.includes('operation not permitted')) {+ this.logWarn('Hint: nsenter requires pid: "host" and cap_add: [SYS_ADMIN] in docker-compose.yml');+ }}}if (!ssOutput) {const { stdout } = await execAsync('ss -tulpn 2>/dev/null');ssOutput = stdout;- ssMethod = 'container';+ ssMethod = isContainerized ? 'container-fallback' : 'local';}const ports = this._parseSSOutput(ssOutput, ssMethod);