Subversion Repositories ALCASAR

Rev

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

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