Subversion Repositories ALCASAR

Rev

Rev 3099 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 3099 Rev 3170
1
<?php
1
<?php
2
/* written by steweb57 & Rexy */
2
/* written by steweb57 & Rexy */
3
 
3
 
4
# Choice of language
4
# Choice of language
5
$Language = 'en';
5
$Language = 'en';
6
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
6
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
7
	$Langue		= explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
7
	$Langue		= explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
8
	$Language	= strtolower(substr(chop($Langue[0]),0,2)); }
8
	$Language	= strtolower(substr(chop($Langue[0]),0,2)); }
9
if($Language == 'fr') {
9
if($Language == 'fr') {
10
	$l_services_title	= "Configuration des services";
10
	$l_services_title	= "Configuration des services";
11
	$l_main_services	= "Services principaux";
11
	$l_main_services	= "Services principaux";
12
	$l_filter_services	= "Services de filtrage";
12
	$l_filter_services	= "Services de filtrage";
13
	$l_opt_services		= "Services optionnels";
13
	$l_opt_services		= "Services optionnels";
14
	$l_service_title 	= "Rôle du service";
14
	$l_service_title 	= "Rôle du service";
15
	$l_service_start 	= "Démarrer";
15
	$l_service_start 	= "Démarrer";
16
	$l_service_stop 	= "Arréter";
16
	$l_service_stop 	= "Arréter";
17
	$l_service_restart 	= "Redémarrer";
17
	$l_service_restart 	= "Redémarrer";
18
	$l_service_status 	= "Status";
18
	$l_service_status 	= "Status";
19
	$l_service_status_img_ok= "Démarré";
19
	$l_service_status_img_ok= "Démarré";
20
	$l_service_status_img_ko= "Arrété";
20
	$l_service_status_img_ko= "Arrété";
21
	$l_service_action 	= "Actions";
21
	$l_service_action 	= "Actions";
22
	$l_radiusd		= "Serveur d'authentification et d'autorisation";
22
	$l_radiusd		= "Serveur d'authentification et d'autorisation";
23
	$l_chilli		= "Passerelle d'interception et serveur DHCP";
23
	$l_chilli		= "Passerelle d'interception et serveur DHCP";
24
	$l_e2guardian		= "Filtre d'URL et de contenu WEB";
24
	$l_e2guardian		= "Filtre d'URL et de contenu WEB";
25
	$l_mysqld		= "Serveur de la base des usagers";
25
	$l_mysqld		= "Serveur de la base des usagers";
26
	$l_lighttpd		= "Serveur WEB (Alcasar Control Center)";
26
	$l_lighttpd		= "Serveur WEB (Alcasar Control Center)";
27
	$l_sshd			= "Accès sécurisée distant";
27
	$l_sshd			= "Accès sécurisée distant";
28
	$l_clamav_freshclam	= "Mise à jour de l'antivirus (toutes les 4 heures)";
-
 
29
	$l_clamav_daemon	= "Antimalware";
-
 
30
	$l_ntpd			= "Service de mise à l'heure réseau";
28
	$l_ntpd			= "Service de mise à l'heure réseau";
31
	$l_postfix		= "Service de messagerie";
29
	$l_postfix		= "Service de messagerie";
32
	$l_fail2ban		= "Détecteur d'intrusion";
30
	$l_fail2ban		= "Détecteur d'intrusion";
33
	$l_nfcapd 		= "Collecteur de flux NetFlow";
31
	$l_nfcapd 		= "Collecteur de flux NetFlow";
34
	$l_vnstat		= "Grapheur de flux réseau";
32
	$l_vnstat		= "Grapheur de flux réseau";
35
	$l_unbound		= "Serveur DNS principal";
33
	$l_unbound		= "Serveur DNS principal";
36
	$l_unbound_blacklist	= "Serveur DNS pour la Blacklist";
34
	$l_unbound_blacklist	= "Serveur DNS pour la Blacklist";
37
	$l_unbound_whitelist	= "Serveur DNS pour la Whitelist";
35
	$l_unbound_whitelist	= "Serveur DNS pour la Whitelist";
38
	$l_unbound_blackhole	= "Serveur DNS 'trou noir'";
36
	$l_unbound_blackhole	= "Serveur DNS 'trou noir'";
39
	$l_ulogd_ssh		= "journalisation des accès par SSH";
37
	$l_ulogd_ssh		= "journalisation des accès par SSH";
40
	$l_ulogd_ext_access	= "journalisation des tentatives d'accès externes";
38
	$l_ulogd_ext_access	= "journalisation des tentatives d'accès externes";
41
	$l_ulogd_traceability	= "journalisation des connexions WEB filtrés";
39
	$l_ulogd_traceability	= "journalisation des connexions WEB filtrés";
42
	$l_wifi4eu_id	= "Entrez votre identifiant réseau";
40
	$l_wifi4eu_id	= "Entrez votre identifiant réseau";
43
	$l_execute		= "Exécuter";
41
	$l_execute		= "Exécuter";
44
	$l_stop_restart		= "Arrêt et redémarrage du système";
42
	$l_stop_restart		= "Arrêt et redémarrage du système";
45
	$l_halt			= "Arréter le système";
43
	$l_halt			= "Arréter le système";
46
	$l_reboot		= "Relancer le système";
44
	$l_reboot		= "Relancer le système";
47
} else if($Language == 'es') {
45
} else if($Language == 'es') {
48
	$l_services_title	= "Configuración de Servicios";
46
	$l_services_title	= "Configuración de Servicios";
49
	$l_main_services	= "Servicios Principales";
47
	$l_main_services	= "Servicios Principales";
50
	$l_filter_services	= "Servicios de Filtrado";
48
	$l_filter_services	= "Servicios de Filtrado";
51
	$l_opt_services		= "Servicios Opcionales";
49
	$l_opt_services		= "Servicios Opcionales";
52
	$l_service_title 	= "función del servicio";
50
	$l_service_title 	= "función del servicio";
53
	$l_service_start 	= "Iniciar";
51
	$l_service_start 	= "Iniciar";
54
	$l_service_stop 	= "Detener";
52
	$l_service_stop 	= "Detener";
55
	$l_service_restart 	= "Reiniciar";
53
	$l_service_restart 	= "Reiniciar";
56
	$l_service_status 	= "Estado";
54
	$l_service_status 	= "Estado";
57
	$l_service_status_img_ok= "Corriendo";
55
	$l_service_status_img_ok= "Corriendo";
58
	$l_service_status_img_ko= "Detenido";
56
	$l_service_status_img_ko= "Detenido";
59
	$l_service_action 	= "Acciones";
57
	$l_service_action 	= "Acciones";
60
	$l_radiusd		= "Servidor de autenticación y autorización.";
58
	$l_radiusd		= "Servidor de autenticación y autorización.";
61
	$l_chilli		= "Pasarela de interceptación y servidor DHCP";
59
	$l_chilli		= "Pasarela de interceptación y servidor DHCP";
62
	$l_e2guardian		= "Filtro de contenidos URL y WEB";
60
	$l_e2guardian		= "Filtro de contenidos URL y WEB";
63
	$l_mysqld		= "Motor de base de datos para usuarios";
61
	$l_mysqld		= "Motor de base de datos para usuarios";
64
	$l_lighttpd		= "Servidor WEB (ALCASAR Control Center)";
62
	$l_lighttpd		= "Servidor WEB (ALCASAR Control Center)";
65
	$l_sshd			= "Servidor Seguro Acceso Remoto";
63
	$l_sshd			= "Servidor Seguro Acceso Remoto";
66
	$l_clamav_freshclam		= "Proceso de actualización Antivirus (cada 4 horas)";
-
 
67
	$l_clamav_daemon	= "Antimalware";
-
 
68
	$l_ntpd			= "Servidor de hora";
64
	$l_ntpd			= "Servidor de hora";
69
	$l_postfix		= "Servicio de correo electrónico";
65
	$l_postfix		= "Servicio de correo electrónico";
70
	$l_fail2ban		= "Sistema de Detección de Intrusos";
66
	$l_fail2ban		= "Sistema de Detección de Intrusos";
71
	$l_nfcapd		= "Colector de flujo NetFlow";
67
	$l_nfcapd		= "Colector de flujo NetFlow";
72
	$l_vnstat		= "Graficador de tráfico de red";
68
	$l_vnstat		= "Graficador de tráfico de red";
73
	$l_unbound		= "Servidor DNS principal ";
69
	$l_unbound		= "Servidor DNS principal ";
74
	$l_unbound_blacklist	= "Servidor DNS de Lista Negra";
70
	$l_unbound_blacklist	= "Servidor DNS de Lista Negra";
75
	$l_unbound_whitelist	= "Servidor DNS de Lista Blanca";
71
	$l_unbound_whitelist	= "Servidor DNS de Lista Blanca";
76
	$l_unbound_blackhole	= "Agujero negro DNS";
72
	$l_unbound_blackhole	= "Agujero negro DNS";
77
	$l_ulogd_ssh		= "Proceso de registro para accesos SSH";
73
	$l_ulogd_ssh		= "Proceso de registro para accesos SSH";
78
	$l_ulogd_ext_access	= "Proceso de registro de intentos de accesos externos";
74
	$l_ulogd_ext_access	= "Proceso de registro de intentos de accesos externos";
79
	$l_ulogd_traceability	= "Proceso de registro de acceso WEB";
75
	$l_ulogd_traceability	= "Proceso de registro de acceso WEB";
80
	$l_wifi4eu_id	= "Introduzca su identificador de red";
76
	$l_wifi4eu_id	= "Introduzca su identificador de red";
81
	$l_execute		= "Ejecutar";
77
	$l_execute		= "Ejecutar";
82
	$l_stop_restart		= "Apagado y Reinicio del sistema";
78
	$l_stop_restart		= "Apagado y Reinicio del sistema";
83
	$l_halt			= "Apagar el sistema";
79
	$l_halt			= "Apagar el sistema";
84
	$l_reboot		= "Reiniciar el sistema";
80
	$l_reboot		= "Reiniciar el sistema";
85
} else {
81
} else {
86
	$l_services_title	= "Services configuration";
82
	$l_services_title	= "Services configuration";
87
	$l_main_services	= "Main services";
83
	$l_main_services	= "Main services";
88
	$l_filter_services	= "Filtering services";
84
	$l_filter_services	= "Filtering services";
89
	$l_opt_services		= "Optional services";
85
	$l_opt_services		= "Optional services";
90
	$l_service_title 	= "Role of the service";
86
	$l_service_title 	= "Role of the service";
91
	$l_service_start 	= "Start";
87
	$l_service_start 	= "Start";
92
	$l_service_stop 	= "Stop";
88
	$l_service_stop 	= "Stop";
93
	$l_service_restart 	= "Restart";
89
	$l_service_restart 	= "Restart";
94
	$l_service_status 	= "Status";
90
	$l_service_status 	= "Status";
95
	$l_service_status_img_ok= "Running";
91
	$l_service_status_img_ok= "Running";
96
	$l_service_status_img_ko= "Stopped";
92
	$l_service_status_img_ko= "Stopped";
97
	$l_service_action 	= "Actions";
93
	$l_service_action 	= "Actions";
98
	$l_radiusd		= "Authentication and authorisation server";
94
	$l_radiusd		= "Authentication and authorisation server";
99
	$l_chilli		= "Interception gateway and DHCP server";
95
	$l_chilli		= "Interception gateway and DHCP server";
100
	$l_e2guardian		= "URL and WEB content filter";
96
	$l_e2guardian		= "URL and WEB content filter";
101
	$l_mysqld		= "User database server";
97
	$l_mysqld		= "User database server";
102
	$l_lighttpd		= "WEB server (ALCASAR Control Center)";
98
	$l_lighttpd		= "WEB server (ALCASAR Control Center)";
103
	$l_sshd			= "Secure remote access";
99
	$l_sshd			= "Secure remote access";
104
	$l_clamav_freshclam	= "Antivirus update process (every 4 hours)";
-
 
105
	$l_clamav_daemon= "Antimalware";
-
 
106
	$l_ntpd			= "Network time server";
100
	$l_ntpd			= "Network time server";
107
	$l_postfix		= "E-mail service";
101
	$l_postfix		= "E-mail service";
108
	$l_fail2ban		= "Intrusion Dectection System";
102
	$l_fail2ban		= "Intrusion Dectection System";
109
	$l_nfcapd		= "Netflow collector";
103
	$l_nfcapd		= "Netflow collector";
110
	$l_vnstat		= "Network grapher";
104
	$l_vnstat		= "Network grapher";
111
	$l_unbound		= "Main DNS server";
105
	$l_unbound		= "Main DNS server";
112
	$l_unbound_blacklist	= "Blacklist DNS server";
106
	$l_unbound_blacklist	= "Blacklist DNS server";
113
	$l_unbound_whitelist	= "Whitelist DNS server";
107
	$l_unbound_whitelist	= "Whitelist DNS server";
114
	$l_unbound_blackhole	= "Blackhole DNS server";
108
	$l_unbound_blackhole	= "Blackhole DNS server";
115
	$l_ulogd_ssh		= "SSH access logging process";
109
	$l_ulogd_ssh		= "SSH access logging process";
116
	$l_ulogd_ext_access	= "Extern access attempts logging process";
110
	$l_ulogd_ext_access	= "Extern access attempts logging process";
117
	$l_ulogd_traceability	= "Filtering WEB access logging process";
111
	$l_ulogd_traceability	= "Filtering WEB access logging process";
118
	$l_wifi4eu_id	= "Enter your network identifier";
112
	$l_wifi4eu_id	= "Enter your network identifier";
119
	$l_execute		= "Execute";
113
	$l_execute		= "Execute";
120
	$l_stop_restart		= "Halt and restart the system";
114
	$l_stop_restart		= "Halt and restart the system";
121
	$l_halt			= "Halt le system";
115
	$l_halt			= "Halt le system";
122
	$l_reboot		= "Restart the system";
116
	$l_reboot		= "Restart the system";
123
}
117
}
124
 
118
 
125
/****************************************************************
119
/****************************************************************
126
*	                   CONST				*
120
*	                   CONST				*
127
*****************************************************************/
121
*****************************************************************/
128
define ("CONF_FILE", "/usr/local/etc/alcasar.conf");
122
define ("CONF_FILE", "/usr/local/etc/alcasar.conf");
129
 
123
 
130
/********************************************************
124
/********************************************************
131
*			CONF FILE test 			*
125
*			CONF FILE test 			*
132
*********************************************************/
126
*********************************************************/
133
if (!file_exists(CONF_FILE)){
127
if (!file_exists(CONF_FILE)){
134
	exit("Fichier de configuration ".CONF_FILE." non présent");
128
	exit("Fichier de configuration ".CONF_FILE." non présent");
135
}
129
}
136
if (!is_readable(CONF_FILE)){
130
if (!is_readable(CONF_FILE)){
137
	exit("Vous n'avez pas les droits de lecture sur le fichier ".CONF_FILE);
131
	exit("Vous n'avez pas les droits de lecture sur le fichier ".CONF_FILE);
138
}
132
}
139
$file_conf = fopen(CONF_FILE, 'r');
133
$file_conf = fopen(CONF_FILE, 'r');
140
if (!$file_conf) {
134
if (!$file_conf) {
141
	exit('Error opening the file '.CONF_FILE);
135
	exit('Error opening the file '.CONF_FILE);
142
}
136
}
143
while (!feof($file_conf)) {
137
while (!feof($file_conf)) {
144
	$buffer = fgets($file_conf, 4096);
138
	$buffer = fgets($file_conf, 4096);
145
	if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '#')) {
139
	if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '#')) {
146
		$tmp = explode('=', $buffer, 2);
140
		$tmp = explode('=', $buffer, 2);
147
		$conf[trim($tmp[0])] = trim($tmp[1]);
141
		$conf[trim($tmp[0])] = trim($tmp[1]);
148
	}
142
	}
149
}
143
}
150
fclose($file_conf);
144
fclose($file_conf);
151
$wifi4eu = $conf['WIFI4EU'];
145
$wifi4eu = $conf['WIFI4EU'];
152
$wifi4eu_code = $conf['WIFI4EU_CODE'];
146
$wifi4eu_code = $conf['WIFI4EU_CODE'];
153
// Doing an action on a service (start,stop or restart)
147
// Doing an action on a service (start,stop or restart)
154
function serviceExec($service, $action){
148
function serviceExec($service, $action){
155
	if (($action == "start")||($action == "stop")||($action == "restart")){
149
	if (($action == "start")||($action == "stop")||($action == "restart")){
156
		exec("sudo /usr/bin/systemctl $action ".escapeshellarg($service), $retval, $retstatus);
150
		exec("sudo /usr/bin/systemctl $action ".escapeshellarg($service), $retval, $retstatus);
157
		return $retstatus;
151
		return $retstatus;
158
	} else {
152
	} else {
159
		return false;
153
		return false;
160
	}
154
	}
161
}
155
}
162
 
156
 
163
// Testing if a service is active
157
// Testing if a service is active
164
function checkServiceStatus($service){
158
function checkServiceStatus($service){
165
	$response = false;
159
	$response = false;
166
	exec("sudo /usr/bin/systemctl is-active ".escapeshellarg("$service.service"), $retval);
160
	exec("sudo /usr/bin/systemctl is-active ".escapeshellarg("$service.service"), $retval);
167
	foreach( $retval as $val ) {
161
	foreach( $retval as $val ) {
168
		if ($val == "active"){
162
		if ($val == "active"){
169
			$response = true;
163
			$response = true;
170
			break;
164
			break;
171
		}
165
		}
172
	}
166
	}
173
	return $response;
167
	return $response;
174
}
168
}
175
 
