Subversion Repositories ALCASAR

Rev

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

Rev 2926 Rev 2931
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
		if ($service != "wifi4eu") { exec("sudo /usr/bin/systemctl $action ".escapeshellarg($service), $retval, $retstatus); }
157
		if ($service == "wifi4eu"){
157
		if ($service == "wifi4eu"){
158
			if ($action == "stop"){
-
 
159
				file_put_contents(CONF_FILE, str_replace('WIFI4EU=on', 'WIFI4EU=off', file_get_contents(CONF_FILE)));
158
			if ($action == "stop"){  // see POST fonction (below) to start this service
160
//				exec("sudo /usr/local/bin/alcasar-wifi4eu.sh -off");
159
				exec("sudo /usr/local/bin/alcasar-wifi4eu.sh -off");
161
				}
160
				}
162
			}
161
			}
163
		if ($service == "sshd"){ 
162
		if ($service == "sshd"){ 
164
			if ($action == "start"){
163
			if ($action == "start"){
165
				exec("sudo /usr/bin/systemctl enable ".escapeshellarg($service)); // in order to keep that conf for SSH at next reboot
164
				//exec("sudo /usr/bin/systemctl enable ".escapeshellarg($service));
166
				file_put_contents(CONF_FILE, str_replace('SSH=off', 'SSH=on', file_get_contents(CONF_FILE)));
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
167
				exec("sudo /usr/local/bin/alcasar-iptables.sh");
166
				exec("sudo /usr/local/bin/alcasar-iptables.sh");
168
				}
167
				}
169
			if ($action == "stop"){
168
			if ($action == "stop"){
170
				exec("sudo /usr/bin/systemctl disable ".escapeshellarg($service));  // in order to keep that conf for SSH at next reboot
169
				//exec("sudo /usr/bin/systemctl disable ".escapeshellarg($service));
171
				file_put_contents(CONF_FILE, str_replace('SSH=on', 'SSH=off', file_get_contents(CONF_FILE)));
170
				file_put_contents(CONF_FILE, str_replace('SSH=on', 'SSH=off', file_get_contents(CONF_FILE)));
172
				exec("sudo /usr/local/bin/alcasar-iptables.sh");
171
				exec("sudo /usr/local/bin/alcasar-iptables.sh");
173
				}
172
				}
174
			}
173
			}
175
		return $retstatus;
174
		return $retstatus;
176
	} else {
175
	} else {
177
		return false;
176
		return false;
178
	}
177
	}
179
}
178
}
180
 
179
 
181
// Testing if a service is active
180
// Testing if a service is active
182
function checkServiceStatus($service){
181
function checkServiceStatus($service){
183
	$response = false;
182
	$response = false;
184
	exec("sudo /usr/bin/systemctl is-active ".escapeshellarg("$service.service"), $retval);
183
	exec("sudo /usr/bin/systemctl is-active ".escapeshellarg("$service.service"), $retval);
185
	foreach( $retval as $val ) {
184
	foreach( $retval as $val ) {
186
		if ($val == "active"){
185
		if ($val == "active"){
187
			$response = true;
186
			$response = true;
188
			break;
187
			break;
189
		}
188
		}
190
	}
189
	}
191
	return $response;
190
	return $response;
192
}
191
}
193
 
192
 
194
//-------------------------------
193
//-------------------------------
195
// Actions on services
194
// Actions on services
196
//-------------------------------
195
//-------------------------------
197
$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");
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");
198
$autorizeAction = array("start","stop","restart");
197
$autorizeAction = array("start","stop","restart");
199
 
198
 
