Subversion Repositories ALCASAR

Rev

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

Rev Author Line No. Line
452 richard 1
<?php
2
$private_ip = "192.168.182.1";
498 richard 3
$hostname = "alcasar";
360 richard 4
$network_pb = False;
509 richard 5
$cert_add = "http://alcasar/certs";
6
 
360 richard 7
$direct_access = False;
363 richard 8
$diagnostic = "eth0 link down";
9
$remote_ip = ($_SERVER['REMOTE_ADDR']);
10
$tab = array();$user = array();
11
exec ("sudo /usr/sbin/chilli_query list|grep $remote_ip" , $tab);
12
$user = explode (" ", $tab[0]);
360 richard 13
# on discrimine les accès directs sur Alcasar par rapport aux redirections
498 richard 14
if (($_SERVER['HTTP_HOST'] == $private_ip) || ($_SERVER['HTTP_HOST'] == "alcasar")  || ($_SERVER['HTTP_HOST'] == $hostname)){$direct_access=True;}
509 richard 15
 
16
#### Connexion  DB à faire !
17
#### Avec retour 3 dernière connexion de $user[5]
18
$result_user =  "3 derni&egrave;res connexions :";
19
 
20
####
21
 
22
 
360 richard 23
# Choice of language
24
$Language = 'en';
25
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
26
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
27
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
28
if($Language == 'fr'){
29
  $l_access_denied = "ACC&Egrave;S REFUS&Eacute;";
399 franck 30
  $l_access_welcome = "Bienvenue sur ALCASAR";
360 richard 31
  $l_access_unavailable = "ACC&Egrave;S INDISPONIBLE";
32
  $l_required_domain = "Site WEB demand&eacute;";
369 richard 33
  $l_explain_acc_access = "Ce centre permet d'administrer le portail. Vous devez poss&eacute;der un compte d'administration.";
360 richard 34
  $l_explain_access_deny = "Vous tentez d'acc&eacute;der &agrave; une ressource dont le contenu est r&eacute;put&eacute; contenir des informations inappropri&eacute;es.";
35
  $l_explain_net_pb = "Votre portail d&eacute;tecte que l'acc&egrave;s &agrave; Internet est indisponible.";
36
  $l_contact_access_deny = "Contactez le responsable de la s&eacute;curit&eacute; (OSSI/RSSI) si vous pensez que ce filtrage est abusif.";
509 richard 37
  $l_contact_net_pb = "Contactez votre responsable informatique ou votre prestataire Internet pour plus d'information.";
399 franck 38
  $l_welcome = "Page principale de votre portail captif";
509 richard 39
  $l_acc_access = "<a href=\"https://$hostname/acc\">Acc&egrave;s au centre de gestion</A>";
40
  $l_install_certif = "<a href=\"$cert_add/certificat_alcasar_ca.crt\">Installer le certificat racine</A>";
41
  $l_install_certif_more = "<a href=\"$cert_add/certificat_alcasar_ca.crt\">Installation du certificat de l'autorit&eacute; racine d'ALCASAR</A>";
42
  $l_certif_explain = "Permet l'&eacute;change de donn&eacute;es s&eacute;curis&eacute;es entre voter station de consultation et le portail captif ALCASAR.<BR>Si ce certificat n'est pas enregistr&eacute; sur votre station de consultation il est possible que des alertes de s&eacute;curit&eacute;s soient &eacute;mises par votre navigateur.<br><br>";
43
  $l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">Aide pour les certificats</a>";
369 richard 44
  if ($user[4] == "0") {
509 richard 45
	  $l_logout_explain = "Aucune session de consultation Internet n'est actuellement ouverte sur votre syst&egrave;me.";
369 richard 46
	  $l_logout = "<a href=\"http://www.google.fr\">Ouvrir une session Internet</A>";}
47
  else {
509 richard 48
	  $l_logout_explain = "Ferme la session de l'usager actuellement connect&eacute;. <br><br>Utilisateur connect&eacute; :<br><br><a href=\"http://$hostname:3990/logoff\" title=\"Deconnecter l'utilisateur $user[5]\"><b>$user[5]</b></a><br><br>$result_user";
49
	  $l_logout = "<a href=\"http://$hostname:3990/logoff\">Se d&eacute;connecter d'internet</A>";}
498 richard 50
  $l_password_change = "<a href=\"https://$hostname/pass\">Changer votre mot de passe</A>";
509 richard 51
  $l_password_change_explain = "Vous redirige sur la pages de changement du mot de passe de votre compte d'acc&egrave;s &agrave; internet.<br><br>Vous devez avoir un compte internet valide.";
360 richard 52
  $l_back_page = "<a href=\"javascript:history.back()\">Page pr&eacute;c&eacute;dente</a>";
53
}
54
else {
55
  $l_access_denied = "ACCESS DENIED";
369 richard 56
  $l_access_welcome = "Welcome on ALCASAR";
360 richard 57
  $l_access_unavailable = "ACCESS UNAVAILABLE";
58
  $l_required_domain = "Required WEB site";
369 richard 59
  $l_explain_acc_access = "This center control the portal. You must have an administrative account.";
360 richard 60
  $l_explain_access_deny = "Your portal has just detected that the Internet access is down";
61
  $l_explain_net_pb = "Your portal has just detected that the Internet access is down";
62
  $l_contact_access_deny = "Contact your security system manager if you think this filtering is abusive.";
63
  $l_contact_net_pb = "Contact your network responsive or your Internet provider for more information";
369 richard 64
  $l_welcome = "Your captive portal main page";
509 richard 65
  $l_acc_access = "<a href=\"https://$hostname/acc\">ALCASAR Control Center</A>";
66
  $l_install_certif = "<a href=\"$cert_add/certificate_alcasar_ca.crt\">Install ALCASAR AC Certificate</A>";
67
  $l_install_certif_more = "<a href=\"$cert_add/certificat_alcasar_ca.cert\">Install ALCASAR AC Certificate</A>";
68
  $l_certif_explain = "A TRADUIRE<br><br>";
69
  $l_certif_explain_help = "<a href=\"alcasar-certificat.pdf\" target=\"_blank\">Help for ALCASAR certificate</a>";
70
if ($user[4] == "0") {
369 richard 71
	  $l_logout_explain = "No Internet consultation session is actualy open on your system";
72
	  $l_logout = "<a href=\"http://www.google.fr\">Open an Internet session</A>";}
73
  else {
509 richard 74
	  $l_logout_explain = "Close the session of the user actualy connecterd.<br> User logged-on :<br><br><a href=\"http://$hostname:3990/logoff\" title=\"Disconnect user $user[5]\"><b>$user[5]</b></a><br><br>$result_user";
75
	  $l_logout = "<a href=\"http://$hostname:3990/logoff\">Logoff from internet</A>";}
498 richard 76
  $l_password_change = "<a href=\"https://$hostname/pass\">Change your password</A>";
509 richard 77
  $l_password_change_explain = "Ridirect you on password change page.<br><br> You should already have an Internet access account.";
360 richard 78
  $l_back_page = "<a href=\"javascript:history.back()\">Previous page</a>";
79
}
369 richard 80
$l_title = ($direct_access ? $l_access_welcome : ($network_pb ? $l_access_unavailable : $l_access_denied));
360 richard 81
$l_explain = ($direct_access ? $l_explain_acc_access : ($network_pb ? $l_explain_net_pb : $l_explain_access_deny));
509 richard 82
 
