Line 1... |
Line 1... |
1 |
<?php
|
1 |
<?php
|
2 |
# $Id: network.php 3040 2022-07-17 22:31:53Z rexy $
|
2 |
# $Id: network.php 3041 2022-07-20 21:06:54Z rexy $
|
3 |
|
3 |
|
4 |
// written by steweb57, Rexy, Tom HOUDAYER & Pierre RIVAULT
|
4 |
// written by steweb57, Rexy, Tom HOUDAYER & Pierre RIVAULT
|
5 |
|
5 |
|
6 |
/********************
|
6 |
/********************
|
7 |
* READ CONF FILES *
|
7 |
* READ CONF FILES *
|
Line 78... |
Line 78... |
78 |
$l_yes = "Oui";
|
78 |
$l_yes = "Oui";
|
79 |
$l_no = "Non";
|
79 |
$l_no = "Non";
|
80 |
$l_ssl_title = "Chiffrer les flux d'authentification entre les utilisateurs et ALCASAR";
|
80 |
$l_ssl_title = "Chiffrer les flux d'authentification entre les utilisateurs et ALCASAR";
|
81 |
$l_ssh_title = "SSH";
|
81 |
$l_ssh_title = "SSH";
|
82 |
$l_ssh_port = "Port";
|
82 |
$l_ssh_port = "Port";
|
- |
|
83 |
$l_ssh_from = "IP autorisée";
|
- |
|
84 |
$l_ssh_wan_activate = "Activer SSH sur WAN";
|
83 |
$l_ssh_activate = "Activer SSH";
|
85 |
$l_ssh_lan_activate = "Activer SSH sur LAN";
|
84 |
$l_cert_expiration = "Date d'expiration :";
|
86 |
$l_cert_expiration = "Date d'expiration :";
|
85 |
$l_cert_commonname = "Nom commun :";
|
87 |
$l_cert_commonname = "Nom commun :";
|
86 |
$l_cert_organization = "Organisation :";
|
88 |
$l_cert_organization = "Organisation :";
|
87 |
$l_upload_certificate = "Importer un certificat officiel";
|
89 |
$l_upload_certificate = "Importer un certificat officiel";
|
88 |
$l_le_integration = "Intégrer un certificat Let's Encrypt";
|
90 |
$l_le_integration = "Intégrer un certificat Let's Encrypt";
|
Line 144... |
Line 146... |
144 |
$l_yes = "Si";
|
146 |
$l_yes = "Si";
|
145 |
$l_no = "No";
|
147 |
$l_no = "No";
|
146 |
$l_ssl_title = "La autenticación de cifrado fluye entre usuarios y ALCASAR";
|
148 |
$l_ssl_title = "La autenticación de cifrado fluye entre usuarios y ALCASAR";
|
147 |
$l_ssh_title = "SSH";
|
149 |
$l_ssh_title = "SSH";
|
148 |
$l_ssh_port = "Puerto";
|
150 |
$l_ssh_port = "Puerto";
|
- |
|
151 |
$l_ssh_from = "IP autorizada";
|
- |
|
152 |
$l_ssh_wan_activate = "Activar SSH on WAN";
|
149 |
$l_ssh_activate = "Activar SSH";
|
153 |
$l_ssh_lan_activate = "Activar SSH on LAN";
|
150 |
$l_cert_expiration = "Fecha de vencimiento:";
|
154 |
$l_cert_expiration = "Fecha de vencimiento:";
|
151 |
$l_cert_commonname = "Common name:";
|
155 |
$l_cert_commonname = "Common name:";
|
152 |
$l_cert_organization = "Organización:";
|
156 |
$l_cert_organization = "Organización:";
|
153 |
$l_upload_certificate = "Importar un certificado";
|
157 |
$l_upload_certificate = "Importar un certificado";
|
154 |
$l_le_integration = "Integración con Let's Encrypt";
|
158 |
$l_le_integration = "Integración con Let's Encrypt";
|
Line 209... |
Line 213... |
209 |
$l_yes = "Yes";
|
213 |
$l_yes = "Yes";
|
210 |
$l_no = "No";
|
214 |
$l_no = "No";
|
211 |
$l_ssl_title = "Cipher authentication flows between users and ALCASAR";
|
215 |
$l_ssl_title = "Cipher authentication flows between users and ALCASAR";
|
212 |
$l_ssh_title = "SSH";
|
216 |
$l_ssh_title = "SSH";
|
213 |
$l_ssh_port = "Port";
|
217 |
$l_ssh_port = "Port";
|
- |
|
218 |
$l_ssh_from = "Authorized IP";
|
- |
|
219 |
$l_ssh_wan_activate = "Activate SSH on WAN";
|
214 |
$l_ssh_activate = "Activate SSH";
|
220 |
$l_ssh_lan_activate = "Activate SSH on LAN";
|
215 |
$l_cert_expiration = "Expiration date:";
|
221 |
$l_cert_expiration = "Expiration date:";
|
216 |
$l_cert_commonname = "Common name:";
|
222 |
$l_cert_commonname = "Common name:";
|
217 |
$l_cert_organization = "Organization:";
|
223 |
$l_cert_organization = "Organization:";
|
218 |
$l_upload_certificate = "Import an officlal certificate";
|
224 |
$l_upload_certificate = "Import an officlal certificate";
|
219 |
$l_le_integration = "Integrate a Let's Encrypt certificate";
|
225 |
$l_le_integration = "Integrate a Let's Encrypt certificate";
|
Line 371... |
Line 377... |
371 |
if (file_exists($scpath)) unlink($scpath);
|
377 |
if (file_exists($scpath)) unlink($scpath);
|
372 |
}
|
378 |
}
|
373 |
}
|
379 |
}
|
374 |
}
|
380 |
}
|
375 |
break;
|
381 |
break;
|
- |
|
382 |
case 'enable_lan_ssh': // Activate SSH on LAN
|
- |
|
383 |
if (isset($_POST['sshlan'])) {
|
- |
|
384 |
exec('sudo /usr/local/bin/alcasar-ssh.sh --on -l');
|
- |
|
385 |
header('Location: '.$_SERVER['PHP_SELF']);
|
- |
|
386 |
} else{
|
- |
|
387 |
exec('sudo /usr/local/bin/alcasar-ssh.sh --off -l');
|
- |
|
388 |
header('Location: '.$_SERVER['PHP_SELF']);
|
- |
|
389 |
}
|
- |
|
390 |
exit();
|
376 |
case 'enable_wan_ssh': // Activate SSH on WAN
|
391 |
case 'enable_wan_ssh': // Activate SSH on WAN
|
377 |
if (isset($_POST['togglessh'])) {
|
392 |
if (isset($_POST['togglessh'])) {
|
378 |
exec('sudo /usr/local/bin/alcasar-ssh.sh --on -p'.escapeshellarg($_POST["ssh_port"]));
|
393 |
exec('sudo /usr/local/bin/alcasar-ssh.sh --on -w -p'.escapeshellarg($_POST["ssh_port"]).' -i'.escapeshellarg($_POST["ssh_from"]),$output,$exitCode);
|
- |
|
394 |
if($exitCode === 1){
|
- |
|
395 |
echo("<html><script>if(!alert(`$l_error_bad_ip_port`)){window.location.href = window.location.href;}</script></html>");
|
- |
|
396 |
}else{
|
- |
|
397 |
header('Location: '.$_SERVER['PHP_SELF']);
|
- |
|
398 |
}
|
379 |
} else{
|
399 |
} else{
|
380 |
exec('sudo /usr/local/bin/alcasar-ssh.sh --off');
|
400 |
exec('sudo /usr/local/bin/alcasar-ssh.sh --off -w');
|
- |
|
401 |
header('Location: '.$_SERVER['PHP_SELF']);
|
381 |
}
|
402 |
}
|
382 |
header('Location: '.$_SERVER['PHP_SELF']);
|
- |
|
383 |
exit();
|
403 |
exit();
|
384 |
case 'https_login': // Set HTTPS login status
|
404 |
case 'https_login': // Set HTTPS login status
|
385 |
if ($_POST['https_login'] === 'on') {
|
405 |
if (isset($_POST['https_login'])) {
|
386 |
exec('sudo /usr/local/bin/alcasar-https.sh --on');
|
406 |
exec('sudo /usr/local/bin/alcasar-https.sh --on');
|
387 |
} else {
|
407 |
} else {
|
388 |
exec('sudo /usr/local/bin/alcasar-https.sh --off');
|
408 |
exec('sudo /usr/local/bin/alcasar-https.sh --off');
|
389 |
}
|
409 |
}
|
390 |
header('Location: '.$_SERVER['PHP_SELF']);
|
410 |
header('Location: '.$_SERVER['PHP_SELF']);
|
Line 1165... |
Line 1185... |
1165 |
<br>
|
1185 |
<br>
|
1166 |
<div class="panel">
|
1186 |
<div class="panel">
|
1167 |
<div class="panel-header"><?= $l_ssl_title ?></div>
|
1187 |
<div class="panel-header"><?= $l_ssl_title ?></div>
|
1168 |
<div class="panel-row">
|
1188 |
<div class="panel-row">
|
1169 |
<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
|
1189 |
<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
|
1170 |
<input type="hidden" name="choix" value="https_login">
|
1190 |
<input type="hidden" name="choix" value="https_login">
|
1171 |
<select name="https_login">
|
- |
|
1172 |
<option value="on"<?= (($conf['HTTPS_LOGIN'] === 'on') ? ' selected' : '') ?>><?= $l_yes ?></option>
|
1191 |
<input type="checkbox" name="https_login" id="https_login" <?= ($conf['HTTPS_LOGIN'] === 'on')? "checked": "" ?>><b><?= $l_ssl_title ?></b><br>
|
1173 |
<option value="off"<?= (($conf['HTTPS_LOGIN'] === 'off') ? ' selected' : '') ?>><?= $l_no ?></option>
|
- |
|
1174 |
</select>
|
- |
|
1175 |
<input type="submit" onClick="document.getElementById('ldoverlay').style.display='block';" value="<?= $l_apply ?>"><br>
|
1192 |
<input type="submit" onClick="document.getElementById('ldoverlay').style.display='block';" value="<?= $l_apply ?>"><br>
|
1176 |
</form>
|
1193 |
</form>
|
1177 |
</div>
|
1194 |
</div>
|
1178 |
</div>
|
1195 |
</div>
|
1179 |
<br>
|
1196 |
<br>
|
1180 |
<div class="panel">
|
1197 |
<div class="panel">
|
1181 |
<div class="panel-header"><?= $l_ssh_title ?></div>
|
1198 |
<div class="panel-header"><?= $l_ssh_title ?></div>
|
- |
|
1199 |
<table width="100%" cellspacing="0" cellpadding="5" border="1">
|
- |
|
1200 |
<tr>
|
- |
|
1201 |
<td width="50%" align="center">
|
1182 |
<div class="panel-row">
|
1202 |
<div class="panel-row">
|
1183 |
<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
|
1203 |
<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
|
- |
|
1204 |
<input type="hidden" name="choix" value="enable_lan_ssh">
|
- |
|
1205 |
<input type="checkbox" name="sshlan" id="sshlan" <?= $conf['SSH_LAN'] === 'on' ? "checked": "" ?>> <b><?= $l_ssh_lan_activate ?></b><br><br>
|
- |
|
1206 |
<input type="submit" onClick="document.getElementById('ldoverlay').style.display='block';" value="<?= $l_apply ?>"><br>
|
- |
|
1207 |
</form>
|
- |
|
1208 |
</div>
|
- |
|
1209 |
</td>
|
- |
|
1210 |
<td width="50%" align="center">
|
- |
|
1211 |
<div class="panel-row">
|
- |
|
1212 |
<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
|
1184 |
<input type="hidden" name="choix" value="enable_wan_ssh">
|
1213 |
<input type="hidden" name="choix" value="enable_wan_ssh">
|
1185 |
<input type="checkbox" name="togglessh" id="togglessh" <?= is_numeric($conf['SSH_WAN'])? "checked": "" ?> onchange="document.getElementById('sshtable').style.display = this.checked ? 'block' : 'none';"> <b>Activer SSH <!-- TODO : Mettre traduction --></b><br>
|
1214 |
<input type="checkbox" name="togglessh" id="togglessh" <?= is_numeric($conf['SSH_WAN'])? "checked": "" ?> onchange="document.getElementById('sshtable').style.display = this.checked ? 'block' : 'none';"> <b><?= $l_ssh_wan_activate ?></b><br><br>
|
1186 |
<div id="sshtable" style="display:<?= is_numeric($conf['SSH_WAN'])? "block": "none" ?>">
|
1215 |
<div id="sshtable" style="display:<?= is_numeric($conf['SSH_WAN'])? "block": "none" ?>">
|
- |
|
1216 |
<table cellspacing="2" cellpadding="3" border="1">
|
- |
|
1217 |
<tr>
|
- |
|
1218 |
<th><?= $l_ssh_port ?></th><th><?= $l_ssh_from ?></th>
|
- |
|
1219 |
</tr>
|
- |
|
1220 |
<tr>
|
1187 |
<label for="ssh_port"><?= $l_ssh_port ?></label> : <input style="width:120px" type="text" id="ssh_port" name="ssh_port" value="<?= is_numeric($conf['SSH_WAN']) ? $conf['SSH_WAN']:22 ?>" /><br>
|
1221 |
<td><input style="width:120px" type="text" id="ssh_port" name="ssh_port" value="<?= is_numeric($conf['SSH_WAN']) ? $conf['SSH_WAN']:22 ?>" /></td>
|
- |
|
1222 |
<td><input style="width:120px" type="text" id="ssh_from" name="ssh_from" value="<?= $conf['SSH_ADMIN_FROM'] ?>" /></td>
|
- |
|
1223 |
</tr>
|
- |
|
1224 |
</table>
|
- |
|
1225 |
<p>Activer sur tout réseau : 0.0.0.0/0</p>
|
1188 |
</div>
|
1226 |
</div>
|
1189 |
<input type="submit" onClick="document.getElementById('ldoverlay').style.display='block';" value="<?= $l_apply ?>"><br>
|
1227 |
<input type="submit" onClick="document.getElementById('ldoverlay').style.display='block';" value="<?= $l_apply ?>"><br>
|
1190 |
</form>
|
1228 |
</form>
|
1191 |
</div>
|
1229 |
</div>
|
- |
|
1230 |
</td>
|
- |
|
1231 |
</tr>
|
- |
|
1232 |
</table>
|
1192 |
</div>
|
1233 |
</div>
|
1193 |
<br>
|
1234 |
<br>
|
1194 |
<div class="panel">
|
1235 |
<div class="panel">
|
1195 |
<div class="panel-header"><?= $l_import_cert ?></div>
|
1236 |
<div class="panel-header"><?= $l_import_cert ?></div>
|
1196 |
<div class="panel-row">
|
1237 |
<div class="panel-row">
|