169
 
176
//-------------------------------
170
//-------------------------------
177
// WIFI4EU
171
// WIFI4EU
178
//-------------------------------
172
//-------------------------------
179
if (isset($_POST['wifi4eu'])){
173
if (isset($_POST['wifi4eu'])){
180
	switch ($_POST['wifi4eu']){
174
	switch ($_POST['wifi4eu']){
181
		case 'on' :
175
		case 'on' :
182
			$network_code = trim($_POST['wifi4eu_id']);
176
			$network_code = trim($_POST['wifi4eu_id']);
183
		        if ($network_code == '') {
177
		        if ($network_code == '') {
184
				$network_code = '123e4567-e89b-12d3-a456-426655440000'; // WIFI4EU test code
178
				$network_code = '123e4567-e89b-12d3-a456-426655440000'; // WIFI4EU test code
185
			}
179
			}
186
			file_put_contents(CONF_FILE, preg_replace('/WIFI4EU_CODE=.*/', 'WIFI4EU_CODE='.$network_code, file_get_contents(CONF_FILE)));
180
			file_put_contents(CONF_FILE, preg_replace('/WIFI4EU_CODE=.*/', 'WIFI4EU_CODE='.$network_code, file_get_contents(CONF_FILE)));
187
			exec("sudo /usr/local/bin/alcasar-wifi4eu.sh -on");
181
			exec("sudo /usr/local/bin/alcasar-wifi4eu.sh -on");
188
		break;
182
		break;
189
		case 'off' :
183
		case 'off' :
190
			exec("sudo /usr/local/bin/alcasar-wifi4eu.sh -off");
184
			exec("sudo /usr/local/bin/alcasar-wifi4eu.sh -off");
191
		break;
185
		break;
192
	}
186
	}
193
	header('Location: '.$_SERVER['PHP_SELF']);
187
	header('Location: '.$_SERVER['PHP_SELF']);
194
}
188
}
195
 
189
 
196
//-------------------------------
190
//-------------------------------
197
// Stop/restart system
191
// Stop/restart system
198
//-------------------------------
192
//-------------------------------
199
if (isset($_POST['system'])){
193
if (isset($_POST['system'])){
200
	switch ($_POST['system']){
194
	switch ($_POST['system']){
201
		case 'reboot' :
195
		case 'reboot' :
202
			exec ("sudo /usr/local/bin/alcasar-logout.sh all");
196
			exec ("sudo /usr/local/bin/alcasar-logout.sh all");
203
			exec ("sudo /usr/sbin/shutdown -r now");
197
			exec ("sudo /usr/sbin/shutdown -r now");
204
		break;
198
		break;
205
		case 'halt' :
199
		case 'halt' :
206
			exec ("sudo /usr/local/bin/alcasar-logout.sh all");
200
			exec ("sudo /usr/local/bin/alcasar-logout.sh all");
207
			exec ("sudo /usr/sbin/shutdown -h now");
201
			exec ("sudo /usr/sbin/shutdown -h now");
208
		break;
202
		break;
209
	}
203
	}
210
}
204
}
211
 