83
# Attribution des icones / images
84
$img_rep = "images/";
85
$img_organisme = "organisme.png";
86
$img_access = "globe_acces_70.png";
87
$img_connect = "globe_70.png";
88
$img_warning = "globe_warning_70.png";
89
$img_pwd = "cle_ombre.png";
90
$img_certificate = "certificat.png";
91
$img_acc = "logo-alcasar_70.png";
92
$img_false = "interdit.png";
93
$img_internet = $img_connect;
94
 
95
if ($user[4] == "0") {
96
	if (! $network_pb) {
97
		$img_internet = $img_access;
98
		}
99
		else {
100
		$img_internet = $img_warning;
101
	}
102
}
103
else {
104
	$img_internet = $img_connect;
105
}
106
 
107
 
452 richard 108
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
109
echo "<html><head><title>ALCASAR - $l_title";
360 richard 110
?>
111
	</title>
112
	<LINK rel=stylesheet type=text/css href="css/style_intercept.css">
509 richard 113
	<script>
114
		function valoriserDiv5(param){
115
			document.getElementById("box_info").innerHTML = param.innerHTML;
116
		}
117
	</script>
360 richard 118
</head>
119
 
509 richard 120
	<BODY onload="valoriserDiv5(text_conn);">
121
<?php
360 richard 122
if ($direct_access){
123
	echo "
124
		<DIV id=\"cadre_titre\" class=\"titre_controle\">
125
			<P id=\"acces_controle\" class=\"titre_controle\">$l_title</P>";
509 richard 126
	if ($network_pb) {
127
		echo "	<SPAN>$l_explain_net_pb</SPAN>";
128
		}
360 richard 129
	}
