mirror of
https://github.com/tale/headplane.git
synced 2026-08-27 07:27:41 +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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const path = join('/proc', dir, 'cmdline');
|
const path = join('/proc', dir, 'comm');
|
||||||
try {
|
try {
|
||||||
log.debug('config', 'Reading %s', path);
|
log.debug('config', 'Reading %s', path);
|
||||||
const data = await readFile(path, 'utf8');
|
const data = await readFile(path, 'utf8');
|
||||||
if (!data.includes('headscale') && !data.includes('serve')) {
|
if (data.trim() !== 'headscale') {
|
||||||
throw new Error('Found PID without Headscale serve command');
|
throw new Error(
|
||||||
|
`Found PID with unexpected command: ${data.trim()}`,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return pid;
|
return pid;
|
||||||
|
|||||||
@@ -34,12 +34,14 @@ export default class ProcIntegration extends Integration<T> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const path = join('/proc', dir, 'cmdline');
|
const path = join('/proc', dir, 'comm');
|
||||||
try {
|
try {
|
||||||
log.debug('config', 'Reading %s', path);
|
log.debug('config', 'Reading %s', path);
|
||||||
const data = await readFile(path, 'utf8');
|
const data = await readFile(path, 'utf8');
|
||||||
if (!data.includes('headscale') && !data.includes('serve')) {
|
if (data.trim() !== 'headscale') {
|
||||||
throw new Error('Found PID without Headscale serve command');
|
throw new Error(
|
||||||
|
`Found PID with unexpected command: ${data.trim()}`,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return pid;
|
return pid;
|
||||||
|
|||||||
Reference in New Issue
Block a user