sshfp.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. if (processForm()) {
  3. $values = nsParseCommonRequirements();
  4. if (!($_POST['algo'] === '1' OR $_POST['algo'] === '3' OR $_POST['algo'] === '4'))
  5. output(403, 'Wrong value for <code>algo</code>.');
  6. if (!($_POST['type'] === '2'))
  7. output(403, 'Wrong value for <code>type</code>.');
  8. if (!(preg_match('/^[a-z0-9]{64}$/', $_POST['fp'])))
  9. output(403, 'Wrong value for <code>fp</code>.');
  10. knotcZoneExec($_POST['zone'], array(
  11. $values['domain'],
  12. $values['ttl'],
  13. 'SSHFP',
  14. $_POST['algo'],
  15. $_POST['type'],
  16. $_POST['fp']
  17. ));
  18. output(200, 'Enregistrement ajouté/retiré.');
  19. }
  20. ?>
  21. <p>
  22. <?= linkToDocs('record-sshfp', 'Documentation du type d\'enregistrement SSHFP') ?>
  23. </p>
  24. <form method="post">
  25. <?php require 'form.ns.php'; ?>
  26. <br>
  27. <label for="algo">Algorithme</label>
  28. <br>
  29. <select required="" name="algo" id="algo">
  30. <option value="1">1 (RSA)</option>
  31. <option value="2" disabled="">2 (DSA)</option>
  32. <option value="3">3 (ECDSA)</option>
  33. <option value="4" selected="">4 (ED25519)</option>
  34. </select>
  35. <br>
  36. <label for="type">Type de hash</label>
  37. <br>
  38. <select required="" name="type" id="type">
  39. <option value="1" disabled="">1 (SHA-1)</option>
  40. <option value="2" selected="">2 (SHA-256)</option>
  41. </select>
  42. <br>
  43. <label for="fp">Empreinte</label>
  44. <br>
  45. <input required="" id="fp" size="65" minlenght="64" maxlength="64" placeholder="26e6bbb4796c4fb78632e737d31a8acaba43c3a92d9c047031f04e9b70826e1d" name="fp" type="text">
  46. <br>
  47. <input value="Valider" type="submit">
  48. </form>