Subversion Repositories ALCASAR

Rev

Rev 2527 | Rev 2811 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2527 Rev 2810
Line 1... Line 1...
1
<?php
1
<?php
2
# $Id: security.php 2527 2018-04-16 08:49:00Z fabien.rako $
2
# $Id: security.php 2810 2020-04-14 11:30:11Z rexy $
3
 
-
 
4
//gestion de la langue
-
 
5
require('../lib/langues.php');
-
 
6
 
3
 
7
$language = 'en';
4
$language = 'en';
8
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
5
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
9
	$langue = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
6
	$langue = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
10
	$language = strtolower(substr(chop($langue[0]), 0, 2));
7
	$language = strtolower(substr(chop($langue[0]), 0, 2));
11
}
8
}
12
if ($language === 'fr') {
9
if ($language === 'fr') {
13
	$l_title = 'Sécurité';
10
	$l_title = 'Sécurité';
-
 
11
    $l_spoofing = "Adresse(s) MAC usurpée(s) (Watchdog)";
-
 
12
    $l_virus = "Virus bloqué(s) (HAVP)";
-
 
13
    $l_fail2ban = "Adresse(s) IP bloquée(s) (Fail2Ban)";
-
 
14
    $l_ipAddress="Adresse IP";
-
 
15
    $l_user = "L'utilisateur";
-
 
16
    $l_empty="Vide";
-
 
17
    $l_rule="Règle";
14
} else {
18
} else {
15
	$l_title = 'Security';
19
	$l_title = 'Security';
-
 
20
	$l_spoofing = "MAC address spoofed (Watchdog)";
-
 
21
    $l_virus = "Virus blocked (HAVP)";
-
 
22
    $l_fail2ban = "IP address blocked (Fail2Ban)";
-
 
23
    $l_ipAddress="IP address";
-
 
24
    $l_user = "User";
-
 
25
    $l_empty="Empty";
-
 
26
    $l_rule="Rule";
16
}
27
}
17
 
-
 
18
$tab = (isset($_GET['tab'])) ? intval($_GET['tab']) : 1;
28
$tab = (isset($_GET['tab'])) ? intval($_GET['tab']) : 1;
19
 
-
 
20
?>
29
?>
21
 
-
 
22
 
-
 
-
 
30
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
23
<html>
31
<html>
24
<head>
32
<head>
25
	<meta charset="UTF-8">
33
	<meta charset="UTF-8">
26
	<title><?= $l_title ?></title>
34
	<title><?= $l_title ?></title>
27
	<link rel="stylesheet" href="/css/bootstrap.min.css">
35
	<link rel="stylesheet" href="/css/bootstrap.min.css">
Line 32... Line 40...
32
		body {
40
		body {
33
			background-color: #EFEFEF;
41
			background-color: #EFEFEF;
34
		}
42
		}
35
	</style>
43
	</style>
36
</head>
44
</head>
37
 
-
 
38
<body>
45
<body>
39
<table  class="tableTop" border=0 cellspacing=0 cellpadding=0 >
46
<table  class="tableTop" border=0 cellspacing=0 cellpadding=0 >
40
	<tbody >	
47
	<tbody >	
41
		<tr>
48
		<tr>
42
			<th class="thBasicACC">
49
			<th class="thBasicACC">
Line 48... Line 55...
48
				<img src="/images/pix.gif" width=1 height=2>
55
				<img src="/images/pix.gif" width=1 height=2>
49
			</td>
56
			</td>
50
		</tr>
57
		</tr>
51
	</tbody>
58
	</tbody>
52
</table>
59
</table>
53
 
-
 
54
<div class="frameBorderACC">
60
<div class="frameBorderACC">
55
 
-
 
56
<div class="btn-group btn-group-justified" role="group" aria-label="Justified button group"> 
61
<div class="btn-group btn-group-justified" role="group" aria-label="Justified button group"> 
57
	<a href="security.php?tab=1" class="btn btn-default<?= (($tab === 1) ? ' active' : '') ?>" role="button"><?= $l_spoofing ?></a> 
62
	<a href="security.php?tab=1" class="btn btn-default<?= (($tab === 1) ? ' active' : '') ?>" role="button"><?= $l_spoofing ?></a>
58
	<a href="security.php?tab=2" class="btn btn-default<?= (($tab === 2) ? ' active' : '') ?>" role="button"><?= $l_virus ?></a>
63
	<a href="security.php?tab=2" class="btn btn-default<?= (($tab === 2) ? ' active' : '') ?>" role="button"><?= $l_virus ?></a>
59
	<a href="security.php?tab=3" class="btn btn-default<?= (($tab === 3) ? ' active' : '') ?>" role="button"><?= $l_fail2ban ?></a>  
64
	<a href="security.php?tab=3" class="btn btn-default<?= (($tab === 3) ? ' active' : '') ?>" role="button"><?= $l_fail2ban ?></a>
60
</div>
65
</div>
61
<br>
66
<br>
62
 
-
 
63
 
-
 
64
<?php
67
<?php
65
if ($tab === 1) {
68
if ($tab === 1) {
66
	$spoofs = [];
69
	$spoofs = [];
67
	$regex = '/^\[(?P<date>[0-9\/\-: ]+)\] : alcasar-watchdog : (?P<ip>(?:(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])) is usurped \((?P<mac>(?:[0-9A-Fa-f]{2}[:-]){5}[0-9A-Fa-f]{2})\)\. Alcasar disconnect the user \((?P<user>.+)\)\.$/';
70
	$regex = '/^\[(?P<date>[0-9\/\-: ]+)\] : alcasar-watchdog : (?P<ip>(?:(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])) is usurped \((?P<mac>(?:[0-9A-Fa-f]{2}[:-]){5}[0-9A-Fa-f]{2})\)\. Alcasar disconnect the user \((?P<user>.+)\)\.$/';
68
	$file = fopen('/var/Save/security/watchdog.log', 'r');
71
	$file = fopen('/var/Save/security/watchdog.log', 'r');
Line 82... Line 85...
82
				];
85
				];
83
			}
86
			}
84
		}
87
		}
85
		fclose($file);
88
		fclose($file);
86
	}
89
	}
87
 
-
 
88
	$spoofs = array_reverse($spoofs);
90
	$spoofs = array_reverse($spoofs);
89
?>
91
?>
90
<h3 style="text-align: center;"><?= $l_spoofing ?></h3>
92
<h3 style="text-align: center;"><?= $l_spoofing ?></h3>
91
	<div class="container">
93
	<div class="container">
92
		<table style='font-family: "DejaVu Sans";font-size: small;color: #666650;' class="table table-striped  tableBis table-hover" border="1">		
94
		<table style='font-family: "DejaVu Sans";font-size: small;color: #666650;' class="table table-striped  tableBis table-hover" border="1">		
Line 168... Line 170...
168
				}
170
				}
169
			}
171
			}
170
		}
172
		}
171
		fclose($file);
173
		fclose($file);
172
	}
174
	}
173
 
-
 
174
	$bans = array_reverse($bans);
175
	$bans = array_reverse($bans);
175
?>
176
?>
176
	<h3 style="text-align: center;"><?= $l_fail2ban ?></h3>
177
	<h3 style="text-align: center;"><?= $l_fail2ban ?></h3>
177
	<div class="container" border="1">
178
	<div class="container" border="1">
178
		<table  class="table tableBis table-striped table-hover" border="1">
179
		<table  class="table tableBis table-striped table-hover" border="1">