Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 1707 → Rev 1710

/web/acc/admin/network.php
2,9 → 2,8
/* written by steweb57 & Rexy */
 
/********************
* TEST CONF FILES *
* CONF FILES EXIST *
*********************/
//define ("ALCASAR_CHILLI", "/etc/chilli.conf");
define ("CONF_FILE", "/usr/local/etc/alcasar.conf");
define ("ETHERS_FILE", "/usr/local/etc/alcasar-ethers");
$conf_files=array(CONF_FILE,ETHERS_FILE);
80,7 → 79,7
{
$tab=file(ETHERS_FILE);
$insert="True";
if ($tab) # le fichier n'est pas vide
if ($tab) # the file isn't empty
{
foreach ($tab as $line) # verify that MAC or IP addresses doesn't exist
{
138,8 → 137,8
function internetTest(){
$host = "www.google.fr"; # Google Test
$port = "80";
//var $num; //non utilisé
//var $error; //non utilisé
//var $num; //not used
//var $error; //not used
if (! $sock = @fsockopen($host, $port, $num, $error, 5)) {
return false;
148,24 → 147,6
return true;
}
}
/********************************************************
* Lecture du fichier ALCASAR_CHILLI *
* (not need any more) *
*********************************************************/
//$ouvre=fopen(ALCASAR_CHILLI,"r");
//if ($ouvre){
// while (!feof ($ouvre))
// {
// $tampon = fgets($ouvre, 4096);
// if (strpos($tampon,"=")!==false){
// $tmp = explode("=",$tampon);
// $chilli[$tmp[0]] = $tmp[1];
// }
// }
//}else{
// exit("Erreur d'ouverture du fichier ".ALCASAR_CHILLI);
//}
//fclose($ouvre);
 
/***********************************
* Read ALCASAR_CONF_FILE *
269,6 → 250,62
echo "</td></tr>";
if (strncmp($conf["DHCP"],"on",2) == 0) { require ('network2.php');}
else { echo "</TABLE>"; }
$maxsize=100000;
?>
 
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><th>Import de certificat</th></tr>
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
</table>
<table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr><td>
<form method="post" action="network.php" enctype="multipart/form-data">
Clé privée (.key): <input type="file" name="key"/><br/>
Certificat (.crt):<input type="file" name="crt"/><br/>
Server-chain (Recommandé : .crt):<input type="file" name="sc"/>
<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $maxsize ?>" /><br/>
<input type="submit" value="Valider"/>
</form>
</td><td>
<form method="post" action="network.php">
<input type="hidden" name="default"/>
<input type="submit" value="Retourner aux certificats par défaut"/>
</form>
</td>
</tr>
</table>
 
</body>
</html>
 
<?php
if(isset($_POST['default'])){
echo "Retour au certificats par défaut";
exec("sudo alcasar-defaultcert.sh");
}
if(isset($_POST['MAX_FILE_SIZE'])){
echo "changement";
$maxsize = 100000;
if(isset($_FILES['key']) && isset($_FILES['crt']) && $_FILES['key']['error'] == 0 && $_FILES['crt']['error'] == 0){
$dest = "/tmp/";
if($_FILES['key']['size'] <= $maxsize && $_FILES['crt']['size'] <= $maxsize)
{
if(pathinfo($_FILES['key']['name'])['extension'] == 'key' && pathinfo($_FILES['crt']['name'])['extension'] == 'crt')
{
$scpath = "";
if(isset($_FILES['sc']) && pathinfo($_FILES['sc']['name'])['extension'] == 'crt')
{
$scpath = $dest."server-chain.crt";
move_uploaded_file($_FILES['key']['tmp_name'], $scpath);
}
$keypath = $dest."alcasar.key";
$crtpath = $dest."alcasar.crt";
move_uploaded_file($_FILES['key']['tmp_name'], $keypath);
move_uploaded_file($_FILES['crt']['tmp_name'], $crtpath);
exec("sudo alcasar-importcert.sh -i $crtpath -k $keypath -c $scpath");
}
}
}
}
?>