Subversion Repositories ALCASAR

Rev

Rev 498 | Rev 522 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 498 Rev 509
Line 1... Line 1...
1
<?php
1
<?php
2
$private_ip = "192.168.182.1";
2
$private_ip = "192.168.182.1";
3
$hostname = "alcasar";
3
$hostname = "alcasar";
4
$network_pb = False;
4
$network_pb = False;
-
 
5
$cert_add = "http://alcasar/certs";
-
 
6
 
5
$direct_access = False;
7
$direct_access = False;
6
$diagnostic = "eth0 link down";
8
$diagnostic = "eth0 link down";
7
$remote_ip = ($_SERVER['REMOTE_ADDR']);
9
$remote_ip = ($_SERVER['REMOTE_ADDR']);
8
$tab = array();$user = array();
10
$tab = array();$user = array();
9
exec ("sudo /usr/sbin/chilli_query list|grep $remote_ip" , $tab);
11
exec ("sudo /usr/sbin/chilli_query list|grep $remote_ip" , $tab);
10
$user = explode (" ", $tab[0]);
12
$user = explode (" ", $tab[0]);
11
# on discrimine les accès directs sur Alcasar par rapport aux redirections
13
# on discrimine les accès directs sur Alcasar par rapport aux redirections
12
if (($_SERVER['HTTP_HOST'] == $private_ip) || ($_SERVER['HTTP_HOST'] == "alcasar")  || ($_SERVER['HTTP_HOST'] == $hostname)){$direct_access=True;}
14
if (($_SERVER['HTTP_HOST'] == $private_ip) || ($_SERVER['HTTP_HOST'] == "alcasar")  || ($_SERVER['HTTP_HOST'] == $hostname)){$direct_access=True;}
-
 
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
 
13
# Choice of language
23
# Choice of language
14
$Language = 'en';
24
$Language = 'en';
15
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
25
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
16
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
26
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
17
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
27
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
Line 22... Line 32...
22
  $l_required_domain = "Site WEB demand&eacute;";
32
  $l_required_domain = "Site WEB demand&eacute;";
23
  $l_explain_acc_access = "Ce centre permet d'administrer le portail. Vous devez poss&eacute;der un compte d'administration.";
33
  $l_explain_acc_access = "Ce centre permet d'administrer le portail. Vous devez poss&eacute;der un compte d'administration.";
24
  $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.";
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.";
25
  $l_explain_net_pb = "Votre portail d&eacute;tecte que l'acc&egrave;s &agrave; Internet est indisponible.";
35
  $l_explain_net_pb = "Votre portail d&eacute;tecte que l'acc&egrave;s &agrave; Internet est indisponible.";
26
  $l_contact_access_deny = "Contactez le responsable de la s&eacute;curit&eacute; (OSSI/RSSI) si vous pensez que ce filtrage est abusif.";
36
  $l_contact_access_deny = "Contactez le responsable de la s&eacute;curit&eacute; (OSSI/RSSI) si vous pensez que ce filtrage est abusif.";
27
  $l_contact_net_pb = "Contactez votre responsable informatique ou votre prestataire Internet pour plus d'information";
37
  $l_contact_net_pb = "Contactez votre responsable informatique ou votre prestataire Internet pour plus d'information.";
28
  $l_welcome = "Page principale de votre portail captif";
38
  $l_welcome = "Page principale de votre portail captif";
-
 
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>";
29
  $l_acc_access = "<a href=\"https://$hostname/acc\">Acc&egrave;s au centre de gestion (ALCASAR Control Center)</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>";
30
  if ($user[4] == "0") {
44
  if ($user[4] == "0") {
31
	  $l_logout_explain = "Aucune session de consultation Internet n'est actuellement ouverte sur votre syst&egrave;me";
45
	  $l_logout_explain = "Aucune session de consultation Internet n'est actuellement ouverte sur votre syst&egrave;me.";
32
	  $l_logout = "<a href=\"http://www.google.fr\">Ouvrir une session Internet</A>";}
46
	  $l_logout = "<a href=\"http://www.google.fr\">Ouvrir une session Internet</A>";}
33
  else {
47
  else {
34
	  $l_logout_explain = "Ferme la session de l'usager : <b>$user[5]</b>";
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";
35
	  $l_logout = "<a href=\"http://$hostname:3990/logoff\">D&eacute;connexion</A>";}
49
	  $l_logout = "<a href=\"http://$hostname:3990/logoff\">Se d&eacute;connecter d'internet</A>";}
36
  $l_password_change = "<a href=\"https://$hostname/pass\">Changer votre mot de passe</A>";
50
  $l_password_change = "<a href=\"https://$hostname/pass\">Changer votre mot de passe</A>";
37
  $l_password_change_explain = "Vous devez poss&eacute;der un compte de consultation Internet.";
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.";
38
  $l_back_page = "<a href=\"javascript:history.back()\">Page pr&eacute;c&eacute;dente</a>";
