this function doesnt work well on windows:
private async validateKeyPermissions(keyPath: string): Promise<void> {
try {
const stats = await fs.promises.stat(keyPath);
const mode = stats.mode & 0o777;
if (mode & 0o077) {
throw new Error(
`SSH key file has insecure permissions (${mode.toString(8)}). ` +
`Required: 600 or 400. Fix with: chmod 600 ${keyPath}`
);
}
} catch (err: unknown) {
if (err instanceof Error && 'code' in err && err.code === 'ENOENT') {
throw new Error(`SSH key file not found: ${keyPath}`);
}
throw err;
}
}
easy workaround to add in ssh-tunnel.ts to allow permissions in windows:
if (process.platform !== 'win32' && (mode & 0o077)) {
...
}
this function doesnt work well on windows:
easy workaround to add in
ssh-tunnel.tsto allow permissions in windows: