Fix: permissions and ACLs for www-data on /etc/asterisk, fail2ban filters and logs, and AMI diagnostics loading

This commit is contained in:
sorcier committed 2026-11-02 04:12:29 +01:00
1 parent 563a01e3c3
commit cbc9fe7f29
4 files changed
+95 -22

No files matched your search

+18 -1
View File
@@ -1729,16 +1729,33 @@ class ConfigGenerator
$tmpPath = $targetPath . '.tmp.' . getmypid();
if (@file_put_contents($tmpPath, $content, LOCK_EX) === false) {
// Repli en écriture directe si le fichier existe déjà et est accessible
if (file_exists($targetPath) && is_writable($targetPath)) {
if (@file_put_contents($targetPath, $content, LOCK_EX) !== false) {
@chgrp($targetPath, 'asterisk');
@chmod($targetPath, 0664);
return;
}
}
throw new RuntimeException("Impossible d'écrire dans {$targetPath}. Vérifiez que www-data fait partie du groupe asterisk et que /etc/asterisk est accessible en écriture de groupe (chmod 2775).");
}
@chgrp($tmpPath, 'asterisk');
@chmod($tmpPath, 0660);
@chmod($tmpPath, 0664);
if (!@rename($tmpPath, $targetPath)) {
@unlink($tmpPath);
// Repli en écriture directe si le renommage échoue
if (@file_put_contents($targetPath, $content, LOCK_EX) !== false) {
@chgrp($targetPath, 'asterisk');
@chmod($targetPath, 0664);
return;
}
throw new RuntimeException("Échec du remplacement atomique de {$targetPath}.");
}
@chgrp($targetPath, 'asterisk');
@chmod($targetPath, 0664);
}
public static function normalizeInboundRoutes(string $json): array