Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 2992 → Rev 2993

/web/acc/manager/htdocs/user_by_email_v0.php
File deleted
/web/acc/manager/htdocs/user_by_email.php
5,10 → 5,9
/****************************************************************
* GLOBAL FILE PATHS *
*****************************************************************/
define('CONF_FILE', '/usr/local/etc/alcasar-mail.conf');
 
define('CONF_FILE', '/usr/local/etc/alcasar.conf');
/****************************************************************
* FILE reading test *
* Conf files reading test *
*****************************************************************/
$conf_files = array(CONF_FILE);
foreach ($conf_files as $file) {
19,7 → 18,6
exit("Vous n'avez pas les droits de lecture sur le fichier $file");
}
}
 
/****************************************************************
* Read CONF_FILE *
*****************************************************************/
31,6 → 29,19
$buffer = fgets($file_conf, 4096);
if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '#')) {
$tmp = explode('=', $buffer, 2);
$mail_conf[trim($tmp[0])] = trim($tmp[1]);
}
}
fclose($file_conf);
 
$file_conf = fopen(CONF_FILE, 'r');
if (!$file_conf) {
exit('Error opening the file '.CONF_FILE);
}
while (!feof($file_conf)) {
$buffer = fgets($file_conf, 4096);
if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '#')) {
$tmp = explode('=', $buffer, 2);
$conf[trim($tmp[0])] = trim($tmp[1]);
}
}
45,37 → 56,52
$Language = strtolower(substr(chop($Langue[0]), 0, 2));
}
if ($Language === 'fr') {
$l_mail_title = "Authentification externe : Adresse mail";
$l_mail_auth_enable_label = "Activer l'authentification par mail :";
$l_mail_YES = "OUI";
$l_mail_NO = "NON";
$l_mail_title = "Inscription par Email";
$l_mail_registration = "Activer l'inscription par Email :";
$l_mail_choice = "Quel type de service mail utiliser ?";
$l_use_internal_server = "Utiliser le serveur interne";
$l_use_external_server = "Relayer vers un serveur externe";
$l_use_email_address = "Utiliser une adresse mail";
$l_email_address = "Adresse mail utilisée pour l'envoi de mail";
$l_email_password = "Mot de passe";
$l_email_password_confirm = "Confirmez le mot de passe";
$l_mail_service = "Choisissez le service de messagerie";
$l_mail_YES = "OUI";
$l_mail_NO = "NON";
$l_mail_submit = "Enregistrer";
} else {
$l_mail_title = "External authentication : Address mail";
$l_mail_auth_enable_label = "Enable email authentication :";
$l_mail_YES = "YES";
$l_mail_NO = "NO";
$l_mail_title = "Registration by Email";
$l_mail_registration = "Enable registration by Email :";
$l_mail_choice = "What type of mail service use ?";
$l_internal_server = "Use the internal server";
$l_external_server = "Relay to an external server";
$l_email_address = "Use an email address";
$l_email_address = "Email address used for sending mail";
$l_email_password = "Password";
$l_email_password_confirm = "Confirm password";
$l_mail_service = "Choose the mail service";
$l_mail_YES = "YES";
$l_mail_NO = "NO";
$l_mail_submit = "Save";
}
 
