Subversion Repositories ALCASAR

Rev

Rev 841 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
318 richard 1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2
<HTML><!-- written by Rexy - 3abtux -->
3
<HEAD>
4
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
<TITLE>Exceptions</TITLE>
6
<link rel="stylesheet" href="/css/style.css" type="text/css">
7
</HEAD>
8
<body>
9
<?
504 richard 10
$mac_allowed_list="/usr/local/etc/alcasar-macallowed";
606 richard 11
$domain_allowed_list="/usr/local/etc/alcasar-uamdomain";
12
$url_allowed_list="/usr/local/etc/alcasar-uamallowed";
318 richard 13
# Choice of language
14
$Language = 'en';
15
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
16
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
17
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
18
if($Language == 'fr'){
498 richard 19
  $l_error_open_file = "Erreur d'ouverture du fichier";
868 richard 20
  $l_trusted_sites = "Noms de domaine et adresses IP Internet de confiance";
21
  $l_trusted_sites_explain1 = "Entrez ici les noms de domaine ou les adresses IP situés sur Internet pouvant &ecirc;tre joints sans authentification";
688 richard 22
  $l_trusted_sites_explain2 = "Entrez un nom de domaine ou une adresse IP par ligne";
868 richard 23
  $l_trusted_sites_list = "Liste des noms de domaine de confiance";
688 richard 24
  $l_trusted_urls_list = "Liste d'adresses IP ou d'adresses de réseau de confiance";
318 richard 25
  $l_submit = "Enregistrer";
26
}
27
else {
498 richard 28
  $l_error_open_file = "File open error";
868 richard 29
  $l_trusted_sites = "Trusted Internet domain names and IP addresses";
30
  $l_trusted_sites_explain1 = "Enter domain names or IP addresses situated on Internet that could be joined without authentication";
688 richard 31
  $l_trusted_sites_explain2 = "Enter one domain name ou one IP address per line";
868 richard 32
  $l_trusted_sites_list = "Trusted Internet domain names list";
688 richard 33
  $l_trusted_urls_list = "Trusted IP addresses or networks addresses list";
318 richard 34
  $l_submit = "Submit";
35
}
36
if (isset($_POST['choix'])){ 
37
	switch ($_POST['choix'])
38
	{
39
	case 'MAJ_UAMALLOWED' :
40
		$tab_domains = explode ("\n", $_POST['trusted_domains']);
606 richard 41
		$fichier=fopen($domain_allowed_list,"w+");
318 richard 42
		foreach ($tab_domains as $domain ){
43
			$tr_domain=trim($domain);
44
			if ($tr_domain != ""){
606 richard 45
				fputs ($fichier, "uamdomain=\"".$tr_domain."\"\n");}
318 richard 46
			}	
47
		fclose($fichier);
48
		unset($_POST['trusted_domains']);
49
		$tab_urls = explode ("\n", $_POST['trusted_urls']);
606 richard 50
		$fichier=fopen($url_allowed_list,"w+");
318 richard 51
		foreach ($tab_urls as $url ){
52
			$tr_url=trim($url);
53
			if ($tr_url != ""){
606 richard 54
				fputs ($fichier, "uamallowed=\"".$tr_url."\"\n");}
318 richard 55
			}
56
		fclose($fichier);
57
		unset($_POST['trusted_urls']);
58
		exec ("sudo service chilli restart");
59
		unset ($_POST['choix']);
60
		break;
61
	}	
62
}
63
?>
64
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
65
	<tr><th><?php echo $l_trusted_sites ;?></th></tr>
66
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
67
</TABLE>
68
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1>
69
	<tr bgcolor="#666666"><td>
70
	<TABLE width="100%" border=0 cellspacing=0 cellpadding=2>
71
		<tr><td valign="middle" align="left">
72
		<center><?php
73
		echo "$l_trusted_sites_explain1 <BR>";
74
		echo "$l_trusted_sites_explain2" ;
75
		echo "<FORM action='$_SERVER[PHP_SELF]' method='POST'>";?>
76
		<TABLE cellspacing=2 cellpadding=3 border=1>
77
		<tr><td width=50% height=100% align=center>
78
			<H3><?php echo $l_trusted_sites_list ;?></H3>
79
			exemple1 : www.domain1.org<BR>
80
			exemple2 : domain2.net<BR>
81
			<?php
82
				echo "<textarea name='trusted_domains' rows=5 cols=40>";
606 richard 83
				$ouvre=fopen($domain_allowed_list,"r");
318 richard 84
				if ($ouvre)
85
					{
86
					while (!feof ($ouvre))
87
						{
88
						$tampon = fgets($ouvre, 4096);
356 richard 89
						$domain_list_l = substr($tampon,10);
90
						$domain_list = trim ($domain_list_l,"\"\n\t ");
346 richard 91
						$tab_domains = explode (",", $domain_list);
318 richard 92
						foreach ($tab_domains as $domain ){
346 richard 93
							if ($domain) { echo $domain."\n";}
318 richard 94
							}
95
		  				}
96
					}
97
				else	{
606 richard 98
					echo "failed to open $domain_allowed_list";
318 richard 99
					}
100
				fclose($ouvre);
101
				echo "</textarea>";
102
			?>
103
		</td>
104
		<td  width=50% height=100% align=center>
105
			<H3><?php echo $l_trusted_urls_list ;?></H3>
688 richard 106
			exemple1 : 192.168.0.10<BR>
107
			exemple2 : 172.16.20.0/24<BR>
318 richard 108
			<?php
109
				echo "<textarea name='trusted_urls' rows=5 cols=40>";
606 richard 110
				$ouvre=fopen($url_allowed_list,"r");
318 richard 111
				if ($ouvre)
112
			       		{
113
					while (!feof ($ouvre))
114
						{
115
						$tampon = fgets($ouvre, 4096);
356 richard 116
						$url_list_l = substr($tampon,11);
117
						$url_list = trim ($url_list_l,"\"\n\t ");
118
						$tab_urls = explode (",", $url_list);
318 richard 119
						foreach ($tab_urls as $url ){
346 richard 120
							if ($url) echo $url."\n";
318 richard 121
							}
122
						}
123
					}
124
				else	{
606 richard 125
					echo "failed to open $url_allowed_list";
318 richard 126
					}
127
				fclose($ouvre);
128
				echo "</textarea>";
129
			?>
130
		</td></tr>
131
		</TABLE>
132
		<input type='hidden' name='choix' value='MAJ_UAMALLOWED'>
133
		<input type='submit' value='<?php echo $l_submit ;?>'>
134
		</FORM>
135
	</td></tr>
136
	</TABLE>
137
</TABLE>
138
</BODY>
139
</HTML>