Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1d09f06dc2 | ||
|
|
54fe591355 | ||
|
|
7ccb2189e7 | ||
|
|
9c1e705b13 | ||
|
|
c638f14c06 |
No files matched your search
+6
-3
@@ -61,7 +61,8 @@ apt-get install -y --no-install-recommends \
|
|||||||
acl \
|
acl \
|
||||||
ffmpeg \
|
ffmpeg \
|
||||||
rsync \
|
rsync \
|
||||||
sox
|
sox \
|
||||||
|
sshpass
|
||||||
|
|
||||||
# Vérification et installation d'Asterisk
|
# Vérification et installation d'Asterisk
|
||||||
echo -e "${C_GREEN} -> Installation du moteur Asterisk PBX...${C_RESET}"
|
echo -e "${C_GREEN} -> Installation du moteur Asterisk PBX...${C_RESET}"
|
||||||
@@ -141,6 +142,7 @@ else
|
|||||||
echo " -> Clonage du dépôt public officiel depuis https://git.sorcier-research.com..."
|
echo " -> Clonage du dépôt public officiel depuis https://git.sorcier-research.com..."
|
||||||
rm -rf "$TARGET_DIR"
|
rm -rf "$TARGET_DIR"
|
||||||
git clone https://git.sorcier-research.com/sorcier/NexusPBX.git "$TARGET_DIR"
|
git clone https://git.sorcier-research.com/sorcier/NexusPBX.git "$TARGET_DIR"
|
||||||
|
git config --system --add safe.directory "$TARGET_DIR" 2>/dev/null || true
|
||||||
cd "$TARGET_DIR"
|
cd "$TARGET_DIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -191,14 +193,15 @@ www-data ALL=(ALL) NOPASSWD: /usr/sbin/asterisk, /usr/sbin/nginx, /usr/bin/syste
|
|||||||
EOF
|
EOF
|
||||||
chmod 0440 /etc/sudoers.d/nexus-pbx
|
chmod 0440 /etc/sudoers.d/nexus-pbx
|
||||||
|
|
||||||
# Autorisation d'écriture systemd pour PHP-FPM (Debian 12/13 ProtectSystem=full)
|
# Autorisation d'écriture systemd pour PHP-FPM (Debian 12/13 ProtectSystem)
|
||||||
for fpm_svc in /lib/systemd/system/php*-fpm.service /usr/lib/systemd/system/php*-fpm.service; do
|
for fpm_svc in /lib/systemd/system/php*-fpm.service /usr/lib/systemd/system/php*-fpm.service; do
|
||||||
if [ -f "$fpm_svc" ]; then
|
if [ -f "$fpm_svc" ]; then
|
||||||
svc_name=$(basename "$fpm_svc")
|
svc_name=$(basename "$fpm_svc")
|
||||||
mkdir -p "/etc/systemd/system/${svc_name}.d"
|
mkdir -p "/etc/systemd/system/${svc_name}.d"
|
||||||
cat << 'EOF_OVERRIDE' > "/etc/systemd/system/${svc_name}.d/override.conf"
|
cat << 'EOF_OVERRIDE' > "/etc/systemd/system/${svc_name}.d/override.conf"
|
||||||
[Service]
|
[Service]
|
||||||
ReadWritePaths=/etc/asterisk /etc/fail2ban /etc/nginx /var/log /var/lib/asterisk /var/spool/asterisk
|
ProtectSystem=false
|
||||||
|
ReadWritePaths=/etc/asterisk /etc/fail2ban /etc/nginx /var/log /var/lib/asterisk /var/spool/asterisk /var/www /usr/local/bin /etc/sudoers.d
|
||||||
EOF_OVERRIDE
|
EOF_OVERRIDE
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -2242,6 +2242,25 @@ try {
|
|||||||
$remoteChangelog = [];
|
$remoteChangelog = [];
|
||||||
$remoteDate = '';
|
$remoteDate = '';
|
||||||
|
|
||||||
|
// 1. Interrogation directe via HTTP Raw (indépendant de .git et ultra-rapide)
|
||||||
|
$rawHttp = @shell_exec("curl -k -s --connect-timeout 4 \"https://git.sorcier-research.com/sorcier/NexusPBX/raw/branch/main/version.json\" 2>/dev/null");
|
||||||
|
if (empty($rawHttp)) {
|
||||||
|
$ctx = stream_context_create([
|
||||||
|
'http' => ['timeout' => 4],
|
||||||
|
'ssl' => ['verify_peer' => false, 'verify_peer_name' => false]
|
||||||
|
]);
|
||||||
|
$rawHttp = @file_get_contents("https://git.sorcier-research.com/sorcier/NexusPBX/raw/branch/main/version.json", false, $ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($rawHttp)) {
|
||||||
|
$remoteData = json_decode((string)$rawHttp, true);
|
||||||
|
if (is_array($remoteData) && !empty($remoteData['version'])) {
|
||||||
|
$remoteVer = (string)$remoteData['version'];
|
||||||
|
$remoteChangelog = $remoteData['changelog'] ?? [];
|
||||||
|
$remoteDate = $remoteData['release_date'] ?? '';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 2. Fallback local Git si indisponibilité du serveur HTTP
|
||||||
exec("git --git-dir={$appDir}/.git fetch origin main --quiet 2>/dev/null", $output, $code);
|
exec("git --git-dir={$appDir}/.git fetch origin main --quiet 2>/dev/null", $output, $code);
|
||||||
$remoteJsonRaw = shell_exec("git --git-dir={$appDir}/.git show origin/main:version.json 2>/dev/null");
|
$remoteJsonRaw = shell_exec("git --git-dir={$appDir}/.git show origin/main:version.json 2>/dev/null");
|
||||||
if ($remoteJsonRaw) {
|
if ($remoteJsonRaw) {
|
||||||
@@ -2252,6 +2271,7 @@ try {
|
|||||||
$remoteDate = $remoteData['release_date'] ?? '';
|
$remoteDate = $remoteData['release_date'] ?? '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$hasUpdate = version_compare($remoteVer, $currentVer, '>');
|
$hasUpdate = version_compare($remoteVer, $currentVer, '>');
|
||||||
$localHash = trim((string)shell_exec("git --git-dir={$appDir}/.git rev-parse HEAD 2>/dev/null"));
|
$localHash = trim((string)shell_exec("git --git-dir={$appDir}/.git rev-parse HEAD 2>/dev/null"));
|
||||||
|
|||||||
+88
-13
@@ -4945,28 +4945,93 @@ async function createBackupNow() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function confirmRestoreBackup(filename) {
|
let pendingRestoreAction = null;
|
||||||
const ok = confirm(`⚠️ ATTENTION — RESTAURATION COMPLÈTE DU SYSTÈME NEXUSPBX ⚠️\n\nVoulez-vous restaurer le système depuis l'archive :\n${filename} ?\n\nCette action va :\n1. Remplacer la base de données SQLite\n2. Restaurer tous les fichiers sons, annonces et musiques\n3. Restaurer toutes les boîtes vocales, salutations et PINs\n4. Recharger l'intégralité du PBX Asterisk\n\nConfirmez-vous la restauration immédiate ?`);
|
let pendingRestoreInput = null;
|
||||||
if (!ok) return;
|
|
||||||
|
|
||||||
showToast("Restauration du système en cours... Veuillez patienter.", "info");
|
function showRestoreModal({ title, filename, badgeText, onConfirm, inputEl = null }) {
|
||||||
|
const titleEl = document.getElementById('modal-restore-title');
|
||||||
|
if (titleEl) titleEl.textContent = title || "Restauration Complète du Système";
|
||||||
|
|
||||||
|
const nameEl = document.getElementById('restore-target-name');
|
||||||
|
if (nameEl) nameEl.textContent = filename || "Archive de sauvegarde";
|
||||||
|
|
||||||
|
const badgeEl = document.getElementById('restore-target-badge');
|
||||||
|
if (badgeEl) badgeEl.textContent = badgeText || "Archive";
|
||||||
|
|
||||||
|
const confirmBtn = document.getElementById('btn-confirm-restore');
|
||||||
|
const cancelBtn = document.getElementById('btn-cancel-restore');
|
||||||
|
if (confirmBtn) {
|
||||||
|
confirmBtn.disabled = false;
|
||||||
|
confirmBtn.innerHTML = `
|
||||||
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"/></svg>
|
||||||
|
<span>Confirmer la Restauration</span>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
if (cancelBtn) cancelBtn.disabled = false;
|
||||||
|
|
||||||
|
pendingRestoreAction = onConfirm;
|
||||||
|
pendingRestoreInput = inputEl;
|
||||||
|
|
||||||
|
openModal('modal-restore-backup');
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeRestoreModal() {
|
||||||
|
closeModal('modal-restore-backup');
|
||||||
|
if (pendingRestoreInput) {
|
||||||
|
pendingRestoreInput.value = '';
|
||||||
|
pendingRestoreInput = null;
|
||||||
|
}
|
||||||
|
pendingRestoreAction = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function executePendingRestore() {
|
||||||
|
if (!pendingRestoreAction) return;
|
||||||
|
const confirmBtn = document.getElementById('btn-confirm-restore');
|
||||||
|
const cancelBtn = document.getElementById('btn-cancel-restore');
|
||||||
|
if (confirmBtn) {
|
||||||
|
confirmBtn.disabled = true;
|
||||||
|
confirmBtn.innerHTML = `
|
||||||
|
<svg class="animate-spin w-4 h-4" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8v8H4z"></path></svg>
|
||||||
|
<span>Restauration en cours...</span>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
if (cancelBtn) cancelBtn.disabled = true;
|
||||||
|
|
||||||
|
try {
|
||||||
|
await pendingRestoreAction();
|
||||||
|
} catch (err) {
|
||||||
|
showToast("Erreur inattendue : " + err.message, "error");
|
||||||
|
closeRestoreModal();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function confirmRestoreBackup(filename) {
|
||||||
|
showRestoreModal({
|
||||||
|
title: "Restauration du Système NexusPBX",
|
||||||
|
filename: filename,
|
||||||
|
badgeText: "Archive Locale",
|
||||||
|
onConfirm: async () => {
|
||||||
|
showToast("Restauration du système en cours... Veuillez patienter.", "info");
|
||||||
try {
|
try {
|
||||||
const res = await apiCall('restore_backup', { filename });
|
const res = await apiCall('restore_backup', { filename });
|
||||||
|
closeRestoreModal();
|
||||||
showToast(res.message || "Restauration terminée avec succès !", 'success');
|
showToast(res.message || "Restauration terminée avec succès !", 'success');
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}, 2000);
|
}, 2000);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
closeRestoreModal();
|
||||||
showToast("Échec de la restauration : " + err.message, 'error');
|
showToast("Échec de la restauration : " + err.message, 'error');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function triggerBackupUpload() {
|
function triggerBackupUpload() {
|
||||||
document.getElementById('backup-upload-input')?.click();
|
document.getElementById('backup-upload-input')?.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleBackupUpload(input) {
|
function handleBackupUpload(input) {
|
||||||
const file = input?.files?.[0];
|
const file = input?.files?.[0];
|
||||||
if (!file) return;
|
if (!file) return;
|
||||||
|
|
||||||
@@ -4977,14 +5042,15 @@ async function handleBackupUpload(input) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ok = confirm(`⚠️ RESTAURATION DISASTER RECOVERY VIA FICHIER TÉLÉVERSÉ ⚠️\n\nFichier sélectionné : ${file.name} (${(file.size / (1024 * 1024)).toFixed(2)} Mo)\n\nVoulez-vous restaurer immédiatement le système NexusPBX avec cette archive ?\nToutes les données actuelles seront remplacées.`);
|
const fileSizeMb = (file.size / (1024 * 1024)).toFixed(2);
|
||||||
if (!ok) {
|
|
||||||
input.value = '';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
showRestoreModal({
|
||||||
|
title: "Disaster Recovery — Archive Téléversée",
|
||||||
|
filename: `${file.name} (${fileSizeMb} Mo)`,
|
||||||
|
badgeText: "Fichier Téléversé",
|
||||||
|
inputEl: input,
|
||||||
|
onConfirm: async () => {
|
||||||
showToast("Téléversement et restauration de l'archive en cours...", "info");
|
showToast("Téléversement et restauration de l'archive en cours...", "info");
|
||||||
|
|
||||||
const fd = new FormData();
|
const fd = new FormData();
|
||||||
fd.append('backup_file', file);
|
fd.append('backup_file', file);
|
||||||
|
|
||||||
@@ -4994,6 +5060,7 @@ async function handleBackupUpload(input) {
|
|||||||
body: fd
|
body: fd
|
||||||
});
|
});
|
||||||
const res = await response.json();
|
const res = await response.json();
|
||||||
|
closeRestoreModal();
|
||||||
if (!res.success) {
|
if (!res.success) {
|
||||||
throw new Error(res.message || "Erreur lors de la restauration");
|
throw new Error(res.message || "Erreur lors de la restauration");
|
||||||
}
|
}
|
||||||
@@ -5002,10 +5069,11 @@ async function handleBackupUpload(input) {
|
|||||||
window.location.reload();
|
window.location.reload();
|
||||||
}, 2000);
|
}, 2000);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
closeRestoreModal();
|
||||||
showToast("Échec de la restauration : " + err.message, 'error');
|
showToast("Échec de la restauration : " + err.message, 'error');
|
||||||
} finally {
|
|
||||||
input.value = '';
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function downloadBackup(filename) {
|
function downloadBackup(filename) {
|
||||||
@@ -5677,11 +5745,17 @@ async function checkSystemUpdate(notify = false) {
|
|||||||
return;
|
return;
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
localStorage.removeItem(STORAGE_KEY_TIME);
|
||||||
|
localStorage.removeItem(STORAGE_KEY_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let origBtnHtml = null;
|
||||||
if (btnCheck) {
|
if (btnCheck) {
|
||||||
btnCheck.disabled = true;
|
btnCheck.disabled = true;
|
||||||
btnCheck.classList.add('opacity-50');
|
btnCheck.classList.add('opacity-50');
|
||||||
|
origBtnHtml = btnCheck.innerHTML;
|
||||||
|
btnCheck.innerHTML = `<svg class="animate-spin w-4 h-4 text-cyan-400" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8v8H4z"></path></svg><span>Vérification en cours...</span>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -5709,6 +5783,7 @@ async function checkSystemUpdate(notify = false) {
|
|||||||
if (btnCheck) {
|
if (btnCheck) {
|
||||||
btnCheck.disabled = false;
|
btnCheck.disabled = false;
|
||||||
btnCheck.classList.remove('opacity-50');
|
btnCheck.classList.remove('opacity-50');
|
||||||
|
if (origBtnHtml) btnCheck.innerHTML = origBtnHtml;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+88
-5
@@ -176,11 +176,6 @@ $currentUser = Auth::getUsername();
|
|||||||
Se connecter au PBX
|
Se connecter au PBX
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div class="mt-6 pt-5 border-t border-anthracite-700 text-xs text-slate-300 flex items-center justify-between">
|
|
||||||
<span>Accès initial par défaut :</span>
|
|
||||||
<code class="px-2.5 py-1 rounded bg-anthracite-950 border border-anthracite-700 text-indigo-300 font-mono">admin / admin123</code>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -4628,6 +4623,94 @@ $currentUser = Auth::getUsername();
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- ===================================================================== -->
|
||||||
|
<!-- MODALE : CONFIRMATION RESTAURATION DU SYSTÈME (THEME NEXUSPBX) -->
|
||||||
|
<!-- ===================================================================== -->
|
||||||
|
<div id="modal-restore-backup" class="fixed inset-0 z-50 hidden items-center justify-center bg-black/80 backdrop-blur-sm p-3 sm:p-4 overflow-y-auto">
|
||||||
|
<div class="bg-anthracite-900 border border-amber-500/40 rounded-2xl w-full max-w-lg shadow-2xl overflow-hidden my-6 animate-fadeIn">
|
||||||
|
<!-- Entête stylisée -->
|
||||||
|
<div class="px-6 py-5 border-b border-anthracite-800 bg-gradient-to-r from-amber-950/40 via-anthracite-900 to-anthracite-900 flex items-start justify-between">
|
||||||
|
<div class="flex items-center gap-3.5">
|
||||||
|
<div class="w-11 h-11 rounded-xl bg-amber-500/15 border border-amber-500/30 text-amber-400 flex items-center justify-center shrink-0 shadow-lg shadow-amber-950/50">
|
||||||
|
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<h3 id="modal-restore-title" class="text-base font-bold text-white">Restauration Complète du Système</h3>
|
||||||
|
<span id="restore-target-badge" class="px-2 py-0.5 rounded text-[10px] font-bold tracking-wide uppercase bg-amber-500/20 text-amber-300 border border-amber-500/30">Archive</span>
|
||||||
|
</div>
|
||||||
|
<p class="text-xs text-slate-400 mt-0.5">Disaster Recovery & Remise en état Asterisk</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button type="button" onclick="closeRestoreModal()" class="text-slate-400 hover:text-white p-1.5 rounded-lg hover:bg-anthracite-800 transition">
|
||||||
|
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Corps de la modale -->
|
||||||
|
<div class="p-6 space-y-4">
|
||||||
|
<!-- Fichier cible -->
|
||||||
|
<div class="p-3.5 rounded-xl bg-anthracite-950/90 border border-anthracite-800 space-y-1.5">
|
||||||
|
<div class="text-[11px] font-semibold text-slate-400 flex items-center gap-1.5 uppercase tracking-wider">
|
||||||
|
<svg class="w-3.5 h-3.5 text-amber-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8m-9 4h4"/></svg>
|
||||||
|
Archive sélectionnée pour la restauration
|
||||||
|
</div>
|
||||||
|
<div id="restore-target-name" class="font-mono text-xs font-semibold text-amber-300 break-all bg-black/40 px-3 py-2 rounded-lg border border-anthracite-800/80">
|
||||||
|
nom_de_l_archive.tar.gz
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Ce que fait la restauration -->
|
||||||
|
<div class="space-y-2">
|
||||||
|
<div class="text-xs font-semibold text-slate-300">Cette action va restaurer et écraser :</div>
|
||||||
|
<ul class="text-xs text-slate-400 space-y-1.5 pl-1">
|
||||||
|
<li class="flex items-center gap-2">
|
||||||
|
<span class="w-1.5 h-1.5 rounded-full bg-cyan-400 shrink-0"></span>
|
||||||
|
<span><strong>Base SQLite</strong> : postes SIP, trunks, routes, SVI, téléavertissement, annuaires.</span>
|
||||||
|
</li>
|
||||||
|
<li class="flex items-center gap-2">
|
||||||
|
<span class="w-1.5 h-1.5 rounded-full bg-indigo-400 shrink-0"></span>
|
||||||
|
<span><strong>Médiathèque</strong> : jingles, musiques d'attente (MoH), annonces personnalisées.</span>
|
||||||
|
</li>
|
||||||
|
<li class="flex items-center gap-2">
|
||||||
|
<span class="w-1.5 h-1.5 rounded-full bg-amber-400 shrink-0"></span>
|
||||||
|
<span><strong>Messageries vocales</strong> : boîtes vocales, salutations enregistrées, PINs.</span>
|
||||||
|
</li>
|
||||||
|
<li class="flex items-center gap-2">
|
||||||
|
<span class="w-1.5 h-1.5 rounded-full bg-emerald-400 shrink-0"></span>
|
||||||
|
<span><strong>Moteur Asterisk</strong> : régénération du dialplan et rechargement PJSIP à chaud.</span>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Avertissement -->
|
||||||
|
<div class="p-3 rounded-xl bg-amber-950/30 border border-amber-500/30 flex items-start gap-3">
|
||||||
|
<svg class="w-5 h-5 text-amber-400 shrink-0 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||||
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/>
|
||||||
|
</svg>
|
||||||
|
<div class="text-xs text-amber-200/90 leading-relaxed">
|
||||||
|
<strong>Attention :</strong> Toutes les données et configurations modifiées après la date de cette sauvegarde seront définitivement remplacées.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Boutons d'action -->
|
||||||
|
<div class="pt-3 border-t border-anthracite-800 flex items-center justify-end gap-2.5">
|
||||||
|
<button type="button" id="btn-cancel-restore" onclick="closeRestoreModal()"
|
||||||
|
class="px-4 py-2.5 rounded-xl text-xs font-semibold bg-anthracite-800 hover:bg-anthracite-750 text-slate-300 border border-anthracite-700 transition">
|
||||||
|
Annuler
|
||||||
|
</button>
|
||||||
|
<button type="button" id="btn-confirm-restore" onclick="executePendingRestore()"
|
||||||
|
class="px-5 py-2.5 rounded-xl text-xs font-bold bg-gradient-to-r from-amber-600 via-red-600 to-red-700 hover:from-amber-500 hover:to-red-600 text-white shadow-lg shadow-red-900/40 transition flex items-center gap-2">
|
||||||
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"/></svg>
|
||||||
|
<span>Confirmer la Restauration</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- ===================================================================== -->
|
<!-- ===================================================================== -->
|
||||||
<!-- MODAL : URL XML YEALINK REMOTE PHONEBOOK (cm_to_yl_ab.php) -->
|
<!-- MODAL : URL XML YEALINK REMOTE PHONEBOOK (cm_to_yl_ab.php) -->
|
||||||
<!-- ===================================================================== -->
|
<!-- ===================================================================== -->
|
||||||
|
|||||||
+4
-3
@@ -16,8 +16,8 @@ cd /var/www/nexus-pbx
|
|||||||
git fetch origin main
|
git fetch origin main
|
||||||
git reset --hard origin/main
|
git reset --hard origin/main
|
||||||
|
|
||||||
echo "-> Installation des dépendances système indispensables (ACL, ffmpeg, rsync, sox)..."
|
echo "-> Installation des dépendances système indispensables (ACL, ffmpeg, rsync, sox, sshpass)..."
|
||||||
which ffmpeg >/dev/null 2>&1 && which rsync >/dev/null 2>&1 && which setfacl >/dev/null 2>&1 || (apt-get update -y && apt-get install -y --no-install-recommends acl ffmpeg rsync sox)
|
which ffmpeg >/dev/null 2>&1 && which rsync >/dev/null 2>&1 && which setfacl >/dev/null 2>&1 && which sshpass >/dev/null 2>&1 || (apt-get update -y && apt-get install -y --no-install-recommends acl ffmpeg rsync sox sshpass)
|
||||||
|
|
||||||
echo "-> Création des dossiers et des fichiers de journalisation..."
|
echo "-> Création des dossiers et des fichiers de journalisation..."
|
||||||
mkdir -p /etc/fail2ban/filter.d /etc/asterisk /var/log/asterisk /var/log/nexus-pbx /var/www/nexus-pbx/storage/backups
|
mkdir -p /etc/fail2ban/filter.d /etc/asterisk /var/log/asterisk /var/log/nexus-pbx /var/www/nexus-pbx/storage/backups
|
||||||
@@ -96,7 +96,8 @@ for fpm_svc in /lib/systemd/system/php*-fpm.service /usr/lib/systemd/system/php*
|
|||||||
mkdir -p "/etc/systemd/system/${svc_name}.d"
|
mkdir -p "/etc/systemd/system/${svc_name}.d"
|
||||||
cat << 'EOF_OVERRIDE' > "/etc/systemd/system/${svc_name}.d/override.conf"
|
cat << 'EOF_OVERRIDE' > "/etc/systemd/system/${svc_name}.d/override.conf"
|
||||||
[Service]
|
[Service]
|
||||||
ReadWritePaths=/etc/asterisk /etc/fail2ban /etc/nginx /var/log /var/lib/asterisk /var/spool/asterisk
|
ProtectSystem=false
|
||||||
|
ReadWritePaths=/etc/asterisk /etc/fail2ban /etc/nginx /var/log /var/lib/asterisk /var/spool/asterisk /var/www /usr/local/bin /etc/sudoers.d
|
||||||
EOF_OVERRIDE
|
EOF_OVERRIDE
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|||||||
+14
-9
@@ -37,6 +37,7 @@ for arg in "$@"; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
cd "$APP_DIR" || exit 1
|
cd "$APP_DIR" || exit 1
|
||||||
|
git config --system --add safe.directory "$APP_DIR" 2>/dev/null || true
|
||||||
git config --global --add safe.directory "$APP_DIR" 2>/dev/null || true
|
git config --global --add safe.directory "$APP_DIR" 2>/dev/null || true
|
||||||
|
|
||||||
# Lecture de la version locale
|
# Lecture de la version locale
|
||||||
@@ -93,24 +94,28 @@ echo -e "${C_GREEN} ✓ Sauvegarde de sécurité créée : $(basename "$BACKUP_
|
|||||||
# 2. Application des derniers fichiers de code Git
|
# 2. Application des derniers fichiers de code Git
|
||||||
echo -e "${C_GRAY}[2/6] Déploiement des nouveaux fichiers de code...${C_RESET}"
|
echo -e "${C_GRAY}[2/6] Déploiement des nouveaux fichiers de code...${C_RESET}"
|
||||||
git reset --hard "${GIT_REMOTE}/${GIT_BRANCH}"
|
git reset --hard "${GIT_REMOTE}/${GIT_BRANCH}"
|
||||||
chown -R www-data:asterisk "$APP_DIR"
|
chown -R www-data:asterisk "$APP_DIR" 2>/dev/null || true
|
||||||
chmod 2775 "$APP_DIR/storage" "$APP_DIR/storage/backups" "$APP_DIR/storage/sounds" 2>/dev/null || true
|
chmod 2775 "$APP_DIR/storage" "$APP_DIR/storage/backups" "$APP_DIR/storage/sounds" 2>/dev/null || true
|
||||||
chmod +x "$APP_DIR/scripts/update.sh" "$APP_DIR/scripts/nexus-firewall" "$APP_DIR/scripts/nexus-banner.sh" 2>/dev/null || true
|
chmod +x "$APP_DIR/scripts/update.sh" "$APP_DIR/scripts/nexus-firewall" "$APP_DIR/scripts/nexus-banner.sh" 2>/dev/null || true
|
||||||
ln -sf "$APP_DIR/scripts/update.sh" /usr/local/bin/nexus-update
|
|
||||||
ln -sf "$APP_DIR/scripts/nexus-firewall" /usr/local/bin/nexus-firewall
|
|
||||||
ln -sf "$APP_DIR/scripts/nexus-banner.sh" /usr/local/bin/nexus-banner
|
|
||||||
|
|
||||||
# Mise à jour des privilèges sudoers (www-data)
|
# Liens symboliques CLI (non-bloquants si exécuté sous sandbox PHP ProtectSystem)
|
||||||
cat << 'EOF_SUDO' > /etc/sudoers.d/nexus-pbx
|
ln -sf "$APP_DIR/scripts/update.sh" /usr/local/bin/nexus-update 2>/dev/null || true
|
||||||
|
ln -sf "$APP_DIR/scripts/nexus-firewall" /usr/local/bin/nexus-firewall 2>/dev/null || true
|
||||||
|
ln -sf "$APP_DIR/scripts/nexus-banner.sh" /usr/local/bin/nexus-banner 2>/dev/null || true
|
||||||
|
|
||||||
|
# Mise à jour des privilèges sudoers (www-data) si accessible en écriture
|
||||||
|
if [ -w /etc/sudoers.d ]; then
|
||||||
|
cat << 'EOF_SUDO' > /etc/sudoers.d/nexus-pbx 2>/dev/null || true
|
||||||
www-data ALL=(ALL) NOPASSWD: /usr/sbin/asterisk, /usr/sbin/nginx, /usr/bin/systemctl, /usr/bin/fail2ban-client, /bin/fail2ban-client, /var/www/nexus-pbx/scripts/nexus-firewall, /usr/bin/certbot, /usr/sbin/nft, /usr/sbin/iptables, /var/www/nexus-pbx/scripts/update.sh, /usr/local/bin/nexus-update
|
www-data ALL=(ALL) NOPASSWD: /usr/sbin/asterisk, /usr/sbin/nginx, /usr/bin/systemctl, /usr/bin/fail2ban-client, /bin/fail2ban-client, /var/www/nexus-pbx/scripts/nexus-firewall, /usr/bin/certbot, /usr/sbin/nft, /usr/sbin/iptables, /var/www/nexus-pbx/scripts/update.sh, /usr/local/bin/nexus-update
|
||||||
EOF_SUDO
|
EOF_SUDO
|
||||||
chmod 0440 /etc/sudoers.d/nexus-pbx
|
chmod 0440 /etc/sudoers.d/nexus-pbx 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
|
||||||
# 3. Vérification des dépendances Debian
|
# 3. Vérification des dépendances Debian
|
||||||
echo -e "${C_GRAY}[3/6] Vérification des composants et outils système...${C_RESET}"
|
echo -e "${C_GRAY}[3/6] Vérification des composants et outils système...${C_RESET}"
|
||||||
which ffmpeg >/dev/null 2>&1 && which rsync >/dev/null 2>&1 && which sox >/dev/null 2>&1 || {
|
which ffmpeg >/dev/null 2>&1 && which rsync >/dev/null 2>&1 && which sox >/dev/null 2>&1 && which sshpass >/dev/null 2>&1 || {
|
||||||
echo -e " -> Installation de paquets complémentaires..."
|
echo -e " -> Installation de paquets complémentaires..."
|
||||||
apt-get update -y -qq && apt-get install -y -qq --no-install-recommends acl ffmpeg rsync sox
|
(apt-get update -y -qq && apt-get install -y -qq --no-install-recommends acl ffmpeg rsync sox sshpass) 2>/dev/null || true
|
||||||
}
|
}
|
||||||
|
|
||||||
# 4. Exécution des migrations SQLite et régénération Dialplan
|
# 4. Exécution des migrations SQLite et régénération Dialplan
|
||||||
|
|||||||
@@ -659,12 +659,24 @@ class BackupManager
|
|||||||
// MÉTHODES PRIVÉES / UTILITAIRES
|
// MÉTHODES PRIVÉES / UTILITAIRES
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
|
|
||||||
|
private static function isSshpassInstalled(): bool
|
||||||
|
{
|
||||||
|
return file_exists('/usr/bin/sshpass') || !empty(trim((string)shell_exec('which sshpass 2>/dev/null')));
|
||||||
|
}
|
||||||
|
|
||||||
private static function runSshCommand(string $host, int $port, string $user, string $authType, string $password, string $cmd): array
|
private static function runSshCommand(string $host, int $port, string $user, string $authType, string $password, string $cmd): array
|
||||||
{
|
{
|
||||||
$sshOptions = "-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=8 -p " . (int)$port;
|
$sshOptions = "-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=8 -p " . (int)$port;
|
||||||
$target = escapeshellarg("{$user}@{$host}");
|
$target = escapeshellarg("{$user}@{$host}");
|
||||||
|
|
||||||
if ($authType === 'password') {
|
if ($authType === 'password') {
|
||||||
|
if (!self::isSshpassInstalled()) {
|
||||||
|
return [
|
||||||
|
'exit_code' => 1,
|
||||||
|
'output' => '',
|
||||||
|
'error' => "Le paquet 'sshpass' n'est pas installé sur le système pour l'authentification SSH par mot de passe. Installez-le avec : apt install -y sshpass",
|
||||||
|
];
|
||||||
|
}
|
||||||
$fullCmd = "sshpass -p " . escapeshellarg($password) . " ssh {$sshOptions} {$target} " . escapeshellarg($cmd);
|
$fullCmd = "sshpass -p " . escapeshellarg($password) . " ssh {$sshOptions} {$target} " . escapeshellarg($cmd);
|
||||||
} else {
|
} else {
|
||||||
$fullCmd = "ssh {$sshOptions} {$target} " . escapeshellarg($cmd);
|
$fullCmd = "ssh {$sshOptions} {$target} " . escapeshellarg($cmd);
|
||||||
@@ -713,6 +725,12 @@ class BackupManager
|
|||||||
$src = escapeshellarg($localFile);
|
$src = escapeshellarg($localFile);
|
||||||
|
|
||||||
if ($authType === 'password') {
|
if ($authType === 'password') {
|
||||||
|
if (!self::isSshpassInstalled()) {
|
||||||
|
return [
|
||||||
|
'success' => false,
|
||||||
|
'message' => "Le paquet 'sshpass' n'est pas installé sur le système pour l'authentification SSH par mot de passe. Installez-le avec : apt install -y sshpass",
|
||||||
|
];
|
||||||
|
}
|
||||||
$scpCmd = "sshpass -p " . escapeshellarg($password) . " scp {$scpOptions} {$src} {$dest}";
|
$scpCmd = "sshpass -p " . escapeshellarg($password) . " scp {$scpOptions} {$src} {$dest}";
|
||||||
} else {
|
} else {
|
||||||
$scpCmd = "scp {$scpOptions} {$src} {$dest}";
|
$scpCmd = "scp {$scpOptions} {$src} {$dest}";
|
||||||
@@ -742,6 +760,12 @@ class BackupManager
|
|||||||
$dest = escapeshellarg($localDest);
|
$dest = escapeshellarg($localDest);
|
||||||
|
|
||||||
if ($authType === 'password') {
|
if ($authType === 'password') {
|
||||||
|
if (!self::isSshpassInstalled()) {
|
||||||
|
return [
|
||||||
|
'success' => false,
|
||||||
|
'message' => "Le paquet 'sshpass' n'est pas installé sur le système pour l'authentification SSH par mot de passe. Installez-le avec : apt install -y sshpass",
|
||||||
|
];
|
||||||
|
}
|
||||||
$scpCmd = "sshpass -p " . escapeshellarg($password) . " scp {$scpOptions} {$src} {$dest}";
|
$scpCmd = "sshpass -p " . escapeshellarg($password) . " scp {$scpOptions} {$src} {$dest}";
|
||||||
} else {
|
} else {
|
||||||
$scpCmd = "scp {$scpOptions} {$src} {$dest}";
|
$scpCmd = "scp {$scpOptions} {$src} {$dest}";
|
||||||
|
|||||||
+5
-5
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"version": "1.3.3",
|
"version": "1.3.8",
|
||||||
"codename": "Helios",
|
"codename": "Helios",
|
||||||
"release_date": "2026-11-04",
|
"release_date": "2026-11-04",
|
||||||
"min_php_version": "8.2",
|
"min_php_version": "8.2",
|
||||||
"changelog": [
|
"changelog": [
|
||||||
"Autorisation sudoers www-data automatique pour les mises à jour 1-clic depuis l'interface Web",
|
"Suppression de l'indication des identifiants et mot de passe par défaut sur l'écran de connexion",
|
||||||
"Création systématique du lien symbolique CLI nexus-update à l'installation et à la mise à jour",
|
"Vérification ultra-rapide des mises à jour en direct via cURL CLI et flux HTTP sans dépendre de git ou de php-curl",
|
||||||
"Suppression complète des données de démonstration au déploiement (base 100% propre)",
|
"Bouton 'Vérifier les mises à jour' forçant le rafraîchissement immédiat du cache navigateur (bypass 24h)",
|
||||||
"Résolution du bug de réapparition intempestive des postes, groupes, IVR, paging et routes supprimés"
|
"Nouvelle modale de confirmation de restauration système alignée sur le thème sombre NexusPBX"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user