Subversion Repositories ALCASAR

Rev

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

Rev 2979 Rev 3028
Line 1... Line 1...
1
<?php
1
<?php
2
# $Id: network.php 2979 2021-07-22 20:14:04Z rexy $
2
# $Id: network.php 3028 2022-06-30 22:25:09Z 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 918... Line 918...
918
		});
918
		});
919
	});
919
	});
920
	</script>
920
	</script>
921
</head>
921
</head>
922
<body>
922
<body>
-
 
923
<div id="ldoverlay" class="overlay">
-
 
924
	<div class="lds-spinner" id="spinner"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div>
-
 
925
</div>
923
<div class="panel">
926
<div class="panel">
924
	<div class="panel-header"><?= $l_network_title ?></div>
927
	<div class="panel-header"><?= $l_network_title ?></div>
925
	<div class="panel-row">
928
	<div class="panel-row">
926
		<form action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>" method="post">
929
		<form action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>" method="post">
927
			<div class="network-configurator">
930
			<div class="network-configurator">
Line 1012... Line 1015...
1012
                echo '<span id="change_success" style="color:green">'.$l_change_successful.'</span>';
1015
                echo '<span id="change_success" style="color:green">'.$l_change_successful.'</span>';
1013
            }?>
1016
            }?>
1014
			<hr>
1017
			<hr>
1015
			<div style="text-align: center; margin: 5px">
1018
			<div style="text-align: center; margin: 5px">
1016
				<input type="hidden" name="choix" value="network_change">
1019
				<input type="hidden" name="choix" value="network_change">
1017
				<input type="submit" value="<?= $l_apply ?>">
1020
				<input type="submit" onClick="document.getElementById('ldoverlay').style.display='block';" value="<?= $l_apply ?>">
1018
			</div>
1021
			</div>
1019
		</form>
1022
		</form>
1020
	</div>
1023
	</div>
1021
</div>
1024
</div>
1022
<br>
1025
<br>
Line 1059... Line 1062...
1059
		}
1062
		}
1060
		?>
1063
		?>
1061
		</table>
1064
		</table>
1062
		<?php if ($line_exist): ?>
1065
		<?php if ($line_exist): ?>
1063
			<input type="hidden" name="choix" value="del_mac">
1066
			<input type="hidden" name="choix" value="del_mac">
1064
			<input type="submit" value="<?= $l_apply ?>">
1067
			<input type="submit" onClick="document.getElementById('ldoverlay').style.display='block';" value="<?= $l_apply ?>">
1065
		<?php endif; ?>
1068
		<?php endif; ?>
1066
		</form>
1069
		</form>
1067
	</td><td width="50%" valign="middle" align="center">
1070
	</td><td width="50%" valign="middle" align="center">
1068
		<form name="new_mac" action="network.php" method="POST">
1071
		<form name="new_mac" action="network.php" method="POST">
1069
			<table cellspacing="2" cellpadding="3" border="1">
1072
			<table cellspacing="2" cellpadding="3" border="1">
Line 1072... Line 1075...
1072
				<tr><td><input type="text" name="add_mac" size="17"></td>
1075
				<tr><td><input type="text" name="add_mac" size="17"></td>
1073
				<td><input type="text" name="add_ip" size="10"></td>
1076
				<td><input type="text" name="add_ip" size="10"></td>
1074
				<td><input type="text" name="info" size="10"></td>
1077
				<td><input type="text" name="info" size="10"></td>
1075
				<td>
1078
				<td>
1076
					<input type="hidden" name="choix" value="new_mac">
1079
					<input type="hidden" name="choix" value="new_mac">
1077
					<input type="submit" class="button" value="<?= $l_add_to_list ?>" onclick="return MAC_Control('new_mac');">
1080
					<input type="submit" onClick="document.getElementById('ldoverlay').style.display='block';" class="button" value="<?= $l_add_to_list ?>" onclick="return MAC_Control('new_mac');">
1078
				</td>
1081
				</td>
1079
			</tr></table>
1082
			</tr></table>
1080
		</form>
1083
		</form>
1081
	</td></tr>
1084
	</td></tr>
1082
</table>
1085
</table>
Line 1117... Line 1120...
1117
			}
1120
			}
1118
			?>
1121
			?>
1119
			</table>
1122
			</table>
1120
			<?php if ($line_exist): ?>
