| Line 1... |
Line 1... |
| 1 |
<?php
|
1 |
<?php
|
| 2 |
/* written by steweb57 & Rexy */
|
2 |
/* written by steweb57 & Rexy */
|
| - |
|
3 |
|
| - |
|
4 |
|
| - |
|
5 |
// partie $_POST du service mail
|
| - |
|
6 |
|
| - |
|
7 |
$php_self = htmlspecialchars($_SERVER['PHP_SELF']);
|
| - |
|
8 |
// Traiter les formulaires de la partie MAIL SERVICE
|
| - |
|
9 |
if(!empty($_POST)){
|
| - |
|
10 |
|
| - |
|
11 |
var_dump($_POST);
|
| - |
|
12 |
/* // procéder a l'installtion de postfix
|
| - |
|
13 |
if (!empty($_POST['install'])){
|
| - |
|
14 |
exec('sudo dnf install -y postfix', $output, $retval);
|
| - |
|
15 |
// header("Location:services.php");
|
| - |
|
16 |
var_dump($output);
|
| - |
|
17 |
echo "<br>\$retval : " . $retval;
|
| - |
|
18 |
}
|
| - |
|
19 |
*/
|
| - |
|
20 |
// La variable qui contiendra les options et les arguments a passer à l'install
|
| - |
|
21 |
$optArg = "";
|
| - |
|
22 |
|
| - |
|
23 |
if(!empty($_POST['testConf'])){
|
| - |
|
24 |
$optArg .= " -".trim($_POST['testConf']);
|
| - |
|
25 |
}
|
| - |
|
26 |
if(!empty($_POST['smtp'])){
|
| - |
|
27 |
$optArg .= " -s \"".trim($_POST['smtp'])."\"";
|
| - |
|
28 |
}
|
| - |
|
29 |
if(!empty($_POST['port'])){
|
| - |
|
30 |
$optArg .= " -p \"".trim($_POST['port'])."\"";
|
| - |
|
31 |
}
|
| - |
|
32 |
if(!empty($_POST['smtpPort'])){
|
| - |
|
33 |
$smtpPort = explode(" ", $_POST['smtpPort']);
|
| - |
|
34 |
$optArg .= " -s \"".trim($smtpPort[0])."\" -p \"".trim($smtpPort[1])."\"";
|
| - |
|
35 |
}
|
| - |
|
36 |
if(!empty($_POST['smtpIP'])){
|
| - |
|
37 |
$optArg .= " -r \"".trim($_POST['smtpIP'])."\"";
|
| - |
|
38 |
}
|
| - |
|
39 |
if(!empty($_POST['mailAddr'])){
|
| - |
|
40 |
$optArg .= " -m \"".trim($_POST['mailAddr'])."\"";
|
| - |
|
41 |
}
|
| - |
|
42 |
if(!empty($_POST['pswd1']) && !empty($_POST['pswd2'])){
|
| - |
|
43 |
if (trim($_POST['pswd1']) == trim($_POST['pswd2'])){
|
| - |
|
44 |
$optArg .= " -o \"".trim($_POST['pswd2'])."\"";
|
| - |
|
45 |
} else {
|
| - |
|
46 |
echo "<script> alert(\"Les deux mots de passe sont différents\"); window.location.href=\"services.php\";</script>";
|
| - |
|
47 |
}
|
| - |
|
48 |
}
|
| - |
|
49 |
if(!empty($_POST['adminMail'])){
|
| - |
|
50 |
$optArg .= " -a \"".$_POST['adminMail']."\"";
|
| - |
|
51 |
}
|
| - |
|
52 |
if(!empty($_POST['wld'])){
|
| - |
|
53 |
$optArg .= " -w \"".str_replace("\r"," ",trim($_POST['wld']))."\"";
|
| - |
|
54 |
}
|
| - |
|
55 |
|
| - |
|
56 |
// Supprimer la WLD ou l'email de l'admin
|
| - |
|
57 |
if(!empty($_POST['unset'])){
|
| - |
|
58 |
exec("sudo sed -i '/". $_POST['unset']."/d' /usr/local/etc/alcasar-mail.conf", $output, $retval);
|
| - |
|
59 |
|
| - |
|
60 |
var_dump($output);
|
| - |
|
61 |
echo "<br>\$retval : " . $retval;
|
| - |
|
62 |
}
|
| - |
|
63 |
|
| - |
|
64 |
// Supprimer toute la configuration actuelle
|
| - |
|
65 |
if(!empty($_POST['uninstall'])){
|
| - |
|
66 |
// echo "sudo /usr/local/bin/alcasar-mail-uninstall.sh <br>";
|
| - |
|
67 |
exec("sudo /usr/local/bin/alcasar-mail-uninstall.sh", $output, $retval);
|
| - |
|
68 |
|
| - |
|
69 |
var_dump($output);
|
| - |
|
70 |
echo "<br>\$retval : " . $retval;
|
| - |
|
71 |
}
|
| - |
|
72 |
|
| - |
|
73 |
if(!empty($optArg)){
|
| - |
|
74 |
echo "sudo /usr/local/bin/alcasar-mail-install.sh".$optArg;
|
| - |
|
75 |
exec("sudo /usr/local/bin/alcasar-mail-install.sh".escapeshellcmd($optArg), $output, $retval);
|
| - |
|
76 |
var_dump($output);
|
| - |
|
77 |
echo "<br>\$retval : " . $retval;
|
| - |
|
78 |
}
|
| - |
|
79 |
// à décommenté une fois tests et debugs réalisé pour recharger la page sansle $_POST
|
| - |
|
80 |
// header("Location:services.php");
|
| - |
|
81 |
|
| - |
|
82 |
}// Fin de la partie $_POST du service mail
|
| - |
|
83 |
|
| - |
|
84 |
|
| 3 |
# Choice of language
|
85 |
# Choice of language
|
| 4 |
$Language = 'en';
|
86 |
$Language = 'en';
|
| 5 |
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
|
87 |
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
|
| 6 |
$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
88 |
$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
| 7 |
$Language = strtolower(substr(chop($Langue[0]),0,2)); }
|
89 |
$Language = strtolower(substr(chop($Langue[0]),0,2)); }
|
| Line 25... |
Line 107... |
| 25 |
$l_lighttpd = "Serveur WEB (Alcasar Control Center)";
|
107 |
$l_lighttpd = "Serveur WEB (Alcasar Control Center)";
|
| 26 |
$l_sshd = "Accès sécurisée distant";
|
108 |
$l_sshd = "Accès sécurisée distant";
|
| 27 |
$l_clamav_freshclam = "Mise à jour de l'antivirus (toutes les 4 heures)";
|
109 |
$l_clamav_freshclam = "Mise à jour de l'antivirus (toutes les 4 heures)";
|
| 28 |
$l_clamav_daemon = "Antimalware";
|
110 |
$l_clamav_daemon = "Antimalware";
|
| 29 |
$l_ntpd = "Service de mise à l'heure réseau";
|
111 |
$l_ntpd = "Service de mise à l'heure réseau";
|
| - |
|
112 |
$l_postfix = "Service de messagerie";
|
| 30 |
$l_fail2ban = "Détecteur d'intrusion";
|
113 |
$l_fail2ban = "Détecteur d'intrusion";
|
| 31 |
$l_nfcapd = "Collecteur de flux NetFlow";
|
114 |
$l_nfcapd = "Collecteur de flux NetFlow";
|
| 32 |
$l_vnstat = "Grapheur de flux réseau";
|
115 |
$l_vnstat = "Grapheur de flux réseau";
|
| 33 |
$l_unbound = "Serveur DNS principal";
|
116 |
$l_unbound = "Serveur DNS principal";
|
| 34 |
$l_unbound_blacklist = "Serveur DNS pour la Blacklist";
|
117 |
$l_unbound_blacklist = "Serveur DNS pour la Blacklist";
|
| Line 221... |
Line 304... |
| 221 |
}
|
304 |
}
|
| 222 |
|
305 |
|
| 223 |
//-------------------------------
|
306 |
//-------------------------------
|
| 224 |
// Actions on services
|
307 |
// Actions on services
|
| 225 |
//-------------------------------
|
308 |
//-------------------------------
|
| 226 |
$autorizeService = array("radiusd","chilli","mysqld","lighttpd","unbound-forward","ulogd-ssh","ulogd-ext-access","ulogd-traceability","unbound-blacklist","unbound-whitelist","dnsmasq-whitelist","unbound-blackhole","e2guardian","clamav-daemon","clamav-freshclam","sshd","ntpd","fail2ban","nfcapd","vnstat");
|
309 |
$autorizeService = array("radiusd","chilli","mysqld","lighttpd","unbound-forward","ulogd-ssh","ulogd-ext-access","ulogd-traceability","unbound-blacklist","unbound-whitelist","dnsmasq-whitelist","unbound-blackhole","e2guardian","clamav-daemon","clamav-freshclam","sshd","ntpd","fail2ban","nfcapd","vnstat","postfix");
|
| 227 |
$autorizeAction = array("start","stop","restart");
|
310 |
$autorizeAction = array("start","stop","restart");
|
| 228 |
|
311 |
|
| 229 |
if (isset($_GET['service'])&&(in_array($_GET['service'], $autorizeService))) {
|
312 |
if (isset($_GET['service'])&&(in_array($_GET['service'], $autorizeService))) {
|
| 230 |
if (isset($_GET['action'])&&(in_array($_GET['action'], $autorizeAction))) {
|
313 |
if (isset($_GET['action'])&&(in_array($_GET['action'], $autorizeAction))) {
|
| 231 |
$execStatus = serviceExec($_GET['service'], $_GET['action']);
|
314 |
$execStatus = serviceExec($_GET['service'], $_GET['action']);
|
| Line 248... |
Line 331... |
| 248 |
$MainServiceStatus['ulogd_traceability'] = checkServiceStatus("ulogd-traceability");
|
331 |
$MainServiceStatus['ulogd_traceability'] = checkServiceStatus("ulogd-traceability");
|
| 249 |
$MainServiceStatus['sshd'] = checkServiceStatus("sshd");
|
332 |
$MainServiceStatus['sshd'] = checkServiceStatus("sshd");
|
| 250 |
$MainServiceStatus['ntpd'] = checkServiceStatus("ntpd");
|
333 |
$MainServiceStatus['ntpd'] = checkServiceStatus("ntpd");
|
| 251 |
$MainServiceStatus['fail2ban'] = checkServiceStatus("fail2ban");
|
334 |
$MainServiceStatus['fail2ban'] = checkServiceStatus("fail2ban");
|
| 252 |
$MainServiceStatus['vnstat'] = checkServiceStatus("vnstat");
|
335 |
$MainServiceStatus['vnstat'] = checkServiceStatus("vnstat");
|
| - |
|
336 |
$MainServiceStatus['postfix'] = checkServiceStatus("postfix");
|
| 253 |
|
337 |
|
| 254 |
$FilterServiceStatus = array();
|
338 |
$FilterServiceStatus = array();
|
| 255 |
$FilterServiceStatus['unbound_blacklist'] = checkServiceStatus("unbound-blacklist");
|
339 |
$FilterServiceStatus['unbound_blacklist'] = checkServiceStatus("unbound-blacklist");
|
| 256 |
$FilterServiceStatus['unbound_whitelist'] = checkServiceStatus("unbound-whitelist");
|
340 |
$FilterServiceStatus['unbound_whitelist'] = checkServiceStatus("unbound-whitelist");
|
| 257 |
$FilterServiceStatus['dnsmasq_whitelist'] = checkServiceStatus("dnsmasq-whitelist");
|
341 |
$FilterServiceStatus['dnsmasq_whitelist'] = checkServiceStatus("dnsmasq-whitelist");
|
| Line 268... |
Line 352... |
| 268 |
<html>
|
352 |
<html>
|
| 269 |
<head>
|
353 |
<head>
|
| 270 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
354 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
| 271 |
<title><?php echo $l_services_title; ?></title>
|
355 |
<title><?php echo $l_services_title; ?></title>
|
| 272 |
<link rel="stylesheet" href="/css/acc.css" type="text/css">
|
356 |
<link rel="stylesheet" href="/css/acc.css" type="text/css">
|
| - |
|
357 |
<script type="text/javascript" src="/js/jquery.min.js"></script>
|
| 273 |
</head>
|
358 |
</head>
|
| 274 |
<body>
|
359 |
<body>
|
| 275 |
<div class="panel">
|
360 |
<div class="panel">
|
| 276 |
<div class="panel-header"><?= $l_main_services ?></div>
|
361 |
<div class="panel-header"><?= $l_main_services ?></div>
|
| 277 |
<div class="panel-row">
|
362 |
<div class="panel-row">
|
| 278 |
<table width="100%" border=0 cellspacing=0 cellpadding=0>
|
363 |
<table width="100%" border=0 cellspacing=0 cellpadding=0>
|
| 279 |
<tr align="center"><td><?php echo $l_service_status;?></td><td colspan="2"><?php echo $l_service_title;?></td><td colspan="3"><?php echo $l_service_action;?></td></tr>
|
364 |
<tr align="center"><td><?php echo $l_service_status;?></td><td colspan="2"><?php echo $l_service_title;?></td><td colspan="3"><?php echo $l_service_action;?></td></tr>
|
| 280 |
<?php foreach( $MainServiceStatus as $serviceName => $statusOK ) { ?>
|
365 |
<?php foreach( $MainServiceStatus as $serviceName => $statusOK ) { ?>
|
| 281 |
<tr>
|
366 |
<tr>
|
| - |
|
367 |
<?php if ($serviceName != "postfix"){
|
| 282 |
<?php if ($statusOK) { ?>
|
368 |
if ($statusOK) { ?>
|
| 283 |
<td align="center"><img src="/images/state_ok.gif" width="15" height="15" alt="<?php echo $l_service_status_img_ok; ?>"></td>
|
369 |
<td align="center"><img src="/images/state_ok.gif" width="15" height="15" alt="<?php echo $l_service_status_img_ok; ?>"></td>
|
| 284 |
<td align="center"><?php $comment="l_$serviceName"; echo "<b>$serviceName</b></td><td>${$comment}" ;?> </td>
|
370 |
<td align="center"><?php $comment="l_$serviceName"; echo "<b>$serviceName</b></td><td>${$comment}" ;?> </td>
|
| 285 |
<td width="80" align="center">---</td>
|
371 |
<td width="80" align="center">---</td>
|
| 286 |
<td width="80" align="center"><?php if (($serviceName != "chilli") && ($serviceName != "lighttpd")) { echo "<a href=\"".$_SERVER['PHP_SELF']."?action=stop&service=".str_replace('_','-',$serviceName)."\"> $l_service_stop</a>"; } else echo "---";?></td>
|
372 |
<td width="80" align="center"><?php if (($serviceName != "chilli") && ($serviceName != "lighttpd")) { echo "<a href=\"".$_SERVER['PHP_SELF']."?action=stop&service=".str_replace('_','-',$serviceName)."\"> $l_service_stop</a>"; } else echo "---";?></td>
|
| 287 |
<td width="80" align="center"><a href="<?php echo $_SERVER['PHP_SELF']."?action=restart&service=".str_replace('_','-',$serviceName)."\"> $l_service_restart";?></a></td>
|
373 |
<td width="80" align="center"><a href="<?php echo $_SERVER['PHP_SELF']."?action=restart&service=".str_replace('_','-',$serviceName)."\"> $l_service_restart";?></a></td>
|
| Line 291... |
Line 377... |
| 291 |
<td width="80" align="center"><a href="<?php echo $_SERVER['PHP_SELF']."?action=start&service=".str_replace('_','-',$serviceName)."\"> $l_service_start";?></a></td>
|
377 |
<td width="80" align="center"><a href="<?php echo $_SERVER['PHP_SELF']."?action=start&service=".str_replace('_','-',$serviceName)."\"> $l_service_start";?></a></td>
|
| 292 |
<td width="80" align="center">---</td>
|
378 |
<td width="80" align="center">---</td>
|
| 293 |
<td width="80" align="center">---</td>
|
379 |
<td width="80" align="center">---</td>
|
| 294 |
<?php } ?>
|
380 |
<?php } ?>
|
| 295 |
</tr>
|
381 |
</tr>
|
| 296 |
<?php } ?>
|
382 |
<?php }
|
| - |
|
383 |
} ?>
|
| 297 |
</table>
|
384 |
</table>
|
| 298 |
</div>
|
385 |
</div>
|
| 299 |
</div>
|
386 |
</div>
|
| 300 |
<div class="panel">
|
387 |
<div class="panel">
|
| 301 |
<div class="panel-header"><?= $l_filter_services ?></div>
|
388 |
<div class="panel-header"><?= $l_filter_services ?></div>
|
| Line 324... |
Line 411... |
| 324 |
</div>
|
411 |
</div>
|
| 325 |
</div>
|
412 |
</div>
|
| 326 |
<div class="panel">
|
413 |
<div class="panel">
|
| 327 |
<div class="panel-header"><?= $l_opt_services ?></div>
|
414 |
<div class="panel-header"><?= $l_opt_services ?></div>
|
| 328 |
<div class="panel-row">
|
415 |
<div class="panel-row">
|
| 329 |
<form action="<?php echo $_SERVER['PHP_SELF']?>" method=POST>
|
- |
|
| - |
|
416 |
|
| 330 |
<table width="100%" border=0 cellspacing=0 cellpadding=0>
|
417 |
<table width="100%" border=0 cellspacing=0 cellpadding=0>
|
| 331 |
<tr align="center"><td><?php echo $l_service_status;?></td><td colspan="2"> </td><td colspan="3"><?php echo $l_service_action;?></td></tr>
|
418 |
<tr align="center"><td><?php echo $l_service_status;?></td><td colspan="2"> </td><td colspan="3"><?php echo $l_service_action;?></td></tr>
|
| - |
|
419 |
|
| - |
|
420 |
<?php
|
| - |
|
421 |
/*
|
| - |
|
422 |
// POSTFIX
|
| - |
|
423 |
exec("sudo rpm" . escapeshellarg("-q postfix"), $output, $retval);
|
| - |
|
424 |
var_dump($output);
|
| - |
|
425 |
echo "<br>\$retval : " . $retval;
|
| - |
|
426 |
exec("sudo ip" . escapeshellarg("a"), $output, $retval);
|
| - |
|
427 |
var_dump($output);
|
| - |
|
428 |
echo "<br>\$retval : " . $retval;
|
| - |
|
429 |
// si POSTFIX n'est pas installé, on propose l'installation
|
| - |
|
430 |
if ($retval == 1){
|
| - |
|
431 |
|
| - |
|
432 |
echo <<<EOT
|
| - |
|
433 |
<tr align="center">
|
| - |
|
434 |
<td colspan="3"><b>POSTFIX n'est pas installé.</b></td>
|
| - |
|
435 |
<td>
|
| - |
|
436 |
<form id="install" action="$php_self" method=POST>
|
| - |
|
437 |
<input type="hidden" name="install" value="install">
|
| - |
|
438 |
<input type=submit form="install" value="Install">
|
| - |
|
439 |
</form>
|
| - |
|
440 |
</td>
|
| - |
|
441 |
</tr>
|
| - |
|
442 |
EOT;
|
| - |
|
443 |
|
| - |
|
444 |
// si POSFIX est installé
|
| - |
|
445 |
} else {
|
| - |
|
446 |
*/
|
| - |
|
447 |
// la partie tableau qui affiche les statut du service POSTFIX, et possiblité de start, restart & stop
|
| - |
|
448 |
$serviceName = "postfix";
|
| - |
|
449 |
if(array_key_exists($serviceName, $MainServiceStatus)){
|
| - |
|
450 |
|
| - |
|
451 |
$statusOK = $MainServiceStatus['postfix'];
|
| - |
|
452 |
$comment="l_$serviceName";
|
| - |
|
453 |
$stopService = $_SERVER['PHP_SELF']."?action=stop&service=".str_replace('_','-',$serviceName);
|
| - |
|
454 |
$startService = $_SERVER['PHP_SELF']."?action=start&service=".str_replace('_','-',$serviceName);
|
| - |
|
455 |
$restartService = $_SERVER['PHP_SELF']."?action=restart&service=".str_replace('_','-',$serviceName);
|
| - |
|
456 |
// $restartService = $_SERVER['PHP_SELF']."?action=restart&service=".str_replace('_','-',$serviceName)."\\";
|
| - |
|
457 |
|
| - |
|
458 |
echo "<tr>";
|
| - |
|
459 |
if ($statusOK) {
|
| - |
|
460 |
echo <<<EOT
|
| - |
|
461 |
<td align="center"><img src="/images/state_ok.gif" width="15" height="15" alt="$l_service_status_img_ok"></td>
|
| - |
|
462 |
<td align="center"><b>$serviceName</b></td>
|
| - |
|
463 |
<td align="center">${$comment}</td>
|
| - |
|
464 |
<td width="80" align="center">---</td>
|
| - |
|
465 |
<td width="80" align="center">
|
| - |
|
466 |
<a href=$stopService>$l_service_stop</a></td>
|
| - |
|
467 |
<td width="80" align="center">
|
| - |
|
468 |
<a href=$restartService>$l_service_restart</a></td>
|
| - |
|
469 |
EOT;
|
| - |
|
470 |
} else {
|
| - |
|
471 |
echo <<<EOT
|
| - |
|
472 |
<td align="center"><img src="/images/state_error.gif" width="15" height="15" alt="$l_service_status_img_ko"></td>
|
| - |
|
473 |
<td align="center">$serviceName</td>
|
| - |
|
474 |
<td align="center">${$comment}</td>
|
| - |
|
475 |
<td width="80" align="center">
|
| - |
|
476 |
<a href=$startService>$l_service_start</a></td>
|
| - |
|
477 |
<td width="80" align="center">---</td>
|
| - |
|
478 |
<td width="80" align="center">---</td>
|
| - |
|
479 |
EOT;
|
| - |
|
480 |
}
|
| - |
|
481 |
echo "</tr>";
|
| - |
|
482 |
}
|
| - |
|
483 |
//}
|
| - |
|
484 |
// POSTFIX end
|
| - |
|
485 |
?>
|
| - |
|
486 |
|
| - |
|
487 |
<form action="<?php echo $_SERVER['PHP_SELF']?>" method=POST>
|
| 332 |
<tr>
|
488 |
<tr>
|
| 333 |
<?php if ($wifi4eu == "on") { ?>
|
489 |
<?php if ($wifi4eu == "on") { ?>
|
| 334 |
<td align="center"><img src="/images/state_ok.gif" width="15" height="15" alt="<?php echo $l_service_status_img_ok; ?>"></td>
|
490 |
<td align="center"><img src="/images/state_ok.gif" width="15" height="15" alt="<?php echo $l_service_status_img_ok; ?>"></td>
|
| 335 |
<td align="center"><b>WIFI4EU</b></td><td><?php echo "network ID : $wifi4eu_code"; ?></td>
|
491 |
<td align="center"><b>WIFI4EU</b></td><td><?php echo "network ID : $wifi4eu_code"; ?></td>
|
| 336 |
<td width="80" align="center">---</td>
|
492 |
<td width="80" align="center">---</td>
|
| Line 342... |
Line 498... |
| 342 |
<td width="80" align="center"><input type=submit value="<?echo $l_service_start;?>"><input type=hidden name="wifi4eu" value="on"></td>
|
498 |
<td width="80" align="center"><input type=submit value="<?echo $l_service_start;?>"><input type=hidden name="wifi4eu" value="on"></td>
|
| 343 |
<td width="80" align="center">---</td>
|
499 |
<td width="80" align="center">---</td>
|
| 344 |
<td width="80" align="center">---</td>
|
500 |
<td width="80" align="center">---</td>
|
| 345 |
<?php } ?>
|
501 |
<?php } ?>
|
| 346 |
</tr>
|
502 |
</tr>
|
| - |
|
503 |
</form>
|
| - |
|
504 |
|
| 347 |
</table>
|
505 |
</table>
|
| 348 |
</form>
|
- |
|
| 349 |
</div>
|
506 |
</div>
|
| 350 |
</div>
|
507 |
</div>
|
| - |
|
508 |
|
| - |
|
509 |
|
| 351 |
<div class="panel">
|
510 |
<div class="panel">
|
| 352 |
<div class="panel-header"><?= $l_stop_restart ?></div>
|
511 |
<div class="panel-header"><?= $l_stop_restart ?></div>
|
| 353 |
<div class="panel-row">
|
512 |
<div class="panel-row">
|
| 354 |
<table width="100%" border=0 cellspacing=0 cellpadding=1>
|
513 |
<table width="100%" border=0 cellspacing=0 cellpadding=1>
|
| 355 |
<tr><td valign="middle" align="left">
|
514 |
<tr><td valign="middle" align="left">
|
| Line 362... |
Line 521... |
| 362 |
</form>
|
521 |
</form>
|
| 363 |
</td></tr>
|
522 |
</td></tr>
|
| 364 |
</table>
|
523 |
</table>
|
| 365 |
</div>
|
524 |
</div>
|
| 366 |
</div>
|
525 |
</div>
|
| - |
|
526 |
|
| - |
|
527 |
|
| - |
|
528 |
<!-- Code de la partie mail service, il ne faut pas oublier de rajouter jquery dans le head du html -->
|
| - |
|
529 |
|
| - |
|
530 |
<?php
|
| - |
|
531 |
|
| - |
|
532 |
echo <<<EOT
|
| - |
|
533 |
|
| - |
|
534 |
<div class="panel">
|
| - |
|
535 |
<div class="panel-header">POSTFIX actuelle Configuration</div>
|
| - |
|
536 |
<div class="panel-row">
|
| - |
|
537 |
<table width="100%" border=0 cellspacing=0 cellpadding=0><br>
|
| - |
|
538 |
|
| - |
|
539 |
EOT;
|
| - |
|
540 |
|
| - |
|
541 |
// la conf actuelle, si le fichier alcasar-mail.conf est présent
|
| - |
|
542 |
$alcasarMailConf = "/usr/local/etc/alcasar-mail.conf";
|
| - |
|
543 |
if (is_file ($alcasarMailConf)){
|
| - |
|
544 |
|
| - |
|
545 |
$tab=file($alcasarMailConf);
|
| - |
|
546 |
|
| - |
|
547 |
if ($tab){
|
| - |
|
548 |
foreach ($tab as $line) {
|
| - |
|
549 |
|
| - |
|
550 |
$field=explode("=", $line);
|
| - |
|
551 |
|
| - |
|
552 |
switch ($field[0]) {
|
| - |
|
553 |
|
| - |
|
554 |
case 'smtp':
|
| - |
|
555 |
$smtp = trim($field[1]);
|
| - |
|
556 |
echo <<<EOT
|
| - |
|
557 |
<tr align="center">
|
| - |
|
558 |
<td><b>SMTP : </b>$smtp</td>
|
| - |
|
559 |
</tr>
|
| - |
|
560 |
EOT;
|
| - |
|
561 |
break;
|
| - |
|
562 |
case 'port':
|
| - |
|
563 |
$port = trim($field[1]);
|
| - |
|
564 |
echo <<<EOT
|
| - |
|
565 |
<tr align="center">
|
| - |
|
566 |
<td><b>Port : </b>$port</td>
|
| - |
|
567 |
</tr>
|
| - |
|
568 |
EOT;
|
| - |
|
569 |
break;
|
| - |
|
570 |
case 'smtpIP':
|
| - |
|
571 |
$smtpIP = trim($field[1]);
|
| - |
|
572 |
echo <<<EOT
|
| - |
|
573 |
<tr align="center">
|
| - |
|
574 |
<td><b>SMTP ip : </b>$smtpIP</td>
|
| - |
|
575 |
</tr>
|
| - |
|
576 |
EOT;
|
| - |
|
577 |
break;
|
| - |
|
578 |
case 'mailAddr':
|
| - |
|
579 |
$mailAddr = trim($field[1]);
|
| - |
|
580 |
echo <<<EOT
|
| - |
|
581 |
<tr align="center">
|
| - |
|
582 |
<td><b>Email Addr : </b>$mailAddr</td>
|
| - |
|
583 |
</tr>
|
| - |
|
584 |
EOT;
|
| - |
|
585 |
break;
|
| - |
|
586 |
case 'adminMail':
|
| - |
|
587 |
$adminMail = trim($field[1]);
|
| - |
|
588 |
echo <<<EOT
|
| - |
|
589 |
<tr align="center">
|
| - |
|
590 |
<td><b>Admin email : </b>$adminMail</td>
|
| - |
|
591 |
</tr>
|
| - |
|
592 |
EOT;
|
| - |
|
593 |
break;
|
| - |
|
594 |
case 'whiteDomain':
|
| - |
|
595 |
$whiteDomain = explode(" ", trim($field[1]));
|
| - |
|
596 |
break;
|
| - |
|
597 |
}
|
| - |
|
598 |
}
|
| - |
|
599 |
}
|
| - |
|
600 |
echo <<<EOT
|
| - |
|
601 |
<form action="$php_self" method="post">
|
| - |
|
602 |
<tr align="center">
|
| - |
|
603 |
<td colspan="2">
|
| - |
|
604 |
<input type="hidden" name="uninstall" value="uninstall">
|
| - |
|
605 |
<br><input type="submit" class="btn btn-default" name="submit" value="Supprimer toute la configuration">
|
| - |
|
606 |
</td>
|
| - |
|
607 |
</tr>
|
| - |
|
608 |
</form>
|
| - |
|
609 |
<tr align="center">
|
| - |
|
610 |
<td colspan="2"><font color=red>ATTENTION : la suppression enlève toute la configuration du SERVICE MAIL</font>
|
| - |
|
611 |
|
| - |
|
612 |
</td>
|
| - |
|
613 |
</tr>
|
| - |
|
614 |
EOT;
|
| - |
|
615 |
// si le fichier alcasar-mail.conf n'existe pas
|
| - |
|
616 |
} else {
|
| - |
|
617 |
|
| - |
|
618 |
echo <<<EOT
|
| - |
|
619 |
<tr align="center">
|
| - |
|
620 |
<td><b>POSTFIX n'est pas configuré par ALCASAR.</b></td>
|
| - |
|
621 |
</tr>
|
| - |
|
622 |
EOT;
|
| - |
|
623 |
|
| - |
|
624 |
}
|
| - |
|
625 |
|
| - |
|
626 |
// Partie de paramétrage de la configuration
|
| - |
|
627 |
|
| - |
|
628 |
// Configuration de l'adresse email de l'administrateur
|
| - |
|
629 |
echo <<<EOT
|
| - |
|
630 |
</table><br>
|
| - |
|
631 |
</div>
|
| - |
|
632 |
</div><br>
|
| - |
|
633 |
<div class="panel">
|
| - |
|
634 |
<div class="panel-header">POSTFIX Configuration</div>
|
| - |
|
635 |
<div class="panel-row conf" id="conf">
|
| - |
|
636 |
<table width="100%" border=0 cellspacing=0 cellpadding=0><br>
|
| - |
|
637 |
<tr align="center">
|
| - |
|
638 |
<td><input type="radio" name="conf" class="mail" value="One"/><b>Service autonome</b></td>
|
| - |
|
639 |
<td><input type="radio" name="conf" class="mail" value="Two"/><b>Service relay</b></td>
|
| - |
|
640 |
<td><input type="radio" name="conf" class="mail" value="Three"/> <b>Adresse mail</b></td>
|
| - |
|
641 |
</tr>
|
| - |
|
642 |
</table><br>
|
| - |
|
643 |
</div>
|
| - |
|
644 |
<div class="myDiv hide" id="showOne">
|
| - |
|
645 |
<table width="100%" border=0 cellspacing=0 cellpadding=0><br>
|
| - |
|
646 |
<tr align="center">
|
| - |
|
647 |
<td><b>Serveur mail est autonome :</b></td>
|
| - |
|
648 |
</tr>
|
| - |
|
649 |
<tr align="center">
|
| - |
|
650 |
<td>
|
| - |
|
651 |
<form action="$php_self" method="post">
|
| - |
|
652 |
<input type="hidden" name="testConf" value="1">
|
| - |
|
653 |
<input type="submit" class="btn btn-default" name="submit" value="Configurer"><br>
|
| - |
|
654 |
</form>
|
| - |
|
655 |
</td>
|
| - |
|
656 |
</tr>
|
| - |
|
657 |
</table>
|
| - |
|
658 |
</div>
|
| - |
|
659 |
|
| - |
|
660 |
<div class="myDiv hide" id="showTwo">
|
| - |
|
661 |
<table width="100%" border=0 cellspacing=0 cellpadding=0><br>
|
| - |
|
662 |
<form action="$php_self" method="post">
|
| - |
|
663 |
<tr align="center">
|
| - |
|
664 |
<td colspan="2"><b>SMTP Relais :</b></td>
|
| - |
|
665 |
</tr>
|
| - |
|
666 |
<tr align="center">
|
| - |
|
667 |
<td colspan="2">Postfix envois, ralaye les emails sorants à un autre serveur SMTP.</td>
|
| - |
|
668 |
</tr>
|
| - |
|
669 |
<tr>
|
| - |
|
670 |
<td><label>Enterez le serveur SMTP relai en FQDN ou IP</label></td>
|
| - |
|
671 |
<td><input type="text" name="smtp" placeholder="SMTP" required/></td>
|
| - |
|
672 |
</tr>
|
| - |
|
673 |
<tr>
|
| - |
|
674 |
<td><label>Enterez le port SMTP</label></td>
|
| - |
|
675 |
<td><input type="text" name="port" placeholder="port" required/></td>
|
| - |
|
676 |
</tr>
|
| - |
|
677 |
<tr>
|
| - |
|
678 |
<td><label>Enterez l'IP du serveur SMTP relais (0.0.0.0/0 si c'est dynamique/par défaut si vide)</label></td>
|
| - |
|
679 |
<td><input type="text" name="smtpIP" placeholder="IP du SMTP relais" required/></td>
|
| - |
|
680 |
</tr>
|
| - |
|
681 |
<tr align="center">
|
| - |
|
682 |
<td colspan="2">
|
| - |
|
683 |
<input type="hidden" name="testConf" value="2">
|
| - |
|
684 |
<input type="submit" class="btn btn-default" name="submit" value="Valider"><br>
|
| - |
|
685 |
</td>
|
| - |
|
686 |
</tr>
|
| - |
|
687 |
</form>
|
| - |
|
688 |
</table><br>
|
| - |
|
689 |
</div>
|
| - |
|
690 |
|
| - |
|
691 |
<div class="myDiv hide" id="showThree">
|
| - |
|
692 |
<table width="100%" border=0 cellspacing=0 cellpadding=0><br>
|
| - |
|
693 |
<form method="post" action="$php_self">
|
| - |
|
694 |
<tr colspan="2" align="center">
|
| - |
|
695 |
<td><b>Configuration de serveur mail via un compte email :</b></td>
|
| - |
|
696 |
</tr>
|
| - |
|
697 |
<tr align="center">
|
| - |
|
698 |
<td>
|
| - |
|
699 |
<table class="table table-striped">
|
| - |
|
700 |
<tr>
|
| - |
|
701 |
<td><label>Entez votre email</label></td>
|
| - |
|
702 |
<td><input type="email" name="mailAddr" placeholder="Enter your email" required/></td>
|
| - |
|
703 |
</tr>
|
| - |
|
704 |
<tr>
|
| - |
|
705 |
<td><label>Entez le mot de passe</label></td>
|
| - |
|
706 |
<td><input type="password" id="pswd1" name="pswd1" required/></td>
|
| - |
|
707 |
</tr>
|
| - |
|
708 |
<tr>
|
| - |
|
709 |
<td><label>Confirmer le mot de passe</label></td>
|
| - |
|
710 |
<td><input type="password" id="pswd2" name="pswd2" required/></td>
|
| - |
|
711 |
</tr>
|
| - |
|
712 |
|
| - |
|
713 |
</table>
|
| - |
|
714 |
<table class="table table-striped">
|
| - |
|
715 |
<thead>
|
| - |
|
716 |
<tr>
|
| - |
|
717 |
<th scope="col">#</th>
|
| - |
|
718 |
<th scope="col">compte de messagerie</th>
|
| - |
|
719 |
<th scope="col">adresse de messagerie</th>
|
| - |
|
720 |
<th scope="col">serveur sortant</th>
|
| - |
|
721 |
<th scope="col">port sortant</th>
|
| - |
|
722 |
</tr>
|
| - |
|
723 |
</thead>
|
| - |
|
724 |
<tbody>
|
| - |
|
725 |
EOT;
|
| - |
|
726 |
$smtpsConf = [
|
| - |
|
727 |
["Orange", "Orange/Wanadoo", "orange.fr /wanadoo.fr", "smtp.orange.fr", 465],
|
| - |
|
728 |
["Hotmail", "Hotmail", "hotmail.com/.fr / live.com/.fr / msn.com", "smtp.live.com", 587],
|
| - |
|
729 |
["Outlook", "Outlook", "hotmail.xx/live.xx/msn.com/outlook/office365", "smtp.office365.com", 587],
|
| - |
|
730 |
["SFR", "SFR", "sfr.fr", "smtp.sfr.fr", 465],
|
| - |
|
731 |
["Free", "Free", "free.fr", "smtp.free.fr", 465],
|
| - |
|
732 |
["Gmail", "Gmail", "gmail.com", "smtp.gmail.com", 587],
|
| - |
|
733 |
["Laposte", "Laposte", "laposte.net", "smtp.laposte.net", 465],
|
| - |
|
734 |
["Bouygues", "Bouygues Telecom", "bbox.fr", "smtp.bbox.fr", 587]
|
| - |
|
735 |
];
|
| - |
|
736 |
|
| - |
|
737 |
foreach( $smtpsConf as $smtpConf ) {
|
| - |
|
738 |
echo <<< EOT
|
| - |
|
739 |
<tr>
|
| - |
|
740 |
<th scope="row"><input class="form-check-input blur" type="radio" name="smtpPort" value="$smtpConf[3] $smtpConf[4]"/></th>
|
| - |
|
741 |
|
| - |
|
742 |
<td>$smtpConf[1]</td>
|
| - |
|
743 |
<td>$smtpConf[2]</td>
|
| - |
|
744 |
<td>$smtpConf[3]</td>
|
| - |
|
745 |
<td align="center">$smtpConf[4]</td>
|
| - |
|
746 |
</tr>
|
| - |
|
747 |
EOT;
|
| - |
|
748 |
}
|
| - |
|
749 |
echo<<<EOT
|
| - |
|
750 |
<tr>
|
| - |
|
751 |
<th scope="row"><input id="perso" class="form-check-input" type="radio" name="smtpPort"/></th>
|
| - |
|
752 |
<td>Personalisez votre smtp</td>
|
| - |
|
753 |
<td><input type="text" id="smtpPerso" name="smtpPerso" class="perso" oninput="valPerso()" placeholder="Entrez le serveur SMTP" disabled/></td>
|
| - |
|
754 |
<td>Personalisez le port</td>
|
| - |
|
755 |
<td><input type="text" id="portPerso" name="portPerso" class="perso" oninput="valPerso()" placeholder="Entrez le serveur Port" disabled/></td>
|
| - |
|
756 |
</tr>
|
| - |
|
757 |
</tbody>
|
| - |
|
758 |
</table>
|
| - |
|
759 |
</td>
|
| - |
|
760 |
</tr>
|
| - |
|
761 |
<tr align="center">
|
| - |
|
762 |
<td class="testConf3">
|
| - |
|
763 |
</td>
|
| - |
|
764 |
</tr>
|
| - |
|
765 |
<tr align="center">
|
| - |
|
766 |
<td>
|
| - |
|
767 |
<input type="hidden" name="testConf" value="3">
|
| - |
|
768 |
<input type="submit" class="btn btn-default" name="submit" value="Valider" id="testConf3"><br>
|
| - |
|
769 |
</td>
|
| - |
|
770 |
</tr>
|
| - |
|
771 |
</form>
|
| - |
|
772 |
</table><br>
|
| - |
|
773 |
</div>
|
| - |
|
774 |
</div><br>
|
| - |
|
775 |
<div class="panel">
|
| - |
|
776 |
<div class="panel-header">Mail admin</div>
|
| - |
|
777 |
<div class="panel-row conf" id="conf">
|
| - |
|
778 |
<table width="100%" border=0 cellspacing=0 cellpadding=0><br>
|
| - |
|
779 |
<form action="$php_self" method="post">
|
| - |
|
780 |
<tr align="center">
|
| - |
|
781 |
<td colspan="2"><b>Mail admin</b></td>
|
| - |
|
782 |
</tr>
|
| - |
|
783 |
<tr align="center">
|
| - |
|
784 |
<td colspan="2">L'adresse email de l'administrateur pour recevoir les alertes des nouvelles inscriptions, et l'archive hebdomadaire des logs</td>
|
| - |
|
785 |
</tr>
|
| - |
|
786 |
<tr>
|
| - |
|
787 |
EOT;
|
| - |
|
788 |
if (empty($adminMail)){
|
| - |
|
789 |
echo "<td><label>Enterez l'adresse email</label></td>";
|
| - |
|
790 |
} else {
|
| - |
|
791 |
echo "<td>L'email configuré actuellement est : " . $adminMail . "</td>";
|
| - |
|
792 |
}
|
| - |
|
793 |
echo <<<EOT
|
| - |
|
794 |
<td><input type="email" name="adminMail" placeholder="Enter your email" required/></td>
|
| - |
|
795 |
</tr>
|
| - |
|
796 |
|
| - |
|
797 |
<tr align="center">
|
| - |
|
798 |
<td colspan="2">
|
| - |
|
799 |
<input type="submit" class="btn btn-default" name="submit" value="Valider"><br>
|
| - |
|
800 |
</td>
|
| - |
|
801 |
</tr>
|
| - |
|
802 |
</form>
|
| - |
|
803 |
<form action="$php_self" method="post">
|
| - |
|
804 |
<tr align="center">
|
| - |
|
805 |
<td colspan="2">
|
| - |
|
806 |
<input type="hidden" name="unset" value="adminMail">
|
| - |
|
807 |
<input type="submit" class="btn btn-default" name="submit" value="Supprimer l'admin email"><br>
|
| - |
|
808 |
</td>
|
| - |
|
809 |
</tr>
|
| - |
|
810 |
</form>
|
| - |
|
811 |
</table><br>
|
| - |
|
812 |
</div>
|
| - |
|
813 |
</div><br>
|
| - |
|
814 |
<div class="panel">
|
| - |
|
815 |
<div class="panel-header">WhiteList Domains Configuration</div>
|
| - |
|
816 |
<div class="panel-row conf" id="conf">
|
| - |
|
817 |
<table width="100%" border=0 cellspacing=0 cellpadding=0><br>
|
| - |
|
818 |
<tr align="center">
|
| - |
|
819 |
<td>La liste blanche limite les inscriptions utilisateurs à un, ou plusieurs domaines.</td>
|
| - |
|
820 |
</tr>
|
| - |
|
821 |
<form method="post" action="$php_self">
|
| - |
|
822 |
<tr align="center">
|
| - |
|
823 |
<td width="50%" align="center">Mettez vos domaines à configurer. Un par ligne</td>
|
| - |
|
824 |
</tr>
|
| - |
|
825 |
<tr align="center">
|
| - |
|
826 |
<td>
|
| - |
|
827 |
<br><textarea name='wld' rows=5 cols=50 placeholder="Aucune WLD configurée actuellement"">
|
| - |
|
828 |
EOT;
|
| - |
|
829 |
if(!empty($whiteDomain)){
|
| - |
|
830 |
foreach ($whiteDomain as $domain){
|
| - |
|
831 |
echo "$domain\n";
|
| - |
|
832 |
}
|
| - |
|
833 |
}
|
| - |
|
834 |
echo<<<EOT
|
| - |
|
835 |
</textarea>
|
| - |
|
836 |
</td>
|
| - |
|
837 |
</tr>
|
| - |
|
838 |
<tr align="center">
|
| - |
|
839 |
<td colspan="2">
|
| - |
|
840 |
<br><input type="submit" class="btn btn-default" name="submit" value="Valider"><br>
|
| - |
|
841 |
</td>
|
| - |
|
842 |
</tr>
|
| - |
|
843 |
</form>
|
| - |
|
844 |
<form action="$php_self" method="post">
|
| - |
|
845 |
<tr align="center">
|
| - |
|
846 |
<td colspan="2">
|
| - |
|
847 |
<input type="hidden" name="unset" value="whiteDomain">
|
| - |
|
848 |
<input type="submit" class="btn btn-default" name="submit" value="Supprimer la WLD"><br>
|
| - |
|
849 |
</td>
|
| - |
|
850 |
</tr>
|
| - |
|
851 |
</form>
|
| - |
|
852 |
</table><br>
|
| - |
|
853 |
</div>
|
| - |
|
854 |
</div><br>
|
| - |
|
855 |
|
| - |
|
856 |
EOT;
|
| - |
|
857 |
|
| - |
|
858 |
?>
|
| - |
|
859 |
|
| - |
|
860 |
<script>
|
| - |
|
861 |
$(document).ready(function(){
|
| - |
|
862 |
$("div.hide").hide();
|
| - |
|
863 |
|
| - |
|
864 |
$('#conf input[type="radio"]').click(function(){
|
| - |
|
865 |
var value = $(this).val();
|
| - |
|
866 |
$("div.myDiv").hide();
|
| - |
|
867 |
$("#show"+value).show();
|
| - |
|
868 |
});
|
| - |
|
869 |
|
| - |
|
870 |
//On vérifie si le mot de passe est ok
|
| - |
|
871 |
$("#pswd2").keyup(function(){
|
| - |
|
872 |
if($("#pswd1").val() != "" && $("#pswd2").val() != "" && $("#pswd1").val() != $("#pswd2").val()){
|
| - |
|
873 |
$(".testConf3").html("<br>Les deux mots de passe sont différents");
|
| - |
|
874 |
$("#testConf3").attr("disabled", true);
|
| - |
|
875 |
} else {
|
| - |
|
876 |
$("#testConf3").attr("disabled", false);
|
| - |
|
877 |
$(".testConf3").fadeOut(800);
|
| - |
|
878 |
}
|
| - |
|
879 |
})
|
| - |
|
880 |
});
|
| - |
|
881 |
|
| - |
|
882 |
$('#perso').click(function(){
|
| - |
|
883 |
|
| - |
|
884 |
$(".perso").attr("disabled", false);
|
| - |
|
885 |
});
|
| - |
|
886 |
|
| - |
|
887 |
$('.blur').click(function(){
|
| - |
|
888 |
|
| - |
|
889 |
$(".perso").attr("disabled", true);
|
| - |
|
890 |
});
|
| - |
|
891 |
|
| - |
|
892 |
function valPerso(){
|
| - |
|
893 |
var valSmtpPerso = document.getElementById("smtpPerso").value;
|
| - |
|
894 |
var valPortPerso = document.getElementById("portPerso").value;
|
| - |
|
895 |
document.getElementById("perso").value = valSmtpPerso + " " + valPortPerso;
|
| - |
|
896 |
};
|
| - |
|
897 |
|
| - |
|
898 |
function hideShow(x){
|
| - |
|
899 |
$("div." + x).toggle();
|
| - |
|
900 |
var value = $("input." + x).val();
|
| - |
|
901 |
var elem = document.getElementById("btn-" + x);
|
| - |
|
902 |
if (elem.value=="Configurer"){
|
| - |
|
903 |
elem.value = "Annuler";
|
| - |
|
904 |
} else{
|
| - |
|
905 |
elem.value = "Configurer";
|
| - |
|
906 |
}
|
| - |
|
907 |
};
|
| - |
|
908 |
|
| - |
|
909 |
</script>
|
| - |
|
910 |
|
| - |
|
911 |
|
| 367 |
</body>
|
912 |
</body>
|
| 368 |
</html>
|
913 |
</html>
|
| 369 |
|
914 |
|