205
 
212
//-------------------------------
206
//-------------------------------
213
// Actions on services
207
// Actions on services
214
//-------------------------------
208
//-------------------------------
215
$autorizeService = array("radiusd","chilli","mysqld","lighttpd","unbound-forward","ulogd-ssh","ulogd-ext-access","ulogd-traceability","unbound-blacklist","unbound-whitelist","unbound-blackhole","e2guardian","clamav-daemon","clamav-freshclam","sshd","ntpd","fail2ban","nfcapd","vnstat","postfix");
209
$autorizeService = array("radiusd","chilli","mysqld","lighttpd","unbound-forward","ulogd-ssh","ulogd-ext-access","ulogd-traceability","unbound-blacklist","unbound-whitelist","unbound-blackhole","e2guardian","sshd","ntpd","fail2ban","nfcapd","vnstat","postfix");
216
$autorizeAction = array("start","stop","restart");
210
$autorizeAction = array("start","stop","restart");
217
 
211
 
218
if (isset($_GET['service'])&&(in_array($_GET['service'], $autorizeService))) {
212
if (isset($_GET['service'])&&(in_array($_GET['service'], $autorizeService))) {
219
    if (isset($_GET['action'])&&(in_array($_GET['action'], $autorizeAction))) {
213
    if (isset($_GET['action'])&&(in_array($_GET['action'], $autorizeAction))) {
220
    	$execStatus = serviceExec($_GET['service'], $_GET['action']);
214
    	$execStatus = serviceExec($_GET['service'], $_GET['action']);
221
		// execStatus non exploité
215
		// execStatus non exploité
222
	}
216
	}
223
}
217
}
224
 
218
 
225
//-------------------------------
219
//-------------------------------
226
// Check services status
220
// Check services status
227
//-------------------------------
221
//-------------------------------
228
$MainServiceStatus = array();
222
$MainServiceStatus = array();
229
$MainServiceStatus['chilli'] = checkServiceStatus("chilli");
223
$MainServiceStatus['chilli'] = checkServiceStatus("chilli");
230
$MainServiceStatus['radiusd'] = checkServiceStatus("radiusd");
224
$MainServiceStatus['radiusd'] = checkServiceStatus("radiusd");
231
$MainServiceStatus['mysqld'] = checkServiceStatus("mysqld");
225
$MainServiceStatus['mysqld'] = checkServiceStatus("mysqld");
232
$MainServiceStatus['lighttpd'] = checkServiceStatus("lighttpd");
226
$MainServiceStatus['lighttpd'] = checkServiceStatus("lighttpd");
233
$MainServiceStatus['unbound'] = checkServiceStatus("unbound");
227
$MainServiceStatus['unbound'] = checkServiceStatus("unbound");
234
$MainServiceStatus['nfcapd'] = checkServiceStatus("nfcapd");
228
$MainServiceStatus['nfcapd'] = checkServiceStatus("nfcapd");
235
$MainServiceStatus['ulogd_ssh'] = checkServiceStatus("ulogd-ssh");
229
$MainServiceStatus['ulogd_ssh'] = checkServiceStatus("ulogd-ssh");
236
$MainServiceStatus['ulogd_ext_access'] = checkServiceStatus("ulogd-ext-access");
230
$MainServiceStatus['ulogd_ext_access'] = checkServiceStatus("ulogd-ext-access");
237
$MainServiceStatus['ulogd_traceability'] = checkServiceStatus("ulogd-traceability");
231
$MainServiceStatus['ulogd_traceability'] = checkServiceStatus("ulogd-traceability");
238
$MainServiceStatus['sshd'] = checkServiceStatus("sshd");
232
$MainServiceStatus['sshd'] = checkServiceStatus("sshd");
239
$MainServiceStatus['ntpd'] = checkServiceStatus("ntpd");
233
$MainServiceStatus['ntpd'] = checkServiceStatus("ntpd");
240
$MainServiceStatus['fail2ban'] = checkServiceStatus("fail2ban");
234
$MainServiceStatus['fail2ban'] = checkServiceStatus("fail2ban");
241
$MainServiceStatus['vnstat'] = checkServiceStatus("vnstat");
235
$MainServiceStatus['vnstat'] = checkServiceStatus("vnstat");
242
$MainServiceStatus['postfix'] = checkServiceStatus("postfix");
236
$MainServiceStatus['postfix'] = checkServiceStatus("postfix");
243
 
237
 
