Subversion Repositories ALCASAR

Rev

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

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