1123
			<?php if ($line_exist): ?>
1121
				<input type="hidden" name="choix" value="del_host">
1124
				<input type="hidden" name="choix" value="del_host">
1122
				<input type="submit" value="<?= $l_apply ?>">
1125
				<input type="submit" onClick="document.getElementById('ldoverlay').style.display='block';" value="<?= $l_apply ?>">
1123
			<?php endif; ?>
1126
			<?php endif; ?>
1124
			</form>
1127
			</form>
1125
		</td>
1128
		</td>
1126
		<td width="50%" valign="middle" align="center">
1129
		<td width="50%" valign="middle" align="center">
1127
			<form name="new_host" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>" method="POST">
1130
			<form name="new_host" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>" method="POST">
Line 1133... Line 1136...
1133
				<td>Ex. : 192.168.182.10</td><td>Ex. : my_nas</td><td></td>
1136
				<td>Ex. : 192.168.182.10</td><td>Ex. : my_nas</td><td></td>
1134
			</tr>
1137
			</tr>
1135
			<tr>
1138
			<tr>
1136
				<td><input type="text" name="add_ip" size="10"><input type="hidden" name="choix" value="new_host"></td>
1139
				<td><input type="text" name="add_ip" size="10"><input type="hidden" name="choix" value="new_host"></td>
1137
				<td><input type="text" name="add_host" size="17"></td>
1140
				<td><input type="text" name="add_host" size="17"></td>
1138
				<td><input type=submit class=button value="<?= $l_add_to_list ?>"></td>
1141
				<td><input type="submit" onClick="document.getElementById('ldoverlay').style.display='block';" class="button" value="<?= $l_add_to_list ?>"></td>
1139
			</tr>
1142
			</tr>
1140
			</table>
1143
			</table>
1141
			</form>
1144
			</form>
1142
		</td>
1145
		</td>
1143
	</tr>
1146
	</tr>
Line 1150... Line 1153...
1150
		<input type="hidden" name="choix" value="https_login">
1153
		<input type="hidden" name="choix" value="https_login">
1151
		<select name="https_login">
1154
		<select name="https_login">
1152
			<option value="on"<?=  (($conf['HTTPS_LOGIN'] === 'on')  ? ' selected' : '') ?>><?= $l_yes ?></option>
1155
			<option value="on"<?=  (($conf['HTTPS_LOGIN'] === 'on')  ? ' selected' : '') ?>><?= $l_yes ?></option>
1153
			<option value="off"<?= (($conf['HTTPS_LOGIN'] === 'off') ? ' selected' : '') ?>><?= $l_no ?></option>
1156
			<option value="off"<?= (($conf['HTTPS_LOGIN'] === 'off') ? ' selected' : '') ?>><?= $l_no ?></option>
1154
		</select>
1157
		</select>
1155
		<input type="submit" value="<?= $l_apply ?>"><br>
1158
		<input type="submit" onClick="document.getElementById('ldoverlay').style.display='block';" value="<?= $l_apply ?>"><br>
1156
		</form>
1159
		</form>
1157
	</div>
1160
	</div>
1158
</div>
1161
</div>
1159
<br>
1162
<br>
1160
<div class="panel">
1163
<div class="panel">
Line 1178... Line 1181...
1178
		<div class="panel-cell">
1181
		<div class="panel-cell">
1179
			<?
1182
			<?
1180
			if (file_exists('/etc/pki/tls/certs/alcasar.crt.old') && file_exists('/etc/pki/tls/private/alcasar.key.old')){ // An old default certificate exist ?
1183
			if (file_exists('/etc/pki/tls/certs/alcasar.crt.old') && file_exists('/etc/pki/tls/private/alcasar.key.old')){ // An old default certificate exist ?
1181
				echo "<form method=\"post\" action=\"".htmlspecialchars($_SERVER['PHP_SELF'])."\">\n";
1184
				echo "<form method=\"post\" action=\"".htmlspecialchars($_SERVER['PHP_SELF'])."\">\n";
1182
				echo "\t\t\t\t<input type=\"hidden\" name=\"choix\" value=\"set_default_cert\">\n";
1185
				echo "\t\t\t\t<input type=\"hidden\" name=\"choix\" value=\"set_default_cert\">\n";
1183
				echo "\t\t\t\t<input type=\"submit\" value=\"$l_default_cert\"> (alcasar.localdomain)<br>\n";
1186
				echo "\t\t\t\t<input type=\"submit\" onClick=\"document.getElementById('ldoverlay').style.display='block';\" value=\"$l_default_cert\"> (alcasar.localdomain)<br>\n";
1184
				echo "\t\t\t</form>\n";}
1187
				echo "\t\t\t</form>\n";}
