Subversion Repositories ALCASAR

Rev

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

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