Subversion Repositories ALCASAR

Rev

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

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