Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 1821 → Rev 1822

/scripts/alcasar-iptables.sh
63,7 → 63,7
ipset save havp_bl_set >> $TMP_users_set_save
ipset save havp_wl_set >> $TMP_users_set_save
ipset save user_not_connected_yet >> $TMP_users_set_save
ipset save ipset_users >> $TMP_users_set_save
ipset save ipset_users_list >> $TMP_users_set_save
fi
 
# loading of NetFlow probe (ipt_NETFLOW kernel module)
/web/acc/admin/network.php
7,6 → 7,9
define ("CONF_FILE", "/usr/local/etc/alcasar.conf");
define ("ETHERS_FILE", "/usr/local/etc/alcasar-ethers");
$conf_files=array(CONF_FILE,ETHERS_FILE);
$reg_ip = '/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/';
$reg_ip_cidr = '/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$/';
$network_modification=0;
foreach ($conf_files as $file){
if (!file_exists($file)){
exit("Requested file ".$file." isn't present");}
14,6 → 17,7
exit("Can't read the file ".$file);}
}
 
 
# Choice of language
$Language = 'en';
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
164,10 → 168,13
return true;
}
}
/***********************************
* Update ALCASAR_CONF_FILE *
***********************************/
 
/***********************************
* Read ALCASAR_CONF_FILE *
************************************/
/*******************************************
* Read ALCASAR_CONF_FILE Before *
********************************************/
$ouvre=fopen(CONF_FILE,"r");
if ($ouvre){
while (!feof ($ouvre))
180,7 → 187,61
}
fclose($ouvre);
}
if(isset($_POST['dns1']) && preg_match($reg_ip,$_POST['dns1']))
{
file_put_contents(CONF_FILE, str_replace('DNS1='.$conf['DNS1'],'DNS1='.$_POST['dns1']."\n",file_get_contents(CONF_FILE)));
$network_modification=1;
}
if(isset($_POST['dns2']) && preg_match($reg_ip,$_POST['dns2']))
{
file_put_contents(CONF_FILE, str_replace('DNS2='.$conf['DNS2'],'DNS2='.$_POST['dns2']."\n",file_get_contents(CONF_FILE)));
$network_modification=1;
}
 
if(isset($_POST['ip_public']) && preg_match($reg_ip_cidr,$_POST['ip_public']))
{
file_put_contents(CONF_FILE, str_replace('PUBLIC_IP='.$conf['PUBLIC_IP'],'PUBLIC_IP='.$_POST['ip_public']."\n",file_get_contents(CONF_FILE)));
$network_modification=1;
}
 
if(isset($_POST['ip_gw']) && preg_match($reg_ip,$_POST['ip_gw']))
{
file_put_contents(CONF_FILE, str_replace('GW='.$conf['GW'],'GW='.$_POST['ip_gw']."\n",file_get_contents(CONF_FILE)));
$network_modification=1;
}
 
if(isset($_POST['ip_private']) && preg_match($reg_ip_cidr,$_POST['ip_private']))
{
file_put_contents(CONF_FILE, str_replace('PRIVATE_IP='.$conf['PRIVATE_IP'],'PRIVATE_IP='.$_POST['ip_private']."\n",file_get_contents(CONF_FILE)));
$network_modification=1;
}
if($network_modification)
{
exec("sudo /usr/local/bin/alcasar-conf.sh -apply");
}
 
 
 
 
/*******************************************
* Read ALCASAR_CONF_FILE Updated *
********************************************/
$ouvre=fopen(CONF_FILE,"r");
if ($ouvre){
while (!feof ($ouvre))
{
$tampon = fgets($ouvre, 4096);
if (strpos($tampon,"=")!==false){
$tmp = explode("=",$tampon);
$conf[$tmp[0]] = $tmp[1];
}
}
fclose($ouvre);
}
 
