fix: use /proc/pid/comm to check commands
This commit is contained in:
parent
59525b7b63
commit
2f316176c8
2 changed files with 10 additions and 6 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue