Harden systemd services, restrict file permissions further, add username blocklist and prevent more vulnerabilities

This commit is contained in:
thiloho
2024-12-08 14:33:33 +01:00
parent 46b8cb033c
commit 18210d501b
8 changed files with 73 additions and 14 deletions

View File

@@ -269,14 +269,15 @@ const generateStaticFiles = async (
};
const setPermissions = async (dir: string) => {
await chmod(dir, 0o777);
const mode = dev ? 0o777 : process.env.ORIGIN ? 0o770 : 0o777;
await chmod(dir, mode);
const entries = await readdir(dir, { withFileTypes: true });
for (const entry of entries) {
const fullPath = join(dir, entry.name);
if (entry.isDirectory()) {
await setPermissions(fullPath);
} else {
await chmod(fullPath, 0o777);
await chmod(fullPath, mode);
}
}
};