/************************
* TO DO *
*************************/
207,6 → 268,8
}
</script>
</head>
 
 
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><th><?php echo $l_network_title; ?></th></tr>
225,8 → 288,11
?></legend>
<table>
<tr><td><?php echo $l_ip_public." : </td><td>".$IP_PUB;?></td></tr>
<tr><td><?php echo $l_ip_dns1." : </td><td>".$conf["DNS1"];?></td></tr>
<tr><td><?php echo $l_ip_dns2." : </td><td>".$conf["DNS2"];?></td></tr>
<?php
echo "<form action=".$_SERVER['PHP_SELF']." method='post'>";
echo "<tr><td>".$l_ip_dns1." <input style='width:120px' type='text' name='dns1' value=".$conf["DNS1"]."/></td></tr>";
echo "<tr><td>".$l_ip_dns2." <input style='width:120px' type='text' name='dns2' value=".$conf["DNS2"]."/></td></tr>";
?>
</table>
</fieldset>
</td><td>
233,8 → 299,11
<fieldset>
<legend><?php echo $conf["EXTIF"].$l_extif_legend; ?></legend>
<table>
<tr><td><?php echo $l_ip_adr." : </td><td>".$conf["PUBLIC_IP"];?></td></tr>
<tr><td><?php echo $l_ip_router." : </td><td>".$conf["GW"];?></td></tr>
<?php
echo "<form action=".$_SERVER['PHP_SELF']." method='post'>";
echo "<tr><td>".$l_ip_adr." <input style='width:150px' type='text' name='ip_public' value=".$conf['PUBLIC_IP']."/></td></tr>";
echo "<tr><td>".$l_ip_router." <input style='width:120px' type='text' name='ip_gw' value=".$conf['GW']."/></td></tr>";
?>
</table>
</fieldset>
</td><td>
241,11 → 310,19
<fieldset>
<legend><?php echo $conf["INTIF"].$l_intif_legend; ?></legend>
<table>
<tr><td><?php echo $l_ip_adr." : </td><td>".$conf["PRIVATE_IP"];?></td></tr>
<?php
echo "<form action=".$_SERVER['PHP_SELF']." method='post'>";
echo "<tr><td>".$l_ip_adr."</td><td> <input style='width:150px' type='text' name='ip_private' value=".$conf['PRIVATE_IP']." /></td></tr>";
?>
</table>
</fieldset>
</td></tr>
<?php
echo "<td><input type='submit' value='$l_apply' disabled></td>";
echo "</form>";
?>
</table>
 
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><th><?php echo $l_dhcp_title;?></th></tr>
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
/web/acc/admin/update_ldap.php
127,10 → 127,10
 
if ($auth_enable == "1"){
file_put_contents(ALCASAR_CONF_FILE, str_replace('LDAP=off', 'LDAP=on', file_get_contents(ALCASAR_CONF_FILE)));
exec("sed -i \"s/^LDAP_IP=.*/LDAP_IP=$ldap_server/g\" ALCASAR_CONF_FILE");}
exec("sudo sed -i \"s/^LDAP_IP=.*/LDAP_IP=$ldap_server/g\" ALCASAR_CONF_FILE");}
else {
file_put_contents(ALCASAR_CONF_FILE, str_replace('LDAP=on', 'LDAP=off', file_get_contents(ALCASAR_CONF_FILE)));
exec("sed -i \"s/^LDAP_IP=.*/LDAP_IP=0.0.0.0/g\" ALCASAR_CONF_FILE");}
exec("sudo sed -i \"s/^LDAP_IP=.*/LDAP_IP=0.0.0.0/g\" ALCASAR_CONF_FILE");}
exec ("sudo /usr/local/bin/alcasar-iptables.sh");
exec ("sudo /usr/bin/systemctl restart radiusd");
 
/web/index.php
102,13 → 102,13
}
else
{
# cas où l'utilisateur non-loggué décide de joindre une page HTTP/S => redirection index.php&url=URL
# ALCASAR => redirection index.php
# cas où l'utilisateur non-loggué décide de joindre une page HTTP/S => redirection http://URL
# ALCASAR => redirection index.php
# on place l'IP de l'utilisateur dans un ipset user_not_connected pour ne pas boucler
exec("sudo /usr/sbin/ipset add user_not_connected_yet $remote_ip");
if(!$direct_access)
{
header("Location: http://alcasar?url=".$_SERVER['HTTP_HOST']);
header("Location: http://".$_SERVER['HTTP_HOST']);
exit;
}
139,14 → 139,8
$l_category = "catégorie :";
if ((isset ($user[4])) && ($user[4] == "0")) {
$l_logout_explain = "Aucune session de consultation Internet n'est actuellement ouverte sur votre syst&egrave;me.";
if(isset($_GET["url"]))
{
$l_logout = "<a href=\"http://".$_GET["url"]."\">Ouvrir une session Internet</a>";
}
else
{
$l_logout = "<a href=\"http://www.google.com\">Ouvrir une session Internet</a>";
}
$l_logout = "<a href=\"http://www.google.com\">Ouvrir une session Internet</a>";
 
}
else {
188,14 → 182,8
$l_category = "categoria :";
if ((isset ($user[4])) && ($user[4] == "0")) {
$l_logout_explain = "Não há conexão de Internet aberta em seu computador, deseja conectar?";
if(isset($_GET["url"]))
{
$l_logout = "<a href=\"http://".$_GET["url"]."\">Abrir uma conexão de Internet</a>";
}
else
{
$l_logout = "<a href=\"http://www.google.com\">Abrir uma conexão de Internet</a>";
}
$l_logout = "<a href=\"http://www.google.com\">Abrir uma conexão de Internet</a>";
 
}
else {
237,14 → 225,8
$l_category = "category :";
if ((isset ($user[4])) && ($user[4] == "0")) {
$l_logout_explain = "No Internet consultation session is actualy open on your system";
if(isset($_GET["url"]))
{
$l_logout = "<a href=\"http://".$_GET["url"]."\">Open an Internet session</a>";
}
else
{
$l_logout = "<a href=\"http://www.google.com\">Open an Internet session</a>";
}
$l_logout = "<a href=\"http://www.google.com\">Open an Internet session</a>";
 
}
else {
421,4 → 403,4
</div>
</div>
</body>
</html>
</html>