diff --git a/app/server/config/integration/kubernetes.ts b/app/server/config/integration/kubernetes.ts index ca4a57b..4d5bcbe 100644 --- a/app/server/config/integration/kubernetes.ts +++ b/app/server/config/integration/kubernetes.ts @@ -152,12 +152,14 @@ export default class KubernetesIntegration extends Integration { return; } - const path = join('/proc', dir, 'cmdline'); + const path = join('/proc', dir, 'comm'); try { log.debug('config', 'Reading %s', path); const data = await readFile(path, 'utf8'); - if (!data.includes('headscale') && !data.includes('serve')) { - throw new Error('Found PID without Headscale serve command'); + if (data.trim() !== 'headscale') { + throw new Error( + `Found PID with unexpected command: ${data.trim()}`, + ); } return pid; diff --git a/app/server/config/integration/proc.ts b/app/server/config/integration/proc.ts index a65cd08..44c1b87 100644 --- a/app/server/config/integration/proc.ts +++ b/app/server/config/integration/proc.ts @@ -34,12 +34,14 @@ export default class ProcIntegration extends Integration { return; } - const path = join('/proc', dir, 'cmdline'); + const path = join('/proc', dir, 'comm'); try { log.debug('config', 'Reading %s', path); const data = await readFile(path, 'utf8'); - if (!data.includes('headscale') && !data.includes('serve')) { - throw new Error('Found PID without Headscale serve command'); + if (data.trim() !== 'headscale') { + throw new Error( + `Found PID with unexpected command: ${data.trim()}`, + ); } return pid;