1185
			if (!empty($LE_conf['domainRequest']) && ($domain != $LE_conf['domainRequest'])) { // A Let's encrypt certificate exist & it's not the active one ?
1188
			if (!empty($LE_conf['domainRequest']) && ($domain != $LE_conf['domainRequest'])) { // A Let's encrypt certificate exist & it's not the active one ?
1186
				echo "\t\t\t<form method=\"post\" action=\"".htmlspecialchars($_SERVER['PHP_SELF'])."\">\n";
1189
				echo "\t\t\t<form method=\"post\" action=\"".htmlspecialchars($_SERVER['PHP_SELF'])."\">\n";
1187
				echo "\t\t\t\t<input type=\"hidden\" name=\"choix\" value=\"set_last_LE_cert\">\n";
1190
				echo "\t\t\t\t<input type=\"hidden\" name=\"choix\" value=\"set_last_LE_cert\">\n";
1188
				echo "\t\t\t\t<input type=\"submit\" value=\"".$l_previous_LE_cert."\"> (".$LE_conf['domainRequest'].")\n";
1191
				echo "\t\t\t\t<input type=\"submit\" onClick=\"document.getElementById('ldoverlay').style.display='block';\" value=\"".$l_previous_LE_cert."\"> (".$LE_conf['domainRequest'].")\n";
1189
				echo "\t\t\t</form>\n";}
1192
				echo "\t\t\t</form>\n";}
1190
			?>
1193
			?>
1191
		</div>
1194
		</div>
1192
	</div>
1195
	</div>
1193
	<div class="panel-row">
1196
	<div class="panel-row">
Line 1196... Line 1199...
1196
			<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>" enctype="multipart/form-data">
1199
			<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>" enctype="multipart/form-data">
1197
				<?= $l_private_key;?> <input type="file" name="key"><br>
1200
				<?= $l_private_key;?> <input type="file" name="key"><br>
1198
				<?= $l_certificate;?> <input type="file" name="crt"><br>
1201
				<?= $l_certificate;?> <input type="file" name="crt"><br>
1199
				<?= $l_server_chain;?> <input type="file" name="sc"><br>
1202
				<?= $l_server_chain;?> <input type="file" name="sc"><br>
1200
				<input type="hidden" name="choix" value="import_cert">
1203
				<input type="hidden" name="choix" value="import_cert">
1201
				<input type="submit" value="<?= $l_import ?>">
1204
				<input type="submit" onClick="document.getElementById('ldoverlay').style.display='block';" value="<?= $l_import ?>">
1202
			</form>
1205
			</form>
1203
		</div>
1206
		</div>
1204
		<div class="panel-cell">
1207
		<div class="panel-cell">
1205
			<?php
1208
			<?php
1206
			// Get step
1209
			// Get step
Line 1219... Line 1222...
1219
				<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
1222
				<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
1220
					<input type="hidden" name="choix" value="le_issueCert">
1223
					<input type="hidden" name="choix" value="le_issueCert">
1221
					<?= $l_le_status ?> <?= $l_disabled ?><br>
1224
					<?= $l_le_status ?> <?= $l_disabled ?><br>
1222
					<?= $l_le_email ?> <input type="text" name="email" placeholder="adresse@email.com"<?= ((!empty($LE_conf['email'])) ? ' value="'.$LE_conf['email'].'"' : '') ?>><br>
1225
					<?= $l_le_email ?> <input type="text" name="email" placeholder="adresse@email.com"<?= ((!empty($LE_conf['email'])) ? ' value="'.$LE_conf['email'].'"' : '') ?>><br>
1223
					<?= $l_le_domain_name ?> <input type="text" name="domainname" placeholder="alcasar.domain.tld" required><br>
1226
					<?= $l_le_domain_name ?> <input type="text" name="domainname" placeholder="alcasar.domain.tld" required><br>
1224
					<input type="submit" name="issue" value="<?= $l_send ?>"><br>
1227
					<input type="submit" onClick="document.getElementById('ldoverlay').style.display='block';" name="issue" value="<?= $l_send ?>"><br>
1225
				</form>
1228
				</form>
1226
			<?php elseif ($step === 2): ?>
1229
			<?php elseif ($step === 2): ?>
1227
				<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
1230
				<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
1228
					<input type="hidden" name="choix" value="le_renewCert">
1231
					<input type="hidden" name="choix" value="le_renewCert">
1229
					<?= $l_le_status ?> <?= $l_pending_validation ?><br>
1232
					<?= $l_le_status ?> <?= $l_pending_validation ?><br>
1230
					<?= $l_le_domain_name ?> <?= $LE_conf['domainRequest'] ?><br>
1233
					<?= $l_le_domain_name ?> <?= $LE_conf['domainRequest'] ?><br>
1231
					<?= $l_le_ask_on ?> <?= date('d-m-Y H:i:s', $LE_conf['dateIssueRequest']) ?><br>
1234
					<?= $l_le_ask_on ?> <?= date('d-m-Y H:i:s', $LE_conf['dateIssueRequest']) ?><br>
1232
					<?= $l_le_dns_entry_txt ?> "<?= '_acme-challenge.'.$LE_conf['domainRequest'] ?>"<br>
1235
					<?= $l_le_dns_entry_txt ?> "<?= '_acme-challenge.'.$LE_conf['domainRequest'] ?>"<br>
1233
					<?= $l_le_challenge ?> "<?= $LE_conf['challenge'] ?>"<br>
1236
					<?= $l_le_challenge ?> "<?= $LE_conf['challenge'] ?>"<br>
1234
					<input type="submit" name="recheck" value="<?= $l_recheck ?>"> <input type="submit" name="cancel" value="<?= $l_cancel ?>"><br>
1237
					<input type="submit" onClick="document.getElementById('ldoverlay').style.display='block';" name="recheck" value="<?= $l_recheck ?>"> <input type="submit" onClick="document.getElementById('ldoverlay').style.display='block';" name="cancel" value="<?= $l_cancel ?>"><br>
1235
				</form>
1238
				</form>
1236
			<?php elseif ($step === 3): ?>
1239
			<?php elseif ($step === 3): ?>
1237
				<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
1240
				<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
1238
					<input type="hidden" name="choix" value="le_renewCert">
1241
					<input type="hidden" name="choix" value="le_renewCert">
1239
					<?= $l_le_status ?> <?= $l_enabled ?><br>
1242
					<?= $l_le_status ?> <?= $l_enabled ?><br>
1240
					<?= $l_le_domain_name ?> <?= $LE_conf['domainRequest'] ?><br>
1243
					<?= $l_le_domain_name ?> <?= $LE_conf['domainRequest'] ?><br>
1241
					<?= $l_le_api ?>  <?= $LE_conf['dnsapi'] ?><br>
1244
					<?= $l_le_api ?>  <?= $LE_conf['dnsapi'] ?><br>
1242
					<?= $l_le_next_renewal ?> <?= date('d-m-Y', $LE_conf['dateNextRenewal']) ?><br>
1245
					<?= $l_le_next_renewal ?> <?= date('d-m-Y', $LE_conf['dateNextRenewal']) ?><br>
1243
					<?php if ($LE_conf['dateNextRenewal'] <= date('U')): ?>
1246
					<?php if ($LE_conf['dateNextRenewal'] <= date('U')): ?>
1244
						<input type="submit" name="recheck" value="<?= $l_renew ?>"><br>
1247
						<input type="submit" onClick="document.getElementById('ldoverlay').style.display='block';" name="recheck" value="<?= $l_renew ?>"><br>
1245
					<?php else: ?>
1248
					<?php else: ?>
1246
						<input type="submit" name="recheck_force" value="<?= $l_renew_force ?>"><br>
1249
						<input type="submit" onClick="document.getElementById('ldoverlay').style.display='block';" name="recheck_force" value="<?= $l_renew_force ?>"><br>
1247
					<?php endif; ?>
1250
					<?php endif; ?>
1248
				</form>
1251
				</form>
1249
			<?php endif; ?>
1252
			<?php endif; ?>
1250
			<?php if (isset($cmdResponse)): ?>
1253
			<?php if (isset($cmdResponse)): ?>
1251
				<p><?= $cmdResponse ?></p>
1254
				<p><?= $cmdResponse ?></p>