19,16 → 19,19 |
$l_service_status_img_ko= "Arrété"; |
$l_service_action = "Actions"; |
$l_radiusd = "Serveur d'authentification et d'autorisation"; |
$l_chilli = "Passerelle d'interception"; |
$l_chilli = "Passerelle d'interception et serveur DHCP"; |
$l_e2guardian = "Filtre d'URL et de contenu WEB"; |
$l_mysqld = "Serveur de la base des usagers"; |
$l_lighttpd = "Serveur WEB (Alcasar Control Center)"; |
$l_sshd = "Accès sécurisée distant"; |
$l_freshclam = "Mise à jour de l'antivirus toutes les 2 heures"; |
$l_freshclam = "Mise à jour de l'antivirus (toutes les 2 heures)"; |
$l_ntpd = "Service de mise à l'heure réseau"; |
$l_havp = "Proxy Antivirus 1"; |
$l_fail2ban = "Détecteur d'intrusion"; |
$l_nfsen = "Grapheur de flux NetFlow"; |
$l_vnstat = "Grapheur de flux réseau"; |
$l_havp = "Proxy Antivirus"; |
$l_tinyproxy = "Proxy HTTP léger"; |
$l_dnsmasq = "Serveur DNS et DHCP"; |
$l_dnsmasq = "Serveur DNS principal"; |
$l_dnsmasq_blacklist = "Serveur DNS pour la Blacklist"; |
$l_dnsmasq_whitelist = "Serveur DNS pour la Whitelist"; |
$l_dnsmasq_blackhole = "Serveur DNS 'trou noir'"; |
35,13 → 38,11 |
$l_ulogd_ssh = "journalisation des accès par SSH"; |
$l_ulogd_ext_access = "journalisation des tentatives d'accès externes"; |
$l_ulogd_traceability = "journalisation des connexions WEB filtrés"; |
$l_nfsen = ""; // TODO |
$l_fail2ban = ""; // TODO |
$l_vnstat = ""; // TODO |
$l_execute = "Exécuter"; |
$l_stop_restart = "Arret et redémarrage du système"; |
$l_halt = "Arréter le système"; |
$l_reboot = "Relancer le système"; |
|
} else { |
$l_services_title = "Services configuration"; |
$l_main_services = "Main services"; |
56,7 → 57,7 |
$l_service_status_img_ko= "Stopped"; |
$l_service_action = "Actions"; |
$l_radiusd = "Authentication and authorisation server"; |
$l_chilli = "Interception gateway"; |
$l_chilli = "Interception gateway and DHCP server"; |
$l_e2guardian = "URL and WEB content filter"; |
$l_mysqld = "User database server"; |
$l_lighttpd = "WEB server (ALCASAR Control Center)"; |
63,18 → 64,18 |
$l_sshd = "Secure remote access"; |
$l_freshclam = "Antivirus update process (every 2 hours)"; |
$l_ntpd = "Network time server"; |
$l_fail2ban = "Intrusion Dectection System"; |
$l_nfsen = "Netflow grapher"; |
$l_vnstat = "Network grapher"; |
$l_havp = "Antivirus Proxy"; |
$l_tinyproxy = "Light HTTP Proxy"; |
$l_dnsmasq = "DNS and DHCP server"; |
$l_dnsmasq_blacklist = "DNS server for the Blacklist"; |
$l_dnsmasq_whitelist = "DNS server for the Whitelist"; |
$l_dnsmasq_blackhole = "DNS server (blackhole)"; |
$l_dnsmasq = "Main DNS server"; |
$l_dnsmasq_blacklist = "Blacklist DNS server"; |
$l_dnsmasq_whitelist = "Whitelist DNS server"; |
$l_dnsmasq_blackhole = "Blackhole DNS server"; |
$l_ulogd_ssh = "SSH access logging process"; |
$l_ulogd_ext_access = "Extern access attempts logging process"; |
$l_ulogd_traceability = "Filtering WEB access logging process"; |
$l_nfsen = ""; // TODO |
$l_fail2ban = ""; // TODO |
$l_vnstat = ""; // TODO |
$l_execute = "Execute"; |
$l_stop_restart = "Halt and restart the system"; |
$l_halt = "Halt le system"; |
82,14 → 83,13 |
} |
|
/**************************************************************** |
* CONSTANTES AVEC CHEMINS DES FICHIERS DE CONFIGURATION * |
* CONST * |
*****************************************************************/ |
define ("CONF_FILE", "/usr/local/etc/alcasar.conf"); |
|
/******************************************************** |
* TEST DU FICHIERS DE CONFIGURATION * |
* CONF FILE test * |
*********************************************************/ |
//Test de présence et des droits en lecture des fichiers de configuration. |
if (!file_exists(CONF_FILE)){ |
exit("Fichier de configuration ".CONF_FILE." non présent"); |
} |
97,11 → 97,11 |
exit("Vous n'avez pas les droits de lecture sur le fichier ".CONF_FILE); |
} |
|
//fonction pour faire une action (start,stop,restart) sur un service |
// Doing an action on a service (start,stop or restart) |
function serviceExec($service, $action){ |
if (($action == "start")||($action == "stop")||($action == "restart")){ |
exec("sudo /usr/bin/systemctl $action ".escapeshellarg($service), $retval, $retstatus); |
if ($service == "sshd"){ |
if ($service == "sshd"){ // in order to keep that conf for SSH at next reboot |
if ($action == "start"){ |
exec("sudo /usr/bin/systemctl enable ".escapeshellarg($service)); |
file_put_contents(CONF_FILE, str_replace('SSH=off', 'SSH=on', file_get_contents(CONF_FILE))); |
118,8 → 118,8 |
return false; |
} |
} |
//fonction définissant le status d'un service |
//(en fonction de la présence d'un mot clé dans la valeur de status) |
|
// Testing if a service is active |
function checkServiceStatus($service){ |
$response = false; |
exec("sudo /usr/bin/systemctl is-active ".escapeshellarg("$service.service"), $retval); |
135,9 → 135,8 |
//------------------------------- |
// Actions on services |
//------------------------------- |
//sécurité sur les actions à réaliser |
$autorizeService = ['radiusd','chilli','e2guardian','mysqld','lighttpd','sshd','freshclam','ntpd','havp','tinyproxy','dnsmasq','dnsmasq-blacklist','dnsmasq-whitelist','dnsmasq-blackhole', 'ulogd-ssh', 'ulogd-ext-access', 'ulogd-traceability','nfsen','fail2ban','vnstat']; |
$autorizeAction = ['start','stop','restart']; |
$autorizeService = array("radiusd","chilli","mysqld","lighttpd","dnsmasq","ulogd-ssh","ulogd-ext-access","ulogd-traceability","dnsmasq-blacklist","dnsmasq-whitelist","dnsmasq-blackhole","e2guardian","havp","tinyproxy","freshclam","sshd","ntpd","fail2ban","nfsen","vnstat"); |
$autorizeAction = array("start","stop","restart"); |
|
if (isset($_GET['service'])&&(in_array($_GET['service'], $autorizeService))) { |
if (isset($_GET['action'])&&(in_array($_GET['action'], $autorizeAction))) { |
161,37 → 160,34 |
} |
} |
|
|
//------------------------------- |
//recherche du status des services |
// Check services status |
//------------------------------- |
$MainServiceStatus = array(); |
$MainServiceStatus['chilli'] = checkServiceStatus("chilli"); |
$MainServiceStatus['radiusd'] = checkServiceStatus("radiusd"); |
$MainServiceStatus['chilli'] = checkServiceStatus("chilli"); |
$MainServiceStatus['mysqld'] = checkServiceStatus("mysqld"); |
$MainServiceStatus['lighttpd'] = checkServiceStatus("lighttpd"); |
$MainServiceStatus['dnsmasq'] = checkServiceStatus("dnsmasq"); |
$MainServiceStatus['ulogd-ssh'] = checkServiceStatus("ulogd-ssh"); |
$MainServiceStatus['ulogd-ext-access'] = checkServiceStatus("ulogd-ext-access"); |
$MainServiceStatus['ulogd-traceability'] = checkServiceStatus("ulogd-traceability"); |
$MainServiceStatus['nfsen'] = checkServiceStatus("nfsen"); |
$MainServiceStatus['fail2ban'] = checkServiceStatus("fail2ban"); |
$MainServiceStatus['vnstat'] = checkServiceStatus("vnstat"); |
$MainServiceStatus['ulogd_ssh'] = checkServiceStatus("ulogd-ssh"); |
$MainServiceStatus['ulogd_ext_access'] = checkServiceStatus("ulogd-ext-access"); |
$MainServiceStatus['ulogd_traceability'] = checkServiceStatus("ulogd-traceability"); |
|
$FilterServiceStatus = array(); |
$FilterServiceStatus['dnsmasq-blacklist'] = checkServiceStatus("dnsmasq-blacklist"); |
$FilterServiceStatus['dnsmasq-whitelist'] = checkServiceStatus("dnsmasq-whitelist"); |
$FilterServiceStatus['dnsmasq-blackhole'] = checkServiceStatus("dnsmasq-blackhole"); |
$filterServiceStatus['e2guardian'] = checkServiceStatus("e2guardian"); |
$FilterServiceStatus['dnsmasq_blacklist'] = checkServiceStatus("dnsmasq-blacklist"); |
$FilterServiceStatus['dnsmasq_whitelist'] = checkServiceStatus("dnsmasq-whitelist"); |
$FilterServiceStatus['dnsmasq_blackhole'] = checkServiceStatus("dnsmasq-blackhole"); |
$FilterServiceStatus['e2guardian'] = checkServiceStatus("e2guardian"); |
$FilterServiceStatus['havp'] = checkServiceStatus("havp"); |
$FilterServiceStatus['tinyproxy'] = checkServiceStatus("tinyproxy"); |
$FilterServiceStatus['freshclam'] = checkServiceStatus("freshclam"); |
|
|
$OptServiceStatus = array(); |
$OptServiceStatus['sshd'] = checkServiceStatus("sshd"); |
$OptServiceStatus['ntpd'] = checkServiceStatus("ntpd"); |
|
$OptServiceStatus['fail2ban'] = checkServiceStatus("fail2ban"); |
$OptServiceStatus['nfsen'] = checkServiceStatus("nfsen"); |
$OptServiceStatus['vnstat'] = checkServiceStatus("vnstat"); |
/**************** |
* MAIN * |
*****************/ |
214,14 → 210,14 |
<tr> |
<?php if ($statusOK) { ?> |
<td align="center"><img src="/images/state_ok.gif" width="15" height="15" alt="<?php echo $l_service_status_img_ok; ?>"></td> |
<td align="center"><?php $comment=str_replace('-', '_', "l_$serviceName"); echo "<b>$serviceName</b></td><td>${$comment}" ;?> </td> |
<td align="center"><?php $comment="l_$serviceName"; echo "<b>$serviceName</b></td><td>${$comment}" ;?> </td> |
<td width="80" align="center">---</td> |
<td width="80" align="center"><?php if ($serviceName != "chilli") { echo "<a href=\"".$_SERVER['PHP_SELF']."?action=stop&service=$serviceName\"> $l_service_stop</a>"; } else echo "---";?></td> |
<td width="80" align="center"><a href="<?php echo $_SERVER['PHP_SELF']."?action=restart&service=$serviceName\"> $l_service_restart";?></a></td> |
<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> |
<td width="80" align="center"><a href="<?php echo $_SERVER['PHP_SELF']."?action=restart&service=".str_replace('_','-',$serviceName)."\"> $l_service_restart";?></a></td> |
<?php } else { ?> |
<td align="center"><img src="/images/state_error.gif" width="15" height="15" alt="<?php echo $l_service_status_img_ko ?>"></td> |
<td align="center"><?php $comment=str_replace('-', '_', "l_$serviceName"); echo "<b>$serviceName</b></td><td>${$comment}" ;?> </td> |
<td width="80" align="center"><a href="<?php echo $_SERVER['PHP_SELF']."?action=start&service=$serviceName\"> $l_service_start";?></a></td> |
<td align="center"><?php $comment="l_$serviceName"; echo "<b>$serviceName</b></td><td>${$comment}" ;?> </td> |
<td width="80" align="center"><a href="<?php echo $_SERVER['PHP_SELF']."?action=start&service=".str_replace('_','-',$serviceName)."\"> $l_service_start";?></a></td> |
<td width="80" align="center">---</td> |
<td width="80" align="center">---</td> |
<?php } ?> |
239,14 → 235,14 |
<tr> |
<?php if ($statusOK) { ?> |
<td align="center"><img src="/images/state_ok.gif" width="15" height="15" alt="<?php echo $l_service_status_img_ok; ?>"></td> |
<td align="center"><?php $comment=str_replace('-', '_', "l_$serviceName"); echo "<b>$serviceName</b></td><td>${$comment}" ;?> </td> |
<td align="center"><?php $comment="l_$serviceName"; echo "<b>$serviceName</b></td><td>${$comment}" ;?> </td> |
<td width="80" align="center">---</td> |
<td width="80" align="center"><a href="<?php echo $_SERVER['PHP_SELF']."?action=stop&service=$serviceName\"> $l_service_stop";?></a></td> |
<td width="80" align="center"><a href="<?php echo $_SERVER['PHP_SELF']."?action=restart&service=$serviceName\"> $l_service_restart";?></a></td> |
<td width="80" align="center"><a href="<?php echo $_SERVER['PHP_SELF']."?action=stop&service=".str_replace('_','-',$serviceName)."\"> $l_service_stop";?></a></td> |
<td width="80" align="center"><a href="<?php echo $_SERVER['PHP_SELF']."?action=restart&service=".str_replace('_','-',$serviceName)."\"> $l_service_restart";?></a></td> |
<?php } else { ?> |
<td align="center"><img src="/images/state_error.gif" width="15" height="15" alt="<?php echo $l_service_status_img_ko ?>"></td> |
<td align="center"><?php $comment=str_replace('-', '_', "l_$serviceName"); echo "<b>$serviceName</b></td><td>${$comment}" ;?> </td> |
<td width="80" align="center"><a href="<?php echo $_SERVER['PHP_SELF']."?action=start&service=$serviceName\"> $l_service_start";?></a></td> |
<td align="center"><?php $comment="l_$serviceName"; echo "<b>$serviceName</b></td><td>${$comment}" ;?> </td> |
<td width="80" align="center"><a href="<?php echo $_SERVER['PHP_SELF']."?action=start&service=".str_replace('_','-',$serviceName)."\"> $l_service_start";?></a></td> |
<td width="80" align="center">---</td> |
<td width="80" align="center">---</td> |
<?php } ?> |
263,13 → 259,13 |
<tr> |
<?php if ($statusOK) { ?> |
<td align="center"><img src="/images/state_ok.gif" width="15" height="15" alt="<?php echo $l_service_status_img_ok; ?>"></td> |
<td align="center"><?php $comment=str_replace('-', '_', "l_$serviceName"); echo "<b>$serviceName</b></td><td>${$comment}" ;?> </td> |
<td align="center"><?php $comment="l_$serviceName"; echo "<b>$serviceName</b></td><td>${$comment}" ;?> </td> |
<td width="80" align="center">---</td> |
<td width="80" align="center"><a href="<?php echo $_SERVER['PHP_SELF']."?action=stop&service=$serviceName\"> $l_service_stop";?></a></td> |
<td width="80" align="center"><a href="<?php echo $_SERVER['PHP_SELF']."?action=restart&service=$serviceName\"> $l_service_restart";?></a></td> |
<?php } else { ?> |
<td align="center"><img src="/images/state_error.gif" width="15" height="15" alt="<?php echo $l_service_status_img_ko ?>"></td> |
<td align="center"><?php $comment=str_replace('-', '_', "l_$serviceName"); echo "<b>$serviceName</b></td><td>${$comment}" ;?> </td> |
<td align="center"><?php $comment="l_$serviceName"; echo "<b>$serviceName</b></td><td>${$comment}" ;?> </td> |
<td width="80" align="center"><a href="<?php echo $_SERVER['PHP_SELF']."?action=start&service=$serviceName\"> $l_service_start";?></a></td> |
<td width="80" align="center">---</td> |
<td width="80" align="center">---</td> |