244
$FilterServiceStatus = array();
238
$FilterServiceStatus = array();
245
$FilterServiceStatus['unbound_blacklist'] = checkServiceStatus("unbound-blacklist");
239
$FilterServiceStatus['unbound_blacklist'] = checkServiceStatus("unbound-blacklist");
246
$FilterServiceStatus['unbound_whitelist'] = checkServiceStatus("unbound-whitelist");
240
$FilterServiceStatus['unbound_whitelist'] = checkServiceStatus("unbound-whitelist");
247
$FilterServiceStatus['unbound_blackhole'] = checkServiceStatus("unbound-blackhole");
241
$FilterServiceStatus['unbound_blackhole'] = checkServiceStatus("unbound-blackhole");
248
$FilterServiceStatus['e2guardian'] = checkServiceStatus("e2guardian");
242
$FilterServiceStatus['e2guardian'] = checkServiceStatus("e2guardian");
249
$FilterServiceStatus['clamav_daemon'] = checkServiceStatus("clamav-daemon");
-
 
250
$FilterServiceStatus['clamav_freshclam'] = checkServiceStatus("clamav-freshclam");
-
 
251
 
243
 
252
/****************
244
/****************
253
*	MAIN	*
245
*	MAIN	*
254
*****************/
246
*****************/
255
 
247
 
256
?><!DOCTYPE HTML>
248
?><!DOCTYPE HTML>
257
<html>
249
<html>
258
<head>
250
<head>
259
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
251
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
260
	<title><?php echo $l_services_title; ?></title>
252
	<title><?php echo $l_services_title; ?></title>
261
	<link rel="stylesheet" href="/css/acc.css" type="text/css">
253
	<link rel="stylesheet" href="/css/acc.css" type="text/css">
262
	<script type="text/javascript" src="/js/jquery.min.js"></script>
254
	<script type="text/javascript" src="/js/jquery.min.js"></script>
263
</head>
255
</head>
264
<body>
256
<body>
265
<div id="ldoverlay" class="overlay">
257
<div id="ldoverlay" class="overlay">
266
	<div class="lds-spinner" id="spinner"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div>
258
	<div class="lds-spinner" id="spinner"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div>
267
</div>
259
</div>
268
<div class="panel">
260
<div class="panel">
269
	<div class="panel-header"><?= $l_main_services ?></div>
261
	<div class="panel-header"><?= $l_main_services ?></div>
270
	<div class="panel-row">
262
	<div class="panel-row">
271
	<table width="100%" border=0 cellspacing=0 cellpadding=0>
263
	<table width="100%" border=0 cellspacing=0 cellpadding=0>
272
		<tr align="center"><td><?php echo $l_service_status;?></td><td colspan="2"><?php echo $l_service_title;?></td><td colspan="3"><?php echo $l_service_action;?></td></tr>
264
		<tr align="center"><td><?php echo $l_service_status;?></td><td colspan="2"><?php echo $l_service_title;?></td><td colspan="3"><?php echo $l_service_action;?></td></tr>
273
		<?php foreach( $MainServiceStatus as $serviceName => $statusOK ) { ?>
265
		<?php foreach( $MainServiceStatus as $serviceName => $statusOK ) { ?>
274
		<tr>
266
		<tr>
275
		<?php if ($statusOK) { ?>
267
		<?php if ($statusOK) { ?>
276
			<td align="center"><img src="/images/state_ok.gif" width="15" height="15" alt="<?php echo $l_service_status_img_ok; ?>"></td>
268
			<td align="center"><img src="/images/state_ok.gif" width="15" height="15" alt="<?php echo $l_service_status_img_ok; ?>"></td>
277
			<td align="center"><?php $comment="l_$serviceName"; echo "<b>$serviceName</b></td><td>${$comment}" ;?> </td>
269
			<td align="center"><?php $comment="l_$serviceName"; echo "<b>$serviceName</b></td><td>${$comment}" ;?> </td>
278
			<td width="80" align="center">---</td>
270
			<td width="80" align="center">---</td>
279
			<td width="80" align="center"><?php if (($serviceName != "chilli") && ($serviceName != "lighttpd")) { echo "<a href=\"".$_SERVER['PHP_SELF']."?action=stop&service=".str_replace('_','-',$serviceName)."\"> $l_service_stop</a>"; } else echo "---";?></td>
271
			<td width="80" align="center"><?php if (($serviceName != "chilli") && ($serviceName != "lighttpd")) { echo "<a href=\"".$_SERVER['PHP_SELF']."?action=stop&service=".str_replace('_','-',$serviceName)."\"> $l_service_stop</a>"; } else echo "---";?></td>
280
			<td width="80" align="center"><a href="<?php echo $_SERVER['PHP_SELF']."?action=restart&service=".str_replace('_','-',$serviceName)."\"> $l_service_restart";?></a></td>
272
			<td width="80" align="center"><a href="<?php echo $_SERVER['PHP_SELF']."?action=restart&service=".str_replace('_','-',$serviceName)."\"> $l_service_restart";?></a></td>
281
		<?php } else { ?>
273
		<?php } else { ?>
282
			<td align="center"><img src="/images/state_error.gif" width="15" height="15" alt="<?php echo $l_service_status_img_ko ?>"></td>
274
			<td align="center"><img src="/images/state_error.gif" width="15" height="15" alt="<?php echo $l_service_status_img_ko ?>"></td>
283
			<td align="center"><?php $comment="l_$serviceName"; echo "$serviceName</td><td>${$comment}" ;?> </td>
275
			<td align="center"><?php $comment="l_$serviceName"; echo "$serviceName</td><td>${$comment}" ;?> </td>
284
			<td width="80" align="center"><a href="<?php echo $_SERVER['PHP_SELF']."?action=start&service=".str_replace('_','-',$serviceName)."\"> $l_service_start";?></a></td>
276
			<td width="80" align="center"><a href="<?php echo $_SERVER['PHP_SELF']."?action=start&service=".str_replace('_','-',$serviceName)."\"> $l_service_start";?></a></td>
285
			<td width="80" align="center">---</td>
277
			<td width="80" align="center">---</td>
286
			<td width="80" align="center">---</td>
278
			<td width="80" align="center">---</td>
287
		<?php } ?>
279
		<?php } ?>
288
		</tr>
280
		</tr>
289
		<?php } ?>
281
		<?php } ?>