52
  $l_back_page = "<a href=\"javascript:history.back()\">Page pr&eacute;c&eacute;dente</a>";
39
}
53
}
40
else {
54
else {
41
  $l_access_denied = "ACCESS DENIED";
55
  $l_access_denied = "ACCESS DENIED";
42
  $l_access_welcome = "Welcome on ALCASAR";
56
  $l_access_welcome = "Welcome on ALCASAR";
Line 46... Line 60...
46
  $l_explain_access_deny = "Your portal has just detected that the Internet access is down";
60
  $l_explain_access_deny = "Your portal has just detected that the Internet access is down";
47
  $l_explain_net_pb = "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";
48
  $l_contact_access_deny = "Contact your security system manager if you think this filtering is abusive.";
62
  $l_contact_access_deny = "Contact your security system manager if you think this filtering is abusive.";
49
  $l_contact_net_pb = "Contact your network responsive or your Internet provider for more information";
63
  $l_contact_net_pb = "Contact your network responsive or your Internet provider for more information";
50
  $l_welcome = "Your captive portal main page";
64
  $l_welcome = "Your captive portal main page";
51
  $l_acc_access = "<a href=\"https://$hostname/acc\">Access to the ALCASAR Control Center</A>";
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>";
52
  if ($user[4] == "0") {
70
if ($user[4] == "0") {
53
	  $l_logout_explain = "No Internet consultation session is actualy open on your system";
71
	  $l_logout_explain = "No Internet consultation session is actualy open on your system";
54
	  $l_logout = "<a href=\"http://www.google.fr\">Open an Internet session</A>";}
72
	  $l_logout = "<a href=\"http://www.google.fr\">Open an Internet session</A>";}
55
  else {
73
  else {
56
	  $l_logout_explain = "Close the session of the user : <b>$user[5]</b>";
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";
57
	  $l_logout = "<a href=\"http://$hostname:3990/logoff\">Logoff</A>";}
75
	  $l_logout = "<a href=\"http://$hostname:3990/logoff\">Logoff from internet</A>";}
58
  $l_password_change = "<a href=\"https://$hostname/pass\">Change your password</A>";
76
  $l_password_change = "<a href=\"https://$hostname/pass\">Change your password</A>";
59
  $l_password_change_explain = "You should already have an Internet access account.";
77
  $l_password_change_explain = "Ridirect you on password change page.<br><br> You should already have an Internet access account.";
60
  $l_back_page = "<a href=\"javascript:history.back()\">Previous page</a>";
78
  $l_back_page = "<a href=\"javascript:history.back()\">Previous page</a>";
61
}
79
}
62
$l_title = ($direct_access ? $l_access_welcome : ($network_pb ? $l_access_unavailable : $l_access_denied));
80
$l_title = ($direct_access ? $l_access_welcome : ($network_pb ? $l_access_unavailable : $l_access_denied));
63
$l_explain = ($direct_access ? $l_explain_acc_access : ($network_pb ? $l_explain_net_pb : $l_explain_access_deny));
81
$l_explain = ($direct_access ? $l_explain_acc_access : ($network_pb ? $l_explain_net_pb : $l_explain_access_deny));
-
 
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
 
64
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
108
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
65
echo "<html><head><title>ALCASAR - $l_title";
109
echo "<html><head><title>ALCASAR - $l_title";
66
?>
110
?>
67
	</title>
111
	</title>
68
	<LINK rel=stylesheet type=text/css href="css/style_intercept.css">
112
	<LINK rel=stylesheet type=text/css href="css/style_intercept.css">
-
 
113
	<script>
-
 
114
		function valoriserDiv5(param){
-
 
115
			document.getElementById("box_info").innerHTML = param.innerHTML;
-
 
116
		}
-
 
117
	</script>
69
</head>
118
</head>
70
 
119
 
71
	<BODY>
120
	<BODY onload="valoriserDiv5(text_conn);">
72
<?
121
<?php
73
if ($direct_access){
122
if ($direct_access){
74
	echo "
123
	echo "
75
		<DIV id=\"cadre_titre\" class=\"titre_controle\">
124
		<DIV id=\"cadre_titre\" class=\"titre_controle\">
76
			<P id=\"acces_controle\" class=\"titre_controle\">$l_title</P>";
125
			<P id=\"acces_controle\" class=\"titre_controle\">$l_title</P>";
77
if ($network_pb) {
126
	if ($network_pb) {
78
	echo "	<SPAN>$l_explain_net_pb</SPAN>";
127
		echo "	<SPAN>$l_explain_net_pb</SPAN>";
-
 
128
		}
79
	}
129
	}
80
	}
-
 
