mirror of
https://github.com/tale/headplane.git
synced 2026-08-12 22:56:53 +00:00
fix: use /proc/pid/comm to check commands
This commit is contained in:
@@ -152,12 +152,14 @@ export default class KubernetesIntegration extends Integration<T> {
|
||||
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;
|
||||
|
||||
@@ -34,12 +34,14 @@ export default class ProcIntegration extends Integration<T> {
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user