servnest/public/ns/dnssec.php

74 lines
1.4 KiB
PHP

<?php require "../../common/top.php"; ?>
Afin d'activer DNSSEC, vous devez indiquer un enregistrement DS à la zone parente.
<form method="post">
<select required="" name="zone" id="zone">
<option value="" disabled="" selected="">---</option>
<?php
$zones = nsListUserZones($_SESSION['username']);
if ($zones) {
foreach($zones as $zone) {
echo "<option value='" . $zone . "'>" . $zone . "</option>";
}
}
?>
</select>
<br>
<input value="Valider" type="submit">
</form>
<?php
if (isset($_POST['zone']) AND isset($_SESSION['username'])) {
antiCSRF();
nsCheckZonePossession($_POST['zone']);
$zoneContent = file_get_contents(KNOT_ZONES_PATH . "/" . $_POST['zone'] . "zone");
preg_match("#\n" . preg_quote($_POST['zone']) . "\s+0\s+CDS\s+([0-9]{1,5})\s+([0-9]{1,2})\s+([0-9])\s+([0-9A-F]{64})\n#", $zoneContent, $matches);
$tag = $matches[1];
$algo = $matches[2];
$digestType = $matches[3];
$digest = $matches[4];
?>
<dl>
<dt>Zone</dt>
<dd>
<code><?= $_POST['zone'] ?></code>
</dd>
<dt>Tag</dt>
<dd>
<code><?= $tag ?></code>
</dd>
<dt>Algorithme</dt>
<dd>
<code><?= $algo ?></code><?php if ($algo === "15") echo " (Ed25519)"; ?>
</dd>
<dt>Type de condensat</dt>
<dd>
<code><?= $digestType ?></code><?php if ($digestType === "2") echo " (SHA-256)"; ?>
</dd>
<dt>Condensat</dt>
<dd>
<code><?= $digest ?></code>
</dd>
</dl>
<?php } ?>
<?php require "../../common/bottom.php"; ?>