200
if (isset($_GET['service'])&&(in_array($_GET['service'], $autorizeService))) {
199
if (isset($_GET['service'])&&(in_array($_GET['service'], $autorizeService))) {
201
    if (isset($_GET['action'])&&(in_array($_GET['action'], $autorizeAction))) {
200
    if (isset($_GET['action'])&&(in_array($_GET['action'], $autorizeAction))) {
202
    	$execStatus = serviceExec($_GET['service'], $_GET['action']);
201
    	$execStatus = serviceExec($_GET['service'], $_GET['action']);
203
		// execStatus non exploité
202
		// execStatus non exploité
204
	}
203
	}
205
}
204
}
206
//-------------------------------
205
//-------------------------------
207
// WIFI4EU
206
// WIFI4EU
208
//-------------------------------
207
//-------------------------------
209
if (isset($_POST['wifi4eu'])){
208
if (isset($_POST['wifi4eu'])){
210
	file_put_contents(CONF_FILE, str_replace('WIFI4EU=off', 'WIFI4EU=on', file_get_contents(CONF_FILE)));
209
	//file_put_contents(CONF_FILE, preg_replace('/^WIFI4EU_CODE=*/', 'WIFI4EU_CODE='.$_POST['wifi4eu'], file_get_contents(CONF_FILE)));
211
//	file_put_contents(CONF_FILE, preg_replace('^WIFI4EU_CODE=*', 'WIFI4EU_code=$_POST[\'wifi4eu\']', file_get_contents(CONF_FILE)));
210
	file_put_contents(CONF_FILE, preg_replace('/^WIFI4EU_CODE=.*/', 'WIFI4EU_CODE=REXY', file_get_contents(CONF_FILE)));
212
//	exec("sudo /usr/local/bin/alcasar-wifi4eu.sh -on");
211
	exec("sudo /usr/local/bin/alcasar-wifi4eu.sh -on");
213
}
212
}
214
//-------------------------------
213
//-------------------------------
215
// Actions on system
214
// Actions on system
216
//-------------------------------
215
//-------------------------------
217
if (isset($_POST['choix'])){
216
if (isset($_POST['choix'])){
218
	switch ($_POST['choix']){
217
	switch ($_POST['choix']){
219
		case 'reboot' :
218
		case 'reboot' :
220
			exec ("sudo /usr/local/bin/alcasar-logout.sh all");
219
			exec ("sudo /usr/local/bin/alcasar-logout.sh all");
221
			exec ("sudo /usr/sbin/shutdown -r now");
220
			exec ("sudo /usr/sbin/shutdown -r now");
222
		break;
221
		break;
223
		case 'halt' :
222
		case 'halt' :
224
			exec ("sudo /usr/local/bin/alcasar-logout.sh all");
223
			exec ("sudo /usr/local/bin/alcasar-logout.sh all");
225
			exec ("sudo /usr/sbin/shutdown -h now");
224
			exec ("sudo /usr/sbin/shutdown -h now");
226
		break;
225
		break;
227
	}
226
	}
228
}
227
}
229
 
228
 
230
//-------------------------------
229
//-------------------------------
231
// Check services status
230
// Check services status
232
//-------------------------------
231
//-------------------------------
233
$MainServiceStatus = array();
232
$MainServiceStatus = array();
234
$MainServiceStatus['chilli'] = checkServiceStatus("chilli");
233
$MainServiceStatus['chilli'] = checkServiceStatus("chilli");
235
$MainServiceStatus['radiusd'] = checkServiceStatus("radiusd");
234
$MainServiceStatus['radiusd'] = checkServiceStatus("radiusd");
236
$MainServiceStatus['mysqld'] = checkServiceStatus("mysqld");
235
$MainServiceStatus['mysqld'] = checkServiceStatus("mysqld");
237
$MainServiceStatus['lighttpd'] = checkServiceStatus("lighttpd");
236
$MainServiceStatus['lighttpd'] = checkServiceStatus("lighttpd");
238
$MainServiceStatus['unbound'] = checkServiceStatus("unbound");
237
$MainServiceStatus['unbound'] = checkServiceStatus("unbound");
239
$MainServiceStatus['nfcapd'] = checkServiceStatus("nfcapd");
238
$MainServiceStatus['nfcapd'] = checkServiceStatus("nfcapd");
240
$MainServiceStatus['ulogd_ssh'] = checkServiceStatus("ulogd-ssh");
239
$MainServiceStatus['ulogd_ssh'] = checkServiceStatus("ulogd-ssh");
241
$MainServiceStatus['ulogd_ext_access'] = checkServiceStatus("ulogd-ext-access");
240
$MainServiceStatus['ulogd_ext_access'] = checkServiceStatus("ulogd-ext-access");
242
$MainServiceStatus['ulogd_traceability'] = checkServiceStatus("ulogd-traceability");
241
$MainServiceStatus['ulogd_traceability'] = checkServiceStatus("ulogd-traceability");
243
$MainServiceStatus['sshd'] = checkServiceStatus("sshd");
242
$MainServiceStatus['sshd'] = checkServiceStatus("sshd");
244
$MainServiceStatus['ntpd'] = checkServiceStatus("ntpd");
243
$MainServiceStatus['ntpd'] = checkServiceStatus("ntpd");
245
$MainServiceStatus['fail2ban'] = checkServiceStatus("fail2ban");
244
$MainServiceStatus['fail2ban'] = checkServiceStatus("fail2ban");
246
$MainServiceStatus['vnstat'] = checkServiceStatus("vnstat");
245
$MainServiceStatus['vnstat'] = checkServiceStatus("vnstat");
247
 