290
	</table>
282
	</table>
291
	</div>
283
	</div>
292
</div>
284
</div>
293
<div class="panel">
285
<div class="panel">
294
	<div class="panel-header"><?= $l_filter_services ?></div>
286
	<div class="panel-header"><?= $l_filter_services ?></div>
295
	<div class="panel-row">
287
	<div class="panel-row">
296
	<table width="100%" border=0 cellspacing=0 cellpadding=0>
288
	<table width="100%" border=0 cellspacing=0 cellpadding=0>
297
		<tr align="center"><td><?php echo $l_service_status;?></td><td colspan="2"><?php echo $l_service_title;?></td><td colspan="3"><?php echo $l_service_action;?></td></tr>
289
		<tr align="center"><td><?php echo $l_service_status;?></td><td colspan="2"><?php echo $l_service_title;?></td><td colspan="3"><?php echo $l_service_action;?></td></tr>
298
		<!--	<TR align="center"> -->
290
		<!--	<TR align="center"> -->
299
		<?php foreach( $FilterServiceStatus as $serviceName => $statusOK ) { ?>
291
		<?php foreach( $FilterServiceStatus as $serviceName => $statusOK ) { ?>
300
		<tr>
292
		<tr>
301
		<?php if ($statusOK) { ?>
293
		<?php if ($statusOK) { ?>
302
			<td align="center"><img src="/images/state_ok.gif" width="15" height="15" alt="<?php echo $l_service_status_img_ok; ?>"></td>
294
			<td align="center"><img src="/images/state_ok.gif" width="15" height="15" alt="<?php echo $l_service_status_img_ok; ?>"></td>
303
			<td align="center"><?php $comment="l_$serviceName"; echo "<b>$serviceName</b></td><td>${$comment}" ;?> </td>
295
			<td align="center"><?php $comment="l_$serviceName"; echo "<b>$serviceName</b></td><td>${$comment}" ;?> </td>
304
			<td width="80" align="center">---</td>
296
			<td width="80" align="center">---</td>
305
			<td width="80" align="center"><a href="<?php echo $_SERVER['PHP_SELF']."?action=stop&service=".str_replace('_','-',$serviceName)."\"> $l_service_stop";?></a></td>
297
			<td width="80" align="center"><a href="<?php echo $_SERVER['PHP_SELF']."?action=stop&service=".str_replace('_','-',$serviceName)."\"> $l_service_stop";?></a></td>
306
			<td width="80" align="center"><a href="<?php echo $_SERVER['PHP_SELF']."?action=restart&service=".str_replace('_','-',$serviceName)."\"> $l_service_restart";?></a></td>
298
			<td width="80" align="center"><a href="<?php echo $_SERVER['PHP_SELF']."?action=restart&service=".str_replace('_','-',$serviceName)."\"> $l_service_restart";?></a></td>
307
			<?php } else { ?>
299
			<?php } else { ?>
308
			<td align="center"><img src="/images/state_error.gif" width="15" height="15" alt="<?php echo $l_service_status_img_ko ?>"></td>
300
			<td align="center"><img src="/images/state_error.gif" width="15" height="15" alt="<?php echo $l_service_status_img_ko ?>"></td>
309
			<td align="center"><?php $comment="l_$serviceName"; echo "$serviceName</td><td>${$comment}" ;?> </td>
301
			<td align="center"><?php $comment="l_$serviceName"; echo "$serviceName</td><td>${$comment}" ;?> </td>
310
			<td width="80" align="center"><a href="<?php echo $_SERVER['PHP_SELF']."?action=start&service=".str_replace('_','-',$serviceName)."\"> $l_service_start";?></a></td>
302
			<td width="80" align="center"><a href="<?php echo $_SERVER['PHP_SELF']."?action=start&service=".str_replace('_','-',$serviceName)."\"> $l_service_start";?></a></td>
311
			<td width="80" align="center">---</td>
303
			<td width="80" align="center">---</td>
312
			<td width="80" align="center">---</td>
304
			<td width="80" align="center">---</td>
313
			<?php } ?>
305
			<?php } ?>
314
		</tr>
306
		</tr>
315
		<?php } ?>
307
		<?php } ?>
316
	</table>
308
	</table>
317
	</div>
309
	</div>
318
</div>
310
</div>
319
<div class="panel">
311
<div class="panel">
320
	<div class="panel-header"><?= $l_opt_services ?></div>
312
	<div class="panel-header"><?= $l_opt_services ?></div>
321
	<div class="panel-row">
313
	<div class="panel-row">
