Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 3172 → Rev 3173

/web/acc/manager/htdocs/security.php
9,7 → 9,6
if ($language === 'fr') {
$l_title = 'Sécurité';
$l_spoofing = "Adresse(s) MAC usurpée(s) (Watchdog)";
$l_virus = "Virus bloqué(s) (CLAMAV)";
$l_fail2ban = "Adresse(s) IP bloquée(s) (Fail2Ban)";
$l_ban_date = "Date de bloquage";
$l_unban_date = "Date de débloquage";
20,7 → 19,6
} else if ($language === 'es') {
$l_title = 'Seguridad';
$l_spoofing = "Direcciones MAC usurpadas (Watchdog)";
$l_virus = "Virus bloqueado (CLAMAV)";
$l_fail2ban = "Dirección(es) IP bloqueada(s) (Fail2Ban)";
$l_ban_date = "Fecha de bloqueo";
$l_unban_date = "Fecha de desembolso";
31,7 → 29,6
} else {
$l_title = 'Security';
$l_spoofing = "MAC address spoofed (Watchdog)";
$l_virus = "Virus blocked (CLAMAV)";
$l_fail2ban = "IP address blocked (Fail2Ban)";
$l_ban_date = "Lock date";
$l_unban_date = "Unlock date";
58,8 → 55,7
<div class="panel-row">
<div class="btn-group btn-group-justified" role="group" aria-label="Justified button group">
<a href="security.php?tab=1" class="btn btn-default<?= (($tab === 1) ? ' active' : '') ?>" role="button"><?= $l_spoofing ?></a>
<a href="security.php?tab=2" class="btn btn-default<?= (($tab === 2) ? ' active' : '') ?>" role="button"><?= $l_virus ?></a>
<a href="security.php?tab=3" class="btn btn-default<?= (($tab === 3) ? ' active' : '') ?>" role="button"><?= $l_fail2ban ?></a>
<a href="security.php?tab=2" class="btn btn-default<?= (($tab === 3) ? ' active' : '') ?>" role="button"><?= $l_fail2ban ?></a>
</div>
<?php
if ($tab === 1) {
116,30 → 112,6
</div>
<?php
} else if ($tab === 2) {
$filePath = '/var/log/clamav/clamd.log';
$pattern = "/\bfound\b/i";
$lines = preg_grep ($pattern, file($filePath));
if ($lines === false) {
exit("Cannot open '$filePath'.");
}
$lines = array_reverse($lines);
?>
<h3><?= $l_virus ?></h3>
<div class="container">
<table class="table table-striped table-hover">
<tbody>
<?php if (!empty($lines)): ?>
<?php foreach ($lines as $line): ?>
<tr><td><?= $line ?></td></tr>
<?php endforeach; ?>
<?php else: ?>
<tr><td style="text-align: center;"><?= $l_empty ?></td></tr>
<?php endif; ?>
</tbody>
</table>
</div>
<?php
} else if ($tab === 3) {
$bans = [];
$regex = '/^(?P<date>[0-9]{4}-[0-9]{2}-[0-9]{2}[ \t]+[0-9]{2}:[0-9]{2}:[0-9]{2}),[0-9]{3}[ \t]+fail2ban\.actions[ \t]+\[[0-9]+\]:[ \t]+NOTICE[ \t]+\[(?P<rule>[a-zA-Z0-9_-]+)\][ \t]+(?P<type>Ban|Unban)[ \t]+(?P<ip>[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})/';
$file = fopen('/var/log/fail2ban.log', 'r');