246
 
248
$FilterServiceStatus = array();
247
$FilterServiceStatus = array();
249
$FilterServiceStatus['unbound_blacklist'] = checkServiceStatus("unbound-blacklist");
248
$FilterServiceStatus['unbound_blacklist'] = checkServiceStatus("unbound-blacklist");
250
$FilterServiceStatus['unbound_whitelist'] = checkServiceStatus("unbound-whitelist");
249
$FilterServiceStatus['unbound_whitelist'] = checkServiceStatus("unbound-whitelist");
251
$FilterServiceStatus['dnsmasq_whitelist'] = checkServiceStatus("dnsmasq-whitelist");
250
$FilterServiceStatus['dnsmasq_whitelist'] = checkServiceStatus("dnsmasq-whitelist");
252
$FilterServiceStatus['unbound_blackhole'] = checkServiceStatus("unbound-blackhole");
251
$FilterServiceStatus['unbound_blackhole'] = checkServiceStatus("unbound-blackhole");
253
$FilterServiceStatus['e2guardian'] = checkServiceStatus("e2guardian");
252
$FilterServiceStatus['e2guardian'] = checkServiceStatus("e2guardian");
254
$FilterServiceStatus['clamav_daemon'] = checkServiceStatus("clamav-daemon");
253
$FilterServiceStatus['clamav_daemon'] = checkServiceStatus("clamav-daemon");
255
$FilterServiceStatus['clamav_freshclam'] = checkServiceStatus("clamav-freshclam");
254
$FilterServiceStatus['clamav_freshclam'] = checkServiceStatus("clamav-freshclam");
256
 
255
 
257
/****************
256
/****************
258
*	MAIN	*
257
*	MAIN	*
259
*****************/
258
*****************/
260
 
259
 
261
?><!DOCTYPE HTML>
260
?><!DOCTYPE HTML>
262
<html>
261
<html>
263
<head>
262
<head>
264
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
263
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
265
	<title><?php echo $l_services_title; ?></title>
264
	<title><?php echo $l_services_title; ?></title>
266
	<link rel="stylesheet" href="/css/acc.css" type="text/css">
265
	<link rel="stylesheet" href="/css/acc.css" type="text/css">
267
</head>
266
</head>
268
<body>
267
<body>
269
<div class="panel">
268
<div class="panel">
270
	<div class="panel-header"><?= $l_main_services ?></div>
269
	<div class="panel-header"><?= $l_main_services ?></div>
271
	<div class="panel-row">
270
	<div class="panel-row">
272
	<table width="100%" border=0 cellspacing=0 cellpadding=0>
271
	<table width="100%" border=0 cellspacing=0 cellpadding=0>
273
		<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>
274
		<?php foreach( $MainServiceStatus as $serviceName => $statusOK ) { ?>
273
		<?php foreach( $MainServiceStatus as $serviceName => $statusOK ) { ?>
275
		<tr>
274
		<tr>
276
		<?php if ($statusOK) { ?>
275
		<?php if ($statusOK) { ?>
277
			<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>
278
			<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>
279
			<td width="80" align="center">---</td>
278
			<td width="80" align="center">---</td>
280
			<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>
281
			<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>
282
		<?php } else { ?>
281
		<?php } else { ?>
283
			<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>
284
			<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>
285
			<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>
286
			<td width="80" align="center">---</td>
285
			<td width="80" align="center">---</td>
287
			<td width="80" align="center">---</td>
286
			<td width="80" align="center">---</td>
288
		<?php } ?>
287
		<?php } ?>
289
		</tr>
288
		</tr>
290
		<?php } ?>
289
		<?php } ?>
291
	</table>
290
	</table>
292
	</div>
291
	</div>
293
</div>
292
</div>
294
<div class="panel">
293
<div class="panel">
295
	<div class="panel-header"><?= $l_filter_services ?></div>
294
	<div class="panel-header"><?= $l_filter_services ?></div>
296
	<div class="panel-row">
295
	<div class="panel-row">
297
	<table width="100%" border=0 cellspacing=0 cellpadding=0>
296
	<table width="100%" border=0 cellspacing=0 cellpadding=0>
298
		<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>
299
		<!--	<TR align="center"> -->
298
		<!--	<TR align="center"> -->