322
	<form action="<?php echo $_SERVER['PHP_SELF']?>" method=POST>
314
	<form action="<?php echo $_SERVER['PHP_SELF']?>" method=POST>
323
	<table width="100%" border=0 cellspacing=0 cellpadding=0>
315
	<table width="100%" border=0 cellspacing=0 cellpadding=0>
324
		<tr align="center"><td><?php echo $l_service_status;?></td><td colspan="2"> </td><td colspan="3"><?php echo $l_service_action;?></td></tr>
316
		<tr align="center"><td><?php echo $l_service_status;?></td><td colspan="2"> </td><td colspan="3"><?php echo $l_service_action;?></td></tr>
325
		<tr>
317
		<tr>
326
			<?php if ($wifi4eu == "on") { ?>
318
			<?php if ($wifi4eu == "on") { ?>
327
			<td align="center"><img src="/images/state_ok.gif" width="15" height="15" alt="<?php echo $l_service_status_img_ok; ?>"></td>
319
			<td align="center"><img src="/images/state_ok.gif" width="15" height="15" alt="<?php echo $l_service_status_img_ok; ?>"></td>
328
			<td align="center"><b>WIFI4EU</b></td><td><?php echo "network ID : $wifi4eu_code"; ?></td>
320
			<td align="center"><b>WIFI4EU</b></td><td><?php echo "network ID : $wifi4eu_code"; ?></td>
329
			<td width="80" align="center">---</td>
321
			<td width="80" align="center">---</td>
330
			<td width="80" align="center"><input type="submit" onClick="document.getElementById('ldoverlay').style.display='block';" value="<?echo $l_service_stop;?>"><input type=hidden name="wifi4eu" value="off"></td>
322
			<td width="80" align="center"><input type="submit" onClick="document.getElementById('ldoverlay').style.display='block';" value="<?echo $l_service_stop;?>"><input type=hidden name="wifi4eu" value="off"></td>
331
			<td width="80" align="center">---</td>
323
			<td width="80" align="center">---</td>
332
			<?php } else { ?>
324
			<?php } else { ?>
333
			<td align="center"><img src="/images/state_error.gif" width="15" height="15" alt="<?php echo $l_service_status_img_ko; ?>"></td>
325
			<td align="center"><img src="/images/state_error.gif" width="15" height="15" alt="<?php echo $l_service_status_img_ko; ?>"></td>
334
			<td align="center">WIFI4EU</td><td><?php echo $l_wifi4eu_id; ?> : <input type ="text" name="wifi4eu_id" value="<?php echo $wifi4eu_code; ?>" size="40"></td>
326
			<td align="center">WIFI4EU</td><td><?php echo $l_wifi4eu_id; ?> : <input type ="text" name="wifi4eu_id" value="<?php echo $wifi4eu_code; ?>" size="40"></td>
335
			<td width="80" align="center"><input type="submit" onClick="document.getElementById('ldoverlay').style.display='block';" value="<?echo $l_service_start;?>"><input type=hidden name="wifi4eu" value="on"></td>
327
			<td width="80" align="center"><input type="submit" onClick="document.getElementById('ldoverlay').style.display='block';" value="<?echo $l_service_start;?>"><input type=hidden name="wifi4eu" value="on"></td>
336
			<td width="80" align="center">---</td>
328
			<td width="80" align="center">---</td>
337
			<td width="80" align="center">---</td>
329
			<td width="80" align="center">---</td>
338
			<?php } ?>
330
			<?php } ?>
339
		</tr>
331
		</tr>
340
	</table>
332
	</table>
341
	</form>
333
	</form>
342
	</div>
334
	</div>
343
</div>
335
</div>
344
<div class="panel">
336
<div class="panel">
345
	<div class="panel-header"><?= $l_stop_restart ?></div>
337
	<div class="panel-header"><?= $l_stop_restart ?></div>
346
	<div class="panel-row">
338
	<div class="panel-row">
347
	<table width="100%" border=0 cellspacing=0 cellpadding=1>
339
	<table width="100%" border=0 cellspacing=0 cellpadding=1>
348
		<tr><td valign="middle" align="left">
340
		<tr><td valign="middle" align="left">
349
			<form action="<?php echo $_SERVER['PHP_SELF']?>" method=POST>
341
			<form action="<?php echo $_SERVER['PHP_SELF']?>" method=POST>
350
			<select name='system'>
342
			<select name='system'>
351
				<option selected value="reboot"><?echo "$l_reboot";?>
343
				<option selected value="reboot"><?echo "$l_reboot";?>
352
				<option value="halt"><?echo "$l_halt";?>
344
				<option value="halt"><?echo "$l_halt";?>
353
			</select>
345
			</select>
354
			<input type="submit" onClick="document.getElementById('ldoverlay').style.display='block';" value="<?echo "$l_execute";?>">
346
			<input type="submit" onClick="document.getElementById('ldoverlay').style.display='block';" value="<?echo "$l_execute";?>">
355
			</form>
347
			</form>
356
		</td></tr>
348
		</td></tr>
357
	</table>
349
	</table>
358
	</div>
350
	</div>
359
</div>
351
</div>
360
</body>
352
</body>
361
</html>
353
</html>
362
 
354