81
else {
130
	else {
82
	echo"
131
		echo"
83
		<DIV id=\"cadre_titre\" class=\"titre_refus\">
132
			<DIV id=\"cadre_titre\" class=\"titre_refus\">
84
			<P id=\"acces_controle\" class=\"titre_refus\">$l_title</P>";
133
				<P id=\"acces_controle\" class=\"titre_refus\">$l_title</P>";
85
	}
134
	}
86
?>
135
?>
87
			<DIV id="boite_logo">
136
			<DIV id="boite_logo">
88
				<IMG src="images/organisme.png">
137
				<IMG src="images/organisme.png">
89
			</DIV>
138
			</DIV>
90
		</DIV>
139
		</DIV>
91
		<DIV id="contenu_acces">
140
		<DIV id="contenu_acces">
92
			<DIV id="box_url">
141
			<DIV id="box_url">
93
				<? if (! $direct_access){echo "$l_required_domain : $_SERVER[HTTP_HOST]";}?>
142
				<?php if (! $direct_access){echo "$l_required_domain : $_SERVER[HTTP_HOST]";}?>
94
			</DIV>
143
			</DIV>
-
 
144
<?php
95
<? if ($direct_access){
145
if ($direct_access){
96
	echo "	<DIV id=\"box_bienvenue\">
146
	echo "	<DIV id=\"box_bienvenue\">
97
				$l_welcome
147
				$l_welcome
98
			</DIV>
148
			</DIV>
99
			<DIV class=\"box_menu_courte\" id=\"box_1\">
-
 
100
				<IMG src=\"images/cle.png\">
-
 
101
				<SPAN>$l_password_change</SPAN>
-
 
102
				<P>$l_password_change_explain</P>
-
 
103
			</DIV>";
-
 
104
		if ($user[4] == "0") {
-
 
105
			echo "
-
 
106
			<DIV class=\"box_menu_courte\" id=\"box_2\">
149
			<DIV class=\"box_menu\" id=\"box_conn\" onmouseover=\"valoriserDiv5(text_conn);\">
107
			<SPAN>";
-
 
108
			if (! $network_pb) { echo "$l_logout";}
-
 
109
			echo " </SPAN>
-
 
110
				<IMG src=\"images/globe_acces.png\">
-
 
111
				<P>$l_logout_explain</P> 
-
 
112
			</DIV>";}
-
 
113
			else {
-
 
114
			echo "
-
 
115
			<DIV class=\"box_menu_courte\" id=\"box_2\">
-
 
116
				<SPAN>$l_logout</SPAN>
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);\">
117
				<IMG src=\"images/globe.png\">
159
				<IMG src=\"$img_rep$img_pwd\">
118
				<P>$l_logout_explain</P> 
160
				<SPAN>$l_password_change</SPAN>
119
			</DIV>";}			
161
			</DIV>		
120
	echo "	<DIV class=\"box_menu_large\" id=\"box_3\">
162
			<DIV class=\"box_menu\" id=\"box_acc\" onmouseover=\"valoriserDiv5(text_acc);\">
121
				<SPAN>$l_acc_access</SPAN>
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>
122
				<IMG src=\"images/logo-alcasar.png\">
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>
-
 
178
				<P>$l_password_change_explain</P>
-
 
179
				<IMG src=\"$img_rep$img_pwd\">
-
 
180
			</DIV>
-
 
181
			<DIV class=\"div-cache\" id=\"text_acc\">
-
 
182
				<H2>$l_acc_access</H2>
123
				<P>$l_explain</P>
183
				<P>$l_explain</P>
-
 
184
				<IMG src=\"$img_rep$img_acc\">
-
 
185
			</DIV>
-
 
186
			<DIV id=\"box_info\">
124
			</DIV>";}
187
			</DIV>";
-
 
188
	}
-
 
189
	else {
125
	else {echo "
190
		echo "
126
			<DIV id=\"box_refuse\">
191
			<DIV id=\"box_refuse\">
127
				<img src=\"images/interdit.png\">
192
				<img src=\"$img_rep$img_false\">
128
				<P>$l_explain</P>
193
				<P>$l_explain</P>
129
			</DIV>
194
			</DIV>
130
			<DIV id=\"liens_redir\">
195
			<DIV id=\"liens_redir\">
131
				<P>$l_back_page</P>
196
				<P>$l_back_page</P>
132
			</DIV>";}
197
			</DIV>";
-
 
198
		}
133
	if (($network_pb)&&(! $direct_access))
199
	if (($network_pb)&&(! $direct_access)) {
134
			{
-
 
135
	echo "		<SPAN>Diagnostic : $diagnostic</SPAN>";
200
	echo "	<SPAN>Diagnostic : $diagnostic</SPAN>";
136
}
201
	}
-
 
202
 
137
?>
203
?>
138
		</DIV>
204
		</DIV>
139
	</BODY>
205
	</BODY>
140
</html>
206
</html>