// Mail configuration params
$mail_status = $conf['MAIL'];
$mail_type = $conf['TYPE_MAIL'];
$mail_address_mail = $conf['mailAddr'];
$mail_smtp = $conf['smtp'];
$mail_port = $conf['port'];
$mail_address_ip = $conf['mailIP'];
$mail_status = $mail_conf['MAIL'];
$mail_type = $mail_conf['MAIL_TYPE'];
$mail_address_mail = $mail_conf['MAIL_ADDR'];
$mail_smtp = $mail_conf['MAIL_SMTP'];
$mail_port = $mail_conf['MAIL_PORT'];
$mail_address_ip = $mail_conf['MAIL_SMTP_IP'];
$mail_server = "";
$mail_password_mail = "";
$mail_password_mail_2 = "";
$admin_address = $conf['adminMail'];
$mail_whitelist = $conf['whiteDomain'];
$admin_address = $mail_conf['MAIL_ADMIN'];
$mail_whitelist = $mail_conf['MAIL_WHITEDOMAIN'];
 
 
if(isset($_POST['submit'])){
if($_POST['auth_enable'] === '1')
if($_POST['auth_enable'] === 'on')
{
exec("systemctl start postfix");
 
$mail_status = $_POST['auth_enable'];
// exec("systemctl start postfix");
$mail_type = $_POST['mail_type'];
$mail_address = $_POST['mail_address'];
$mail_ip = $_POST['mail_ip'];
85,12 → 111,6
$admin_enable = $_POST['admin_enable'];
$admin_address = $_POST['admin_address'];
$mail_whitelist = $_POST['mail_whitelist'];
// exec("cp /var/www/mail/header.php /var/www/html");
// exec("cp /var/www/mail/inscription.php /var/www/html");
// exec("cp /var/www/mail/inscription_traitement.php /var/www/html");
// exec("cp /var/www/html/acc/admin/services.php /var/www/html/acc/admin/services.php.origin");
// exec("cp /var/www/mail/services.php /var/www/html/acc/admin");
 
if ($mail_mdp == $mail_mdp2) {
switch ($mail_server) {
130,41 → 150,41
echo "Erreur dans la saisie !";
break;
}
file_put_contents(CONF_FILE, str_replace('MAIL='.$conf['MAIL'],'MAIL='.$mail_status,file_get_contents(CONF_FILE)));
file_put_contents(CONF_FILE, str_replace('TYPE_MAIL='.$conf['TYPE_MAIL'],'TYPE_MAIL='.$mail_type,file_get_contents(CONF_FILE)));
file_put_contents(CONF_FILE, str_replace('mailAddr='.$conf['mailAddr'],'mailAddr='.$mail_address,file_get_contents(CONF_FILE)));
file_put_contents(CONF_FILE, str_replace('mailIP='.$conf['mailIP'],'mailIP='.$mail_ip,file_get_contents(CONF_FILE)));
file_put_contents(CONF_FILE, str_replace('smtp='.$conf['smtp'],'smtp='.$mail_smtp,file_get_contents(CONF_FILE)));
file_put_contents(CONF_FILE, str_replace('port='.$conf['port'],'port='.$mail_port,file_get_contents(CONF_FILE)));
file_put_contents(CONF_FILE, str_replace('whiteDomain='.$conf['mail_whitelist'],'whiteDomain='.$mail_whitelist,file_get_contents(CONF_FILE)));
file_put_contents(CONF_FILE, str_replace('MAIL='.$mail_conf['MAIL'],'MAIL=on',file_get_contents(CONF_FILE)));
file_put_contents(CONF_FILE, str_replace('MAIL_TYPE='.$mail_conf['MAIL_TYPE'],'MAIL_TYPE='.$mail_type,file_get_contents(CONF_FILE)));
file_put_contents(CONF_FILE, str_replace('MAIL_ADDR='.$mail_conf['MAIL_ADDR'],'MAIL_ADDR='.$mail_address,file_get_contents(CONF_FILE)));
file_put_contents(CONF_FILE, str_replace('MAIL_SMTP_IP='.$mail_conf['MAIL_SMTP_IP'],'MAIL_SMTP_IP='.$mail_ip,file_get_contents(CONF_FILE)));
file_put_contents(CONF_FILE, str_replace('MAIL_SMTP='.$mail_conf['MAIL_SMTP'],'MAIL_SMTP='.$mail_smtp,file_get_contents(CONF_FILE)));
file_put_contents(CONF_FILE, str_replace('MAIL_PORT='.$mail_conf['MAIL_PORT'],'MAIL_PORT='.$mail_port,file_get_contents(CONF_FILE)));
file_put_contents(CONF_FILE, str_replace('MAIL_WHITEDOMAIN='.$mail_conf['MAIL_WHITEDOMAIN'],'MAIL_WHITEDOMAIN='.$mail_whitelist,file_get_contents(CONF_FILE)));
if (isset($admin_address)) {
file_put_contents(CONF_FILE, str_replace('adminMail='.$conf['admin_address'],'adminMail='.$admin_address,file_get_contents(CONF_FILE)));
file_put_contents(CONF_FILE, str_replace('MAIL_ADMIN='.$mail_conf['MAIL_ADMIN'],'MAIL_ADMIN='.$admin_address,file_get_contents(CONF_FILE)));
}
switch ($mail_type) {
case '1':
$mail_port = 25;
file_put_contents(CONF_FILE, str_replace('port='.$conf['port'],'port='.$mail_port,file_get_contents(CONF_FILE)));
file_put_contents(CONF_FILE, str_replace('port='.$mail_conf['port'],'port='.$mail_port,file_get_contents(CONF_FILE)));
if(isset($mail_admin)){
exec("sudo /usr/bin/bash /usr/local/bin/alcasar-mail-install-V2.sh -1 -a $admin_address -w $mail_whitelist");
exec("sudo /usr/bin/bash /usr/local/bin/alcasar-mail-install.sh -1 -a $admin_address -w $mail_whitelist");
}
else {
exec("sudo /usr/bin/bash /usr/local/bin/alcasar-mail-install-V2.sh -1 -w $mail_whitelist");
exec("sudo /usr/bin/bash /usr/local/bin/alcasar-mail-install.sh -1 -w $mail_whitelist");
}
break;
case '2':
if(isset($mail_admin)){
exec("sudo /usr/bin/bash /usr/local/bin/alcasar-mail-install-V2.sh -2 -s $mail_smtp -p $mail_port -r $mail_ip -a $admin_address -w $mail_whitelist");
exec("sudo /usr/bin/bash /usr/local/bin/alcasar-mail-install.sh -2 -s $mail_smtp -p $mail_port -r $mail_ip -a $admin_address -w $mail_whitelist");
}
else {
exec("sudo /usr/bin/bash /usr/local/bin/alcasar-mail-install-V2.sh -2 -s $mail_smtp -p $mail_port -r $mail_ip -w $mail_whitelist");
exec("sudo /usr/bin/bash /usr/local/bin/alcasar-mail-install.sh -2 -s $mail_smtp -p $mail_port -r $mail_ip -w $mail_whitelist");
}
break;
case '3':
if(isset($mail_admin)){
exec("sudo /usr/bin/bash /usr/local/bin/alcasar-mail-install-V2.sh -3 -s $mail_smtp -p $mail_port -m $mail_address -o $mail_mdp -a $admin_address -w $mail_whitelist");
exec("sudo /usr/bin/bash /usr/local/bin/alcasar-mail-install.sh -3 -s $mail_smtp -p $mail_port -m $mail_address -o $mail_mdp -a $admin_address -w $mail_whitelist");
}
else {
exec("sudo /usr/bin/bash /usr/local/bin/alcasar-mail-install-V2.sh -3 -s $mail_smtp -p $mail_port -m $mail_address -o $mail_mdp -w $mail_whitelist");
exec("sudo /usr/bin/bash /usr/local/bin/alcasar-mail-install.sh -3 -s $mail_smtp -p $mail_port -m $mail_address -o $mail_mdp -w $mail_whitelist");
}
break;
default:
172,23 → 192,12
break;
}
}
else {
else { // password are not the same
echo "Erreur";
}
}
else {
exec("cp -f /etc/postfix/main.cf.origin /etc/postfix/main.cf");
exec("rm -rf /etc/postfix/sasl/");
exec("cp -f /var/www/mail/alcasar-mail.conf /usr/local/etc/");
exec("systemctl restart postfix");
exec("systemctl stop postfix");
exec("sed -i '/SMTP_IP=/ s/^/#/g' /usr/local/etc/alcasar-iptables-local.sh");
exec("sed -i '/SMTP_PORT=/ s/^/#/g' /usr/local/etc/alcasar-iptables-local.sh");
exec("rm -f /var/www/html/header.php");
exec("rm -f /var/www/html/inscription.php");
exec("rm -f /var/www/html/inscription_traitement.php");
exec("cp -f /var/www/html/acc/admin/services.php.origin /var/www/html/acc/admin/services.php");
exec("sudo /usr/bin/bash /usr/local/bin/alcasar-iptables.sh");
else { // switch email registation off
exec("/usr/local/bin/alcasar-mail-install.sh -0");
}
header("Refresh:0");
exit;
210,7 → 219,7
var formSubmit = document.querySelector('form input[type="submit"]');
var btn_checkConf = document.getElementById('btn-checkconf');
var isChecked = false;
if (document.getElementById('auth_enable').value === '1') {
if (document.getElementById('auth_enable').value === 'on') {
for (var i=0; i<listToDisables1.length; i++) {
document.getElementById(listToDisables1[i]).style.backgroundColor = '#c0c0c0';
document.getElementById(listToDisables1[i]).disabled = true;
225,7 → 234,7
}
document.getElementById('mail_type').style.backgroundColor = null;
document.getElementById('mail_type').disabled = false;
if (document.getElementById('mail_type').value === '1') {
if (document.getElementById('mail_type').value === 'on') {
for (var i=0; i<listToDisables1.length; i++) {
document.getElementById(listToDisables1[i]).style.backgroundColor = null;
document.getElementById(listToDisables1[i]).disabled = false;
278,7 → 287,7
</head>
<body onLoad="onMailStatusChange();">
<div class="panel">
<div class="panel-header"><?= "Authentication Mail" ?></div>
<div class="panel-header"><?= $l_mail_title ?></div>
<div class="panel-body">
<form id="form-config_mail" name="config_mail" method="POST" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>" enctype="multipart/form-data">
<fieldset>
289,32 → 298,30
</legend>
<dl>
<dt>
<label for="auth_enable"><?= "Activer l'authentification par mail :" ?></label>
<label for="auth_enable"><?= $l_mail_registration ?></label>
</dt>
<dd>
<select id="auth_enable" name="auth_enable" onchange="onMailStatusChange();">
<option value="1"<?= ($mail_status) ? ' selected="selected"' : '' ?>><?= $l_mail_YES ?></option>
<option value="0"<?= (!$mail_status) ? ' selected="selected"' : '' ?>><?= $l_mail_NO ?></option>
<option value="on"<?= ($mail_status == 'on') ? ' selected="selected"' : '' ?>><?= $l_mail_YES ?></option>
<option value="off"<?= ($mail_status == 'off') ? ' selected="selected"' : '' ?>><?= $l_mail_NO ?></option>
</select>
</dd>
</dl>
<dl>
<dt>
<label for="mail_type"><?= "Type Messagerie" ?></label><br>
<?= "Choississez le type de messagerie a utiliser" ?><br>
<label for="mail_type"><?= $l_mail_choice ?></label><br>
</dt>
<dd>
<select id="mail_type" name="mail_type" onchange="onMailStatusChange();">
<option value=1>Nom de domaine</option>
<option value=2>Serveur mail ou serveur SMTP</option>
<option value=3>Adresse de messagerie</option>
<option value=1><?= $l_use_internal_server ?></option>
<option value=2><?= $l_use_external_server ?></option>
<option value=3><?= $l_use_email_address ?></option>
</select>
</dd>
</dl>
<dl>
<dt>
<label for="mail_address"><?= "Adresse Messagerie"?></label><br>
<?= "Adresse de messagerie utilisé pour l'envoi" ?>
<label for="mail_address"><?= $l_email_address ?></label><br>
</dt>
<dd>
<input type="text" id="mail_address" size="40" name="mail_address" value="<?= $mail_address_mail ?>" oninput="onMailStatusChange();">
322,8 → 329,7
</dl>
<dl>
<dt>
<label for="mail_mdp"><?= "Mot de passe Messagerie"?></label><br>
<?= "Mot de passe de la messagerie utilisé pour l'envoi" ?>
<label for="mail_mdp"><?= $l_email_password ?></label><br>
</dt>
<dd>
<input type="text" id="mail_mdp" size="40" name="mail_mdp" value="<?= $mail_password_mail ?>" oninput="onMailStatusChange();">
331,8 → 337,7
</dl>
<dl>
<dt>
<label for="mail_mdp2"><?= "Confirmer Mot de passe Messagerie"?></label><br>
<?= "Confirmer le mot de passe de la messagerie utilisé pour l'envoi" ?>
<label for="mail_mdp2"><?= $l_email_password_confirm ?></label><br>
</dt>
<dd>
<input type="text" id="mail_mdp2" size="40" name="mail_mdp2" value="<?= $mail_password_mail_2 ?>" oninput="onMailStatusChange();">
340,8 → 345,7
</dl>
<dl>
<dt>
<label for="mail_server"><?= "CHoix Serveur SMTP" ?></label><br>
<?= "Choissisiez le serveur SMTP correspondant à l'adress de messagerie" ?><br>
<label for="mail_server"><?= $l_mail_service ?></label><br>
</dt>
<dd>
<select id="mail_server" name="mail_server" onchange="onMailStatusChange();">
396,7 → 400,6
</dd>
</dl>
<p>
<!--<button id="btn-checkconf" onclick="checkConfig(); return false;"><?= $l_check ?></button>-->
<input id="submit" type="submit" value="<?= $l_mail_submit ?>" name="submit">
</p>
</fieldset>
/web/acc/menu.php
220,8 → 220,6
<li><div class="caret"></div><a href="manager/auth_exceptions.php" target="REXY2">Exceptions</a></li>
<li><div class="caret"></div><a href="manager/htdocs/user_by_sms.php" target="REXY2"><?= $l_sms ?></a></li>
<li><div class="caret"></div><a href="manager/htdocs/user_by_email.php" target="REXY2"><?= $l_mail ?></a></li>
<li><div class="caret"></div><a href="manager/htdocs/user_by_email_V0.php" target="REXY2"> mail-old </a></li>
 
</ul>
</li>
<?php endif; ?>
/web/intercept.php
57,6 → 57,7
 
$organisme = $conf["ORGANISM"];
$service_SMS_status = ($conf['SMS'] === 'on');
$service_Email_status = ($conf['Email'] === 'on');
$service_wifi4eu_status = ($conf['WIFI4EU'] === 'on');
$service_wifi4eu_code = $conf['WIFI4EU_CODE'];
$service_wifi4eu_server = 'https://collection.wifi4eu.ec.europa.eu/wifi4eu.min.js';
112,7 → 113,8
$l_online_time = "Tiempo en linea";
$l_remaining_time = "Tiempo restante";
$l_uam_domain = "Sitios de libre acceso : ";
$l_sms_registration = "Registo autom&aacute;tico";
$l_sms_registration = "Registro por SMS";
$l_email_registration = "Registro por E-mail";
} else if ($Language === 'pt') { // Portuguese
$l_ChilliError = "A autenticação precisa ser bem sucedida através do portal.";
$l_login = "Sucesso na autenticação.<HR>Matenha esse pop-up apenas minimizado para não interromper a conexão";
146,7 → 148,8
$l_online_time = "Tempo Online";
$l_remaining_time = "Tempo restante";
$l_uam_domain = "Sítios de acesso livre : ";
$l_sms_registration = "Registo autom&aacute;tico";
$l_sms_registration = "Registo por SMS";
$l_email_registration = "Registro por E-mail";
} else if ($Language === 'zh') { // Chinese
$l_ChilliError = "验证必须通过强制门户服务";
$l_login = "验证成功<HR>关闭此窗口中断连接";
180,7 → 183,8
$l_online_time = "在线时间";
$l_remaining_time = "剩余时间";
$l_uam_domain = " : ";
$l_sms_registration = "短信注册";
$l_sms_registration = "SMSで登録する";
$l_email_registration = "メールでの登録";
} else if ($Language === 'ar') { // Arabic
$l_ChilliError = "يجب نجاح المصادقة على البوابة الأسيرة";
$l_login = "إغلاق هذه النافذة يقطع دورة عملك";
214,7 → 218,8
$l_online_time = "مذة الإتصال";
$l_remaining_time = "الوقت المتبق";
$l_uam_domain = "مواقع الوصول المجاني";
$l_sms_registration = "تسجيل ذاتي (SMS)";
$l_sms_registration = "التسجيل عن طريق الرسائل القصيرة";
$l_email_registration = "التسجيل عن طريق البريد الإلكتروني";
} else if ($Language === 'de') { // German
$l_ChilliError = "Sie wurden erfolgreich durch das Portal authentifiziert.";
$l_login = "Erfolgreiche Authentifizierung.<HR>Schlißen dieses fensters unterbricht die Sitzung";
248,7 → 253,8
$l_online_time = "Online-Zeit";
$l_remaining_time = "Verbleibende Zeit";
$l_uam_domain = "Offen zugängliche Seiten : ";
$l_sms_registration = "Automatische Registrierung";
$l_sms_registration = "Per SMS anmelden";
$l_email_registration = "Per E-Mail anmelden";
} else if ($Language === 'nl') { // Dutch
$l_ChilliError = "De authenticatie moet een succes worden via de captive portal dienst.";
$l_login = "Succesvolle authenticatie.<HR>Dit venster te sluiten onderbreekt uw sessie.";
282,7 → 288,8
$l_online_time = "Online tijd";
$l_remaining_time = "Reterende tijd";
$l_uam_domain = "Sites met open toegang : ";
$l_sms_registration = "Automatische registratie";
$l_sms_registration = "Registreren per SMS";
$l_email_registration = "Registreer per E-mail";
} else if ($Language === 'fr') { // French
$l_ChilliError = "L'authentification doit être réussie sur le portail captif.";
$l_login = "Authentification réussie.<HR>La fermeture de cette fenêtre interrompt votre session.";
316,7 → 323,8
$l_online_time = "Temps de connexion";
$l_remaining_time = "Temps restant";
$l_uam_domain = "Sites en accès libre : ";
$l_sms_registration = "Auto enregistrement (sms)";
$l_sms_registration = "S'inscrire par SMS";
$l_email_registration = "S'incrire pae E-mail";
} else { // English
$l_ChilliError = "The authentication must be successful through the captive portal service.";
$l_login = "Successful authentication.<HR>Closing this window interrupts your session";
350,7 → 358,8
$l_online_time = "Online time";
$l_remaining_time = "Remaining time";
$l_uam_domain = "Open access websites : ";
$l_sms_registration = "Auto registration (sms)";
$l_sms_registration = "Register by SMS";
$l_email_registration = "Register by E-mail";
}
 
# If HTTPS not use, tell it's wrong