servnest/pages/ns/sshfp.php

65 lines
1.5 KiB
PHP

<?php
if (processForm()) {
$values = nsParseCommonRequirements();
if (!($_POST['algo'] === '1' OR $_POST['algo'] === '3' OR $_POST['algo'] === '4'))
output(403, 'Wrong value for <code>algo</code>.');
if (!($_POST['type'] === '2'))
output(403, 'Wrong value for <code>type</code>.');
if (!(preg_match('/^[a-z0-9]{64}$/D', $_POST['fp'])))
output(403, 'Wrong value for <code>fp</code>.');
knotcZoneExec($_POST['zone'], array(
$values['domain'],
$values['ttl'],
'SSHFP',
$_POST['algo'],
$_POST['type'],
$_POST['fp']
));
output(200, 'Enregistrement ajouté/retiré.');
}
?>
<p>
<?= linkToDocs('record-sshfp', 'Documentation du type d\'enregistrement SSHFP') ?>
</p>
<form method="post">
<?php require 'form.ns.php'; ?>
<br>
<label for="algo">Algorithme</label>
<br>
<select required="" name="algo" id="algo">
<option value="1">1 (RSA)</option>
<option value="2" disabled="">2 (DSA)</option>
<option value="3">3 (ECDSA)</option>
<option value="4" selected="">4 (ED25519)</option>
</select>
<br>
<label for="type">Type de hash</label>
<br>
<select required="" name="type" id="type">
<option value="1" disabled="">1 (SHA-1)</option>
<option value="2" selected="">2 (SHA-256)</option>
</select>
<br>
<label for="fp">Empreinte</label>
<br>
<input required="" id="fp" size="65" minlenght="64" maxlength="64" placeholder="26e6bbb4796c4fb78632e737d31a8acaba43c3a92d9c047031f04e9b70826e1d" name="fp" type="text">
<br>
<input value="Valider" type="submit">
</form>