/alcasar.sh |
---|
63,7 → 63,7 |
# ****** Paths - chemin des commandes ******* |
SED="/bin/sed -i" |
# ****** Alcasar needed RPMS - paquetages nécessaires au fonctionnement d'Alcasar ****** |
PACKAGES="freeradius freeradius-mysql freeradius-ldap freeradius-web apache-mpm-prefork apache-mod_ssl apache-mod_php squid dansguardian postfix MySQL logwatch ntp awstats mondo cdrecord buffer vim-enhanced bind-utils wget arpscan ulogd dhcp-server openssh-server php-xml coova-chilli pam_ccreds rng-utils lsb-release bind" |
PACKAGES="freeradius freeradius-mysql freeradius-ldap freeradius-web apache-mpm-prefork apache-mod_ssl apache-mod_php squid dansguardian postfix MySQL logwatch ntp awstats mondo cdrecord buffer vim-enhanced bind-utils wget arpscan ulogd dhcp-server openssh-server php-xml coova-chilli pam_ccreds rng-utils lsb-release bind clamav" |
# ****************** End of global parameters ********************* |
header_install () |
213,8 → 213,14 |
urpmi --clean |
# On crée aléatoirement les mots de passe et les secrets partagés |
rm -f $FIC_PASSWD |
grubpwd=`cat /dev/urandom | tr -dc [:alnum:] | head -c8` # mot de passe de protection du menu Grub |
echo -n "mot de passe de protection du menu de démarrage (GRUB) : " > $FIC_PASSWD |
echo "$grubpwd" >> $FIC_PASSWD |
md5_grubpwd=`/usr/bin/md5pass $grubpwd` |
sed -i "/^password.*/d" /boot/grub/menu.lst |
sed -i "1ipassword --md5 $md5_grubpwd" /boot/grub/menu.lst |
mysqlpwd=`cat /dev/urandom | tr -dc [:alnum:] | head -c8` # mot de passe de l'administrateur Mysqld |
echo -n "compte et mot de passe de l'administrateur Mysqld : " > $FIC_PASSWD |
echo -n "compte et mot de passe de l'administrateur Mysqld : " >> $FIC_PASSWD |
echo "root / $mysqlpwd" >> $FIC_PASSWD |
radiuspwd=`cat /dev/urandom | tr -dc [:alnum:] | head -c8` # mot de passe de l'utilisateur Mysqld (utilisé par freeradius) |
echo -n "compte et mot de passe de l'utilisateur Mysqld : " >> $FIC_PASSWD |
943,6 → 949,7 |
$SED "s?^DirData=.*?DirData=\"/var/lib/awstats\"?g" /etc/awstats/awstats.conf # corrige le fichier de config awstats natif ... |
$SED "s?^StyleSheet=.*?StyleSheet=\"/css/style.css\"?g" /etc/awstats/awstats.conf |
$SED "s?^BuildReportFormat=.*?BuildReportFormat=xhtml?g" /etc/awstats/awstats.conf |
$SED "s?^UseFramesWhenCGI=.*?UseFramesWhenCGI=0?g" /etc/awstats/awstats.conf |
cat <<EOF >> /etc/httpd/conf/webapps.d/alcasar.conf |
<Directory $DIR_WEB/awstats> |
SSLRequireSSL |
1142,8 → 1149,15 |
/etc/pki/* root.apache 750 |
EOF |
/usr/sbin/msec |
# modification /etc/inittab |
[ -e /etc/inittab.default ] || cp /etc/inittab /etc/inittab.default |
# On supprime l'interception du "ctrl + alt + del" et on ne garde que 3 terminaux |
$SED "s?^ca.*?#&?g" /etc/inittab |
$SED "s?^4.*?#&?g" /etc/inittab |
$SED "s?^5.*?#&?g" /etc/inittab |
$SED "s?^6.*?#&?g" /etc/inittab |
# on charge la conf d'un version précédente |
if [ "$mode" = "update" ] |
# on charge la conf d'un version précédente |
then |
$DIR_DEST_BIN/alcasar-conf.sh -load |
fi |
/CHANGELOG |
---|
1,6 → 1,10 |
$Id$ |
************ CHANGELOG *********** |
05/04/10 - Réécriture de la procédure d'installation des RPM (téléchargement et test avant install) |
- protection du menu "grub" |
- Fusion menus "services" et "réseau" |
- "page de garde" : simplification + Info sur le filtrage + optimisation |
05/04/10 - "menu.php" : prise en compte version 'actuelle' et 'MAJ" dans la page de menu |
31/03/10 - prise en compte version 'stable' et 'devel" dans la page de garde |
31/03/10 - correction bug (adresse en 0.0.0.0 du menu activité) |
29/03/10 - mise en place des properties svn avec $Revision $Date |
27/03/10 - mise en place des exceptions au filtrage (web + réseau). Correction bug utf8. |
/gestion/intercept.php |
---|
10,7 → 10,7 |
# notice and this permission notice is included in all copies or |
# substantial portions of the software. |
$organisme = ""; |
$organisme = "rexy"; |
# Redirects from CoovaChilli (chilli daemon) : |
# Response to login: |
# success : if login successful |
25,15 → 25,11 |
# Default : it was not a form request |
# Shared secret used to encrypt challenge with radius. |
$uamsecret = ""; |
$uamsecret = "PJSafPdA"; |
# URL loaded after success authenticates (let blank for browser defaults) |
$adminurl = ""; |
# # Uncomment the following line if you want to use ordinary user-password |
# for radius authentication. Must be used together with $uamsecret. |
$userpassword = 1; |
# Our own path |
$loginpath = $_SERVER['PHP_SELF']; |
71,6 → 67,10 |
$R_reply_3 = "You try to connect outside of your allowed timespan"; |
$R_reply_4 = "your account expired"; |
$R_reply_5 = "You have reached the maximum number of simultaneous logins"; |
$R_ca_1 = "How integrate the ALCASAR C.A"; |
$R_ca_2 = "certificate"; |
$R_ca_3 = "in your web browser?"; |
$R_ca_4 = "<help>"; |
} |
else if($Language == 'de'){ |
$R_ChilliError = "Die Authentifizierung ist erfolgreich durch die Nutzung des Portals erfolgt."; |
101,6 → 101,10 |
$R_reply_3 = "You try to connect outside of your allowed timespan"; |
$R_reply_4 = "your account expired"; |
$R_reply_5 = "You have reached the maximum number of simultaneous logins"; |
$R_ca_1 = "How integrate the ALCASAR C.A"; |
$R_ca_2 = "certificate"; |
$R_ca_3 = "in your web browser?"; |
$R_ca_4 = "<help>"; |
} |
else if($Language == 'nl'){ |
$R_ChilliError = "De authenticatie moet een succes worden via de captive portal dienst."; |
131,6 → 135,10 |
$R_reply_3 = "You try to connect outside of your allowed timespan"; |
$R_reply_4 = "your account expired"; |
$R_reply_5 = "You have reached the maximum number of simultaneous logins"; |
$R_ca_1 = "How integrate the ALCASAR C.A"; |
$R_ca_2 = "certificate"; |
$R_ca_3 = "in your web browser?"; |
$R_ca_4 = "<help>"; |
} |
else if($Language == 'en'){ |
$R_ChilliError = "The authentication must be successful through the captive portal service."; |
161,6 → 169,10 |
$R_reply_3 = "You try to connect outside of your allowed timespan"; |
$R_reply_4 = "your account expired"; |
$R_reply_5 = "You have reached the maximum number of simultaneous logins"; |
$R_ca_1 = "Integrate the ALCASAR C.A"; |
$R_ca_2 = "certificate"; |
$R_ca_3 = "in your web browser"; |
$R_ca_4 = "-help-"; |
} |
else{ |
$R_ChilliError = "L'authentification doit être réussie au travers du service du portail captif."; |
191,6 → 203,10 |
$R_reply_3 = "Vous tentez de vous connecter en dehors de votre période autorisée"; |
$R_reply_4 = "Votre compte a expiré"; |
$R_reply_5 = "Vous avez atteint le nombre maximum de connexions simultanées"; |
$R_ca_1 = "Intégrer le "; |
$R_ca_2 = "certificat"; |
$R_ca_3 = "de l'A.C d'ALCASAR dans votre navigateur web"; |
$R_ca_4 = "-aide-"; |
} |
# Make sure that the form parameters are clean |
260,11 → 276,7 |
# If attempt to login |
if ("$button" == "$R_boutonO") { |
$hexchal = pack ("H32", $challenge); |
if ($uamsecret) { |
$newchal = pack ("H*", md5($hexchal . $uamsecret)); |
} else { |
$newchal = $hexchal; |
} |
$newchal = pack ("H*", md5($hexchal . $uamsecret)); |
$response = md5("\0" . $password . $newchal); |
$newpwd = pack("a32", $password); |
$pappassword = implode ("", unpack("H32", ($newpwd ^ $newchal))); |
274,13 → 286,9 |
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"> |
<title>$R_loggingin</title> |
<meta http-equiv=\"Cache-control\" content=\"no-cache\"> |
<meta http-equiv=\"Pragma\" content=\"no-cache\">"; |
if (isset($uamsecret) && isset($userpassword)) { |
echo " <meta http-equiv=\"refresh\" content=\"0;url=http://$uamip:$uamport/logon?username=$username&password=$pappassword&userurl=$userurl\">"; |
} else { |
echo " <meta http-equiv=\"refresh\" content=\"0;url=http://$uamip:$uamport/logon?username=$username&response=$response&userurl=$userurl\">"; |
} |
echo "</head> |
<meta http-equiv=\"Pragma\" content=\"no-cache\"> |
<meta http-equiv=\"refresh\" content=\"0;url=http://$uamip:$uamport/logon?username=$username&password=$pappassword&userurl=$userurl\"> |
</head> |
<body bgColor = 'white'> |
<h1 style=\"text-align: center;\">$R_loggingin</h1> |
<center> |
481,12 → 489,14 |
<td align=\"left\" colspan=\"4\"><b> |
<li> |
$R_loggedin_stringl2</li> |
<li> |
<li> |
$R_loggedin_stringl3</li> |
<li> |
<li> |
$R_loggedin_stringl4</li> |
<li> |
<li> |
$R_loggedin_stringl5</li> |
<hr> |
$R_ca_1 <a href=\"/certs/certificat_alcasar_ca.pem\">$R_ca_2</a> $R_ca_3 <a href=\"/certs/certificat_alcasar_ca.pem\">$R_ca_4</a> |
</b></td> |
</tr> |
</table> |
/gestion/admin/services.php |
---|
File deleted |
/gestion/admin/network.php |
---|
12,12 → 12,20 |
$l_eth0_legend = "Eth0 (Interface connectée à Internet)"; |
$l_eth1_legend = "Eth1 (Réseau de consultation)"; |
$l_internet_legend = "INTERNET"; |
$l_ip_adr = "Adresse IP"; |
$l_ip_mask = "Masque"; |
$l_ip_adr = "Adresse IP"; |
$l_ip_mask = "Masque"; |
$l_ip_router = "Passerelle"; |
$l_ip_public = "Adresse IP public"; |
$l_ip_dns1 = "DNS1"; |
$l_ip_dns2 = "DNS2"; |
$l_ip_dns1 = "DNS1"; |
$l_ip_dns2 = "DNS2"; |
$l_service_title = "Nom du services"; |
$l_service_start = "Démarrer"; |
$l_service_stop = "Arrêter"; |
$l_service_restart = "Redémarrer"; |
$l_service_status = "Status"; |
$l_service_action = "Actions"; |
$l_enable = "actif"; |
$l_disable = "inactif"; |
} else { |
$l_network_title = "Network configuration"; |
$l_network_title1 = "Network configuration managment"; |
24,12 → 32,20 |
$l_eth0_legend = "Eth0 (Internet connected interface)"; |
$l_eth1_legend = "Eth1 (Private network)"; |
$l_internet_legend = "INTERNET"; |
$l_ip_adr = "IP Address"; |
$l_ip_mask = "Mask"; |
$l_ip_adr = "IP Address"; |
$l_ip_mask = "Mask"; |
$l_ip_router = "Router"; |
$l_ip_public = "Public IP address"; |
$l_ip_dns1 = "DNS1 :"; |
$l_ip_dns2 = "DNS2"; |
$l_ip_dns1 = "DNS1 :"; |
$l_ip_dns2 = "DNS2"; |
$l_service_title = "Name of service"; |
$l_service_start = "Start"; |
$l_service_stop = "Stop"; |
$l_service_restart = "Restart"; |
$l_service_status = "Status"; |
$l_service_action = "Actions"; |
$l_enable = "enable"; |
$l_disable = "disable"; |
} |
/******************************************************************** |
61,10 → 77,71 |
exit("Vous n'avez pas les droits de lecture sur le fichier ".ALCASAR_ETH1); |
} |
//fonction pour faire une action (start,stop,restart) sur un service |
function serviceExec($service, $action){ |
if (($action == "start")||($action == "stop")||($action == "restart")){ |
exec("sudo /sbin/service $service $action",$retval, $retstatus); |
return $retstatus; |
} else { |
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) |
function checkServiceStatus($service, $strMatch){ |
$response = false; |
exec("sudo /sbin/service $service status",$retval); |
foreach( $retval as $val ) { |
if (strpos($val,$strMatch)){ |
$response = true; |
break; |
} |
} |
return $response; |
} |
//------------------------------- |
// Les actions sur un service |
//------------------------------- |
//sécurité sur les actions à réaliser |
$autorizeService = array("radiusd","chilli","dansguardian","mysqld","squid","named","sshd"); |
$autorizeAction = array("start","stop","restart"); |
if (isset($_GET['service'])&&(in_array($_GET['service'], $autorizeService))) { |
if (isset($_GET['action'])&&(in_array($_GET['action'], $autorizeAction))) { |
$execStatus = serviceExec($_GET['service'], $_GET['action']); |
// execStatus non exploité |
} |
} |
//------------------------------- |
//recherche du status des services |
//------------------------------- |
$serviceStatus = array(); |
$serviceStatus['radiusd'] = checkServiceStatus("radiusd","pid"); |
$serviceStatus['chilli'] = checkServiceStatus("chilli","pid"); |
$serviceStatus['dansguardian'] = checkServiceStatus("dansguardian","pid"); |
$serviceStatus['mysqld'] = checkServiceStatus("mysqld","OK"); |
$serviceStatus['squid'] = checkServiceStatus("squid","pid"); |
$serviceStatus['named'] = checkServiceStatus("named","up"); |
$serviceStatus['sshd'] = checkServiceStatus("sshd","pid"); |
// Fonction de test de connectivité internet |
function internetTest(){ |
$host = "www.google.fr"; |
$port = "80"; |
//var $num; //non utilisé |
//var $error; //non utilisé |
if (! $sock = @fsockopen($host, $port, $num, $error, 5)) { |
return false; |
} else { |
fclose($sock); |
return true; |
} |
} |
/******************************************************************** |
* Lecture du fichier ALCASAR_CHILLI * |
*********************************************************************/ |
//Lecture du fichier ALCASAR_ETH0 |
$ouvre=fopen(ALCASAR_CHILLI,"r"); |
if ($ouvre){ |
while (!feof ($ouvre)) |
83,8 → 160,6 |
/******************************************************************** |
* Lecture du fichier ALCASAR_ETH0 * |
*********************************************************************/ |
//Lecture du fichier ALCASAR_ETH0 |
$ouvre=fopen(ALCASAR_ETH0,"r"); |
if ($ouvre){ |
while (!feof ($ouvre)) |
103,8 → 178,6 |
/******************************************************************** |
* Lecture du fichier ALCASAR_ETH1 * |
*********************************************************************/ |
//Lecture du fichier ALCASAR_ETH1 |
$ouvre=fopen(ALCASAR_ETH1,"r"); |
if ($ouvre){ |
while (!feof ($ouvre)) |
120,14 → 193,6 |
} |
fclose($ouvre); |
/******************************************************************** |
* Recherche IP public * |
*********************************************************************/ |
$IP_PUB = exec ("wget http://checkip.dyndns.org/ -O - -o /dev/null | cut -d: -f 2 | cut -d\< -f 1"); |
/************************ |
* TO DO * |
*************************/ |
136,9 → 201,9 |
//gestion du dhcp (affichage,modification, ajout @static) |
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
<html><!-- written by steweb57 --> |
<html><!-- written by steweb57 / rexy --> |
<head> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
<title><?php echo $l_network_title; ?></title> |
<link rel="stylesheet" href="../css/style.css" type="text/css"> |
</head> |
150,6 → 215,22 |
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1> |
<tr><td valign="middle" align="left"> |
<fieldset> |
<legend><?php echo $l_internet_legend; |
if (InternetTest()){ |
echo " <img src='/images/state_ok.gif'> $l_enable"; |
$IP_PUB = exec ("wget http://checkip.dyndns.org/ -O - -o /dev/null | cut -d: -f 2 | cut -d\< -f 1");} |
else { |
echo " <img src='/images/state_error.gif'> $l_disable"; |
$IP_PUB = "-.-.-.-";} |
?></legend> |
<table> |
<tr><td><?php echo $l_ip_public." : </td><td>".$IP_PUB;?></td></tr> |
<tr><td><?php echo $l_ip_dns1." : </td><td>".$eth0["DNS1"];?></td></tr> |
<tr><td><?php echo $l_ip_dns2." : </td><td>".$eth0["DNS2"];?></td></tr> |
</table> |
</fieldset> |
</td><td> |
<fieldset> |
<legend><?php echo $l_eth0_legend; ?></legend> |
<table> |
<tr><td><?php echo $l_ip_adr." : </td><td>".$eth0["IPADDR"];?></td></tr> |
157,7 → 238,7 |
<tr><td><?php echo $l_ip_router." : </td><td>".$eth0["GATEWAY"];?></td></tr> |
</table> |
</fieldset> |
<br /> |
</td><td> |
<fieldset> |
<legend><?php echo $l_eth1_legend; ?></legend> |
<table> |
165,17 → 246,32 |
<tr><td><?php echo $l_ip_mask." : </td><td>".$eth1["NETMASK"];?></td></tr> |
</table> |
</fieldset> |
<br /> |
<fieldset> |
<legend><?php echo $l_internet_legend; ?></legend> |
<table> |
<tr><td><?php echo $l_ip_public." : </td><td>".$IP_PUB;?></td></tr> |
<tr><td><?php echo $l_ip_dns1." : </td><td>".$eth0["DNS1"];?></td></tr> |
<tr><td><?php echo $l_ip_dns2." : </td><td>".$eth0["DNS2"];?></td></tr> |
</table> |
</fieldset> |
<br /> |
</td></tr> |
</table> |
<table width="100%" border=0 cellspacing=0 cellpadding=0> |
<tr><th><?php echo $l_service_status;?></th><th><?php echo $l_service_title;?></th><th colspan="3"><?php echo $l_service_action;?></th></tr> |
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td><td><img src="/images/pix.gif" width="1" height="2"></td><td><img src="/images/pix.gif" width="1" height="2"></td></tr> |
</table> |
<TABLE width="100%" border=1 cellspacing=0 cellpadding=0> |
<TR align="center"> |
<?php foreach( $serviceStatus as $serviceName => $statusOK ) { ?> |
<tr> |
<?php if ($statusOK) { ?> |
<td><img src="/images/state_ok.gif" width="15" height="15" alt="<?php echo $l_service_status_img_ok; ?>"></td> |
<td><?php echo $serviceName ;?></td> |
<td width="30" align="center">---</td> |
<td width="30" align="center"><a href="services.php?action=stop&service=<?php echo $serviceName;?>"><?php echo $l_service_stop;?></a></td> |
<td width="30" align="center"><a href="services.php?action=restart&service=<?php echo $serviceName;?>"><?php echo $l_service_restart;?></a></td> |
<?php } else { ?> |
<td><img src="/images/state_error.gif" width="15" height="15" alt="<?php echo $l_service_status_img_ko ?>"></td> |
<td><?php echo $serviceName ;?></td> |
<td width="30" align="center"><a href="services.php?action=start&service=<?php echo $serviceName;?>"><?php echo $l_service_start;?></a></td> |
<td width="30" align="center">---</td> |
<td width="30" align="center">---</td> |
<?php } ?> |
</tr> |
<?php } ?> |
</td></tr></table> |
</table> |
</body> |
</html> |
/gestion/admin/activity.php |
---|
73,39 → 73,41 |
exec ('sudo /usr/sbin/chilli_query list|sort -k5 -r', $output); |
while (list(,$ligne) = each($output)){ |
$detail = explode (" ", $ligne); |
$nb_ligne ++; |
echo "<FORM action='activity.php' method=POST>"; |
echo "<TR>"; |
echo "<TD>"; echo $nb_ligne; echo "</TD>"; |
echo "<TD>"; echo $detail[1]; echo "</TD>"; |
echo "<TD>"; echo $detail[0]; echo "</TD>"; |
echo "<TD>"; |
# station authorisée |
if ($detail[4] == "1"){ |
if ($detail[1] != "0.0.0.0"){ |
$nb_ligne ++; |
echo "<FORM action='activity.php' method=POST>"; |
echo "<TR>"; |
echo "<TD>"; echo $nb_ligne; echo "</TD>"; |
echo "<TD>"; echo $detail[1]; echo "</TD>"; |
echo "<TD>"; echo $detail[0]; echo "</TD>"; |
echo "<TD>"; |
# station authorisée |
if ($detail[4] == "1"){ |
# par @MAC |
if ($detail[5] == "-"){ |
echo "$l_mac_allowed</TD><TD> ";} |
if ($detail[5] == "-"){ |
echo "$l_mac_allowed</TD><TD> ";} |
# par usager authentifié |
else { |
echo "<a href=\"/manager/htdocs/user_admin.php?login=$detail[5]\" title=\"Editer l'utilisateur $detail[5]\">$detail[5]</a>"; |
else { |
echo "<a href=\"/manager/htdocs/user_admin.php?login=$detail[5]\" title=\"Editer l'utilisateur $detail[5]\">$detail[5]</a>"; |
echo "</TD>"; |
echo "<TD>"; |
echo "<INPUT type='hidden' name='action' value='mac_unconnect'>"; |
echo "<INPUT type='hidden' name='user' value='$detail[5]'>"; |
echo "<INPUT type='hidden' name='mac_addr' value='$detail[0]'>"; |
echo "<INPUT type=submit value='$l_disconnect'>"; |
} |
} |
# station sans usager connecté |
else { |
echo " "; |
echo "</TD>"; |
echo "<TD>"; |
echo "<INPUT type='hidden' name='action' value='mac_unconnect'>"; |
echo "<INPUT type='hidden' name='user' value='$detail[5]'>"; |
echo "<INPUT type='hidden' name='mac_addr' value='$detail[0]'>"; |
echo "<INPUT type=submit value='$l_disconnect'>"; |
} |
} |
# station sans usager connecté |
else { |
echo " "; |
echo "</TD>"; |
echo "<TD>"; |
echo "<INPUT type='hidden' name='action' value='mac_unconnect'>"; |
echo "<INPUT type='hidden' name='mac_addr' value='$detail[0]'>"; |
echo "<INPUT type='submit' value='$l_dissociate'>"; |
echo "<INPUT type='submit' value='$l_dissociate'>"; |
} |
echo "</TD></TR></FORM>"; |
} |
echo "</TD></TR></FORM>"; |
} |
?> |
</td></tr> |
/gestion/menu.php |
---|
20,9 → 20,8 |
$l_statistics = "STATISTIQUES"; |
$l_backup = "SAUVEGARDES"; |
$l_activity = "Activité"; |
$l_services = "Services"; |
$l_network = "Réseau"; |
$l_ldap = "Ldap"; |
$l_ldap = "Ldap/A.D."; |
$l_access_nb = "Accès au centre"; |
$l_create_user = "Créer usager"; |
$l_edit_user = "Éditer usager"; |
44,9 → 43,8 |
$l_statistics = "STATISTICS"; |
$l_backup = "BACKUPS"; |
$l_activity = "Activity"; |
$l_services = "Services"; |
$l_network = "Network"; |
$l_ldap = "Ldap"; |
$l_ldap = "Ldap/A.D."; |
$l_access_nb = "Access to center"; |
$l_create_user = "Create user"; |
$l_edit_user = "Edit user"; |
/gestion/phpsysinfo/includes/xml/portail.php |
---|
2,7 → 2,7 |
/*************************************************************************** |
* Copyright (C) 2006 by phpSysInfo - A PHP System Information Script * |
* http://phpsysinfo.sourceforge.net/ * |
* * |
* Copyright (C) 2010 by 3abtux & Rexy for ALCASAR * * |
* This program is free software; you can redistribute it and/or modify * |
* it under the terms of the GNU General Public License as published by * |
* the Free Software Foundation; either version 2 of the License, or * |
23,18 → 23,19 |
// xml_utilisateur() |
function utilisateur () { |
function request ($texte) { |
$strResult = 0; |
// Déclaration des paramètres de connexion |
$host = "localhost"; |
$DB_USER = "radius"; |
$DB_RADIUS = "radius"; |
$radiuspwd = "gLMmnOpk"; |
$radiuspwd = "xKosCPLa"; |
// Connexion au serveur |
mysql_connect($host, $DB_USER,$radiuspwd) or die("erreur de connexion au serveur"); |
mysql_select_db($DB_RADIUS) or die("erreur de connexion a la base de donnees"); |
// Creation et envoi de la requete |
$query = "SELECT UserName FROM userinfo"; |
if ($texte = 'user') {$query = "SELECT UserName FROM userinfo";} |
else { $query = "SELECT GroupName FROM radusergroup GROUP BY GroupName";} |
$result = mysql_query($query); |
// Recuperation des resultats |
$strResult = mysql_num_rows($result); |
42,39 → 43,17 |
mysql_close(); |
return $strResult; |
} |
function groupe () { |
$strResult = 0; |
// Déclaration des paramètres de connexion |
$host = "localhost"; |
$DB_USER = "radius"; |
$DB_RADIUS = "radius"; |
$radiuspwd = "gLMmnOpk"; |
// Connexion au serveur |
mysql_connect($host, $DB_USER,$radiuspwd) or die("erreur de connexion au serveur"); |
mysql_select_db($DB_RADIUS) or die("erreur de connexion a la base de donnees"); |
// Creation et envoi de la requete |
$query = "SELECT GroupName FROM radusergroup GROUP BY GroupName"; |
$result = mysql_query($query); |
// Recuperation des resultats |
$strResult = mysql_num_rows($result); |
// Deconnexion de la base de donnees |
mysql_close(); |
return $strResult; |
} |
function xml_portail () { |
global $sysinfo; |
$_text = " <Portail>\n" |
// . " <Utilisateur>" . htmlspecialchars( $sysinfo->utilisateur(), ENT_QUOTES ) . "</Utilisateur>\n" |
. " <Utilisateur>" . htmlspecialchars( utilisateur(), ENT_QUOTES ) . "</Utilisateur>\n" |
. " <Groupe>" . htmlspecialchars( trim( groupe() ), ENT_QUOTES ) . "</Groupe>\n"; |
. " <Utilisateur>" . htmlspecialchars( request('user'), ENT_QUOTES ) . "</Utilisateur>\n" |
. " <Groupe>" . htmlspecialchars( trim( request('group') ), ENT_QUOTES ) . "</Groupe>\n"; |
$_text .= " </Portail>\n"; |
return $_text; |
} |
// Fonction de test de connectivité internet |
function internetTest(){ |
$host = "www.google.fr"; |
89,7 → 68,25 |
return true; |
} |
} |
// Fonction de test du filtrage |
function filtrageTest($file, $search_regex){ |
$pointeur = fopen($file,"r"); |
$result = false; |
if ($pointeur) |
{ |
while (!feof($pointeur)) |
{ |
$ligne = fgets($pointeur); |
if (preg_match($search_regex, $ligne, $r)) |
{ |
$result = true; |
break; |
} |
} |
} |
fclose($pointeur); |
return $result; |
} |
// html_portail() |
function html_portail () { |
global $webpath; |
100,24 → 97,31 |
$handle = fopen ($file_version, "r"); |
$INSTALLEDVERSION = fread ($handle, filesize ($file_version)); |
fclose ($handle); |
$version_stable = dns_get_record("version.alcasar.info",DNS_TXT); |
$AVAILABLEDVERSION = $version_stable[0]['txt']; |
$version_devel = dns_get_record("devel.alcasar.info",DNS_TXT); |
$DEVELVERSION = $version_devel[0]['txt']; |
$file_bl = "/var/www/html/VERSION-BL"; |
$handle = fopen ($file_bl, "r"); |
$VERSIONBL = fread ($handle, filesize ($file_bl)); |
fclose ($handle); |
$nbr_user = utilisateur (); |
$nbr_grp = groupe (); |
$nbr_user = request ('user'); |
$nbr_grp = request ('group'); |
$nbr_user_online = exec ("sudo /usr/sbin/chilli_query list | cut -d\" \" -f5 | grep \"1\" | wc -l"); |
if (filtrageTest("/usr/local/bin/alcasar-iptables.sh", "/^FILTERING=\"yes\"/")){ |
$network_filter_status = $text['enable'];} |
else { $network_filter_status = $text['disable'];} |
if (filtrageTest("/etc/dansguardian/dansguardian.conf","/^reportinglevel = 3/")){ |
$web_filter_status = $text['enable'];} |
else { $web_filter_status = $text['disable'];} |
if (InternetTest()){ |
$internet_status = "<img src='/images/state_ok.gif'>".$text['enable']; |
$version_stable = dns_get_record("version.alcasar.info",DNS_TXT); |
$AVAILABLEDVERSION = $version_stable[0]['txt']; |
$version_devel = dns_get_record("devel.alcasar.info",DNS_TXT); |
$DEVELVERSION = $version_devel[0]['txt']; |
if (InternetTest()){ |
$internet_status = "<img src='/images/state_ok.gif'>".$text['internet_enable']; |
} else { |
$internet_status = "<img src='/images/state_error.gif'>".$text['internet_disable']; |
$internet_status = "<img src='/images/state_error.gif'>".$text['disable']; |
$AVAILABLEDVERSION = "-"; |
$DEVELVERSION = "-"; |
} |
$_text = "<table border=\"0\" width=\"100%\" align=\"center\">\n" |
. " <tr>\n" |
. " <td valign=\"top\"><font size=\"-1\">" . $text['portail-version'] . "</font></td>\n" |
124,14 → 128,10 |
. " <td><font size=\"-1\">" . $INSTALLEDVERSION . "</font></td>\n" |
. " </tr>\n" |
. " <tr>\n" |
. " <td valign=\"top\"><font size=\"-1\">" . $text['portail-stable'] . "</font></td>\n" |
. " <td><font size=\"-1\">" . $AVAILABLEDVERSION . "</font></td>\n" |
. " <td valign=\"top\"><font size=\"-1\">" . $text['portail-disp'] . "</font></td>\n" |
. " <td><font size=\"-1\">" . $AVAILABLEDVERSION . " (stable), " . $DEVELVERSION . " (devel)</font></td>\n" |
. " </tr>\n" |
. " <tr>\n" |
. " <td valign=\"top\"><font size=\"-1\">" . $text['portail-devel'] . "</font></td>\n" |
. " <td><font size=\"-1\">" . $DEVELVERSION . "</font></td>\n" |
. " </tr>\n" |
. " <tr>\n" |
. " <td valign=\"top\"><font size=\"-1\">" . $text['utilisateur'] . "</font></td>\n" |
. " <td><font size=\"-1\">" . $nbr_user_online . " / " . $nbr_user . "</font></td>\n" |
. " </tr>\n" |
144,14 → 144,14 |
. " <td><font size=\"-1\">" . $VERSIONBL . "</font></td>\n" |
. " </tr>\n" |
. " <tr>\n" |
. " <td valign=\"top\"><font size=\"-1\">" . $text['filter'] . "</font></td>\n" |
. " <td><font size=\"-1\">web : " . $web_filter_status . ", " . $text['network'] . " : " . $network_filter_status . "</font></td>\n" |
. " </tr>\n" |
. " <tr>\n" |
. " <td valign=\"top\"><font size=\"-1\">" . $text['internet_link'] . "</font></td>\n" |
. " <td><font size=\"-1\">" . $internet_status . "</font></td>\n" |
. " </tr>\n" |
. " <tr>\n" |
. " <td valign=\"top\" colspan=\"2\"><font size=\"-1\"><a href=\"/certs/certificat_alcasar_ca.pem\">" . $text['ca'] . "</a></font></td>\n" |
. " </tr>\n" |
. "</table>\n"; |
return $_text; |
} |
/gestion/phpsysinfo/includes/xml/vitals.php |
---|
71,11 → 71,11 |
. " <td valign=\"top\"><font size=\"-1\">" . $text['hostname'] . "</font></td>\n" |
. " <td><font size=\"-1\">" . $XPath->getData( "/phpsysinfo/Vitals/Hostname" ) . "</font></td>\n" |
. " </tr>\n" |
// . " <tr>\n" |
// . " <td valign=\"top\"><font size=\"-1\">" . $text['ip'] . "</font></td>\n" |
// . " <td><font size=\"-1\">" . $XPath->getData( "/phpsysinfo/Vitals/IPAddr" ) . "</font></td>\n" |
// . " </tr>\n" |
. " <tr>\n" |
. " <td valign=\"top\"><font size=\"-1\">" . $text['ip'] . "</font></td>\n" |
. " <td><font size=\"-1\">" . $XPath->getData( "/phpsysinfo/Vitals/IPAddr" ) . "</font></td>\n" |
. " </tr>\n" |
. " <tr>\n" |
. " <td valign=\"top\"><font size=\"-1\">" . $text['kversion'] . "</font></td>\n" |
. " <td><font size=\"-1\">" . $XPath->getData( "/phpsysinfo/Vitals/Kernel" ) . "</font></td>\n" |
. " </tr>\n" |
/gestion/phpsysinfo/includes/lang/fr.php |
---|
45,15 → 45,15 |
// |
$text['portail'] = 'Informations générales du portail ALCASAR'; |
$text['portail-version']= 'Version installée'; |
$text['portail-stable'] = 'Version stable disponible'; |
$text['portail-devel'] = 'Version devel disponible'; |
$text['portail-disp'] = 'Versions disponibles'; |
$text['utilisateur'] = 'Usager(s) en ligne'; |
$text['groupe'] = 'Nombre de groupe(s)'; |
$text['bl-version'] = 'Liste noire'; |
$text['ca'] = 'Certificat de l\'Autorité de Certification (A.C.)'; |
$text['internet_link'] = "Lien Internet"; |
$text['internet_enable'] = "actif"; |
$text['internet_disable'] = "inactif"; |
$text['enable'] = "actif"; |
$text['disable'] = "inactif"; |
$text['filter'] = "filtrage"; |
$text['network'] = "réseau"; |
// |
$text['netusage'] = 'Réseau'; |
/gestion/phpsysinfo/includes/lang/en.php |
---|
45,15 → 45,15 |
// |
$text['portail'] = 'General Informations about ALCASAR portal'; |
$text['portail-version']= 'Installed version'; |
$text['portail-stable'] = 'Stable version available'; |
$text['portail-devel'] = 'Devel version available'; |
$text['portail-disp'] = 'Available versions'; |
$text['utilisateur'] = 'logged user(s)'; |
$text['groupe'] = 'Number of group(s)'; |
$text['bl-version'] = 'Updated \'Blacklist\''; |
$text['ca'] = 'Authenticated Authority certificate (A.C.)'; |
$text['internet_link'] = "Internet connexion"; |
$text['internet_enable'] = "enable"; |
$text['internet_disable'] = "disable"; |
$text['enable'] = "enable"; |
$text['disable'] = "disable"; |
$text['filter'] = "filter"; |
$text['network'] = "network"; |
// |
$text['netusage'] = 'Network Usage'; |
/gestion/system.php |
---|
1,12 → 1,10 |
<? |
$select[0]=$l_activity; |
$select[1]=$l_services; |
$select[2]=$l_network; |
$select[3]=$l_ldap; |
$select[1]=$l_network; |
$select[2]=$l_ldap; |
$fich[0]="admin/activity.php"; |
$fich[1]="admin/services.php"; |
$fich[2]="admin/network.php"; |
$fich[3]="admin/ldap.php"; |
$fich[1]="admin/network.php"; |
$fich[2]="admin/ldap.php"; |
$j=0; |
$nb=count($select); |
while ($j != $nb) |