300
		<?php foreach( $FilterServiceStatus as $serviceName => $statusOK ) { ?>
299
		<?php foreach( $FilterServiceStatus as $serviceName => $statusOK ) { ?>
301
		<tr>
300
		<tr>
302
		<?php if ($statusOK) { ?>
301
		<?php if ($statusOK) { ?>
303
			<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>
304
			<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>
305
			<td width="80" align="center">---</td>
304
			<td width="80" align="center">---</td>
306
			<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>
307
			<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>
308
			<?php } else { ?>
307
			<?php } else { ?>
309
			<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>
310
			<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>
311
			<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>
312
			<td width="80" align="center">---</td>
311
			<td width="80" align="center">---</td>
313
			<td width="80" align="center">---</td>
312
			<td width="80" align="center">---</td>
314
			<?php } ?>
313
			<?php } ?>
315
		</tr>
314
		</tr>
316
		<?php } ?>
315
		<?php } ?>
317
	</table>
316
	</table>
318
	</div>
317
	</div>
319
</div>
318
</div>
320
<div class="panel">
319
<div class="panel">
321
	<div class="panel-header"><?= $l_opt_services ?></div>
320
	<div class="panel-header"><?= $l_opt_services ?></div>
322
	<div class="panel-row">
321
	<div class="panel-row">
323
	<form action="<?php echo $_SERVER['PHP_SELF']?>" method=POST>
322
	<form action="<?php echo $_SERVER['PHP_SELF']?>" method=POST>
324
	<table width="100%" border=0 cellspacing=0 cellpadding=0>
323
	<table width="100%" border=0 cellspacing=0 cellpadding=0>
325
		<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>
326
		<tr>
325
		<tr>
327
			<?php if ($wifi4eu == "on") { ?>
326
			<?php if ($wifi4eu == "on") { ?>
328
			<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>
329
			<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>
330
			<td width="80" align="center">---</td>
329
			<td width="80" align="center">---</td>
331
			<td width="80" align="center"><a href="<?php echo $_SERVER['PHP_SELF']."?action=stop&service=wifi4eu\"> $l_service_stop";?></a></td>
330
			<td width="80" align="center"><a href="<?php echo $_SERVER['PHP_SELF']."?action=stop&service=wifi4eu\"> $l_service_stop";?></a></td>
332
			<td width="80" align="center">---</td>
331
			<td width="80" align="center">---</td>
333
			<?php } else { ?>
332
			<?php } else { ?>
334
			<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>
335
			<td align="center">WIFI4EU</td><td><?php echo $l_wifi4eu_id; ?> : <input type ="text" name="wifi4eu" 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" value="<?php echo $wifi4eu_code; ?>" size="40"></td>
336
			<td width="80" align="center"><input type=submit value="<?echo $l_service_start;?>"></td>
335
			<td width="80" align="center"><input type=submit value="<?echo $l_service_start;?>"></td>
337
			<td width="80" align="center">---</td>
336
			<td width="80" align="center">---</td>
338
			<td width="80" align="center">---</td>
337
			<td width="80" align="center">---</td>
339
			<?php } ?>
338
			<?php } ?>
340
		</tr>
339
		</tr>
341
	</table>
340
	</table>
342
	</form>
341
	</form>
343
	</div>
342
	</div>
344
</div>
343
</div>
345
<div class="panel">
344
<div class="panel">
346
	<div class="panel-header"><?= $l_stop_restart ?></div>
345
	<div class="panel-header"><?= $l_stop_restart ?></div>
347
	<div class="panel-row">
346
	<div class="panel-row">
348
	<table width="100%" border=0 cellspacing=0 cellpadding=1>
347
	<table width="100%" border=0 cellspacing=0 cellpadding=1>
349
		<tr><td valign="middle" align="left">
348
		<tr><td valign="middle" align="left">
350
			<form action="<?php echo $_SERVER['PHP_SELF']?>" method=POST>
349
			<form action="<?php echo $_SERVER['PHP_SELF']?>" method=POST>
351
			<select name='choix'>
350
			<select name='choix'>
352
				<option selected value="reboot"><?echo "$l_reboot";?>
351
				<option selected value="reboot"><?echo "$l_reboot";?>
353
				<option value="halt"><?echo "$l_halt";?>
352
				<option value="halt"><?echo "$l_halt";?>
354
			</select>
353
			</select>
355
			<input type=submit value="<?echo "$l_execute";?>">
354
			<input type=submit value="<?echo "$l_execute";?>">
356
			</form>
355
			</form>
357
		</td></tr>
356
		</td></tr>
358
	</table>
357
	</table>
359
	</div>
358
	</div>
360
</div>
359
</div>
361
</body>
360
</body>
362
</html>
361
</html>
363
 
362