509 richard 130
	else {
131
		echo"
132
			<DIV id=\"cadre_titre\" class=\"titre_refus\">
133
				<P id=\"acces_controle\" class=\"titre_refus\">$l_title</P>";
363 richard 134
	}
360 richard 135
?>
136
			<DIV id="boite_logo">
137
				<IMG src="images/organisme.png">
138
			</DIV>
139
		</DIV>
140
		<DIV id="contenu_acces">
141
			<DIV id="box_url">
509 richard 142
				<?php if (! $direct_access){echo "$l_required_domain : $_SERVER[HTTP_HOST]";}?>
360 richard 143
			</DIV>
509 richard 144
<?php
145
if ($direct_access){
369 richard 146
	echo "	<DIV id=\"box_bienvenue\">
360 richard 147
				$l_welcome
148
			</DIV>
509 richard 149
			<DIV class=\"box_menu\" id=\"box_conn\" onmouseover=\"valoriserDiv5(text_conn);\">
150
				<SPAN>$l_logout</SPAN>
151
				<IMG src=\"$img_rep$img_internet\">
152
			</DIV>
153
			<DIV class=\"box_menu\" id=\"box_certif\" onmouseover=\"valoriserDiv5(text_certif);\">
154
				<SPAN>$l_install_certif</SPAN>
155
				<IMG src=\"$img_rep$img_certificate\">
156
			</DIV>
157
 
158
			<DIV class=\"box_menu\" id=\"box_mdp\" onmouseover=\"valoriserDiv5(text_mdp);\">
159
				<IMG src=\"$img_rep$img_pwd\">
360 richard 160
				<SPAN>$l_password_change</SPAN>
509 richard 161
			</DIV>
162
			<DIV class=\"box_menu\" id=\"box_acc\" onmouseover=\"valoriserDiv5(text_acc);\">
163
				<SPAN>$l_acc_access</SPAN>
164
				<IMG src=\"$img_rep$img_acc\">
165
			</DIV>
166
			<DIV class=\"div-cache\" id=\"text_conn\">
167
				<H2>$l_logout</H2>
168
				<P>$l_logout_explain</P>
169
				<IMG src=\"$img_rep$img_internet\">
170
			</DIV>
171
			<DIV class=\"div-cache\" id=\"text_certif\">
172
				<H2>$l_install_certif_more</H2>
173
				<P>$l_certif_explain $l_certif_explain_help</P>
174
				<IMG src=\"$img_rep$img_certificate\">
175
			</DIV>
176
			<DIV class=\"div-cache\" id=\"text_mdp\">
177
				<H2>$l_password_change</H2>
360 richard 178
				<P>$l_password_change_explain</P>
509 richard 179
				<IMG src=\"$img_rep$img_pwd\">
180
			</DIV>
181
			<DIV class=\"div-cache\" id=\"text_acc\">
182
				<H2>$l_acc_access</H2>
183
				<P>$l_explain</P>
184
				<IMG src=\"$img_rep$img_acc\">
185
			</DIV>
186
			<DIV id=\"box_info\">
369 richard 187
			</DIV>";
509 richard 188
	}
189
	else {
190
		echo "
360 richard 191
			<DIV id=\"box_refuse\">
509 richard 192
				<img src=\"$img_rep$img_false\">
360 richard 193
				<P>$l_explain</P>
194
			</DIV>
195
			<DIV id=\"liens_redir\">
196
				<P>$l_back_page</P>
509 richard 197
			</DIV>";
198
		}
199
	if (($network_pb)&&(! $direct_access)) {
200
	echo "	<SPAN>Diagnostic : $diagnostic</SPAN>";
201
	}
202
 
363 richard 203
?>
360 richard 204
		</DIV>
205
	</BODY>
206
</html>