tlsa.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. if (processForm()) {
  3. $values = nsParseCommonRequirements();
  4. if (!($_POST['use'] >= 0 AND $_POST['use'] <= 3))
  5. output(403, 'Wrong value for <code>use</code>.');
  6. if (!($_POST['selector'] === '0' OR $_POST['selector'] === '1'))
  7. output(403, 'Wrong value for <code>selector</code>.');
  8. if (!($_POST['type'] >= 0 AND $_POST['type'] <= 2))
  9. output(403, 'Wrong value for <code>type</code>.');
  10. if (!(preg_match('/^[a-zA-Z0-9.-]{1,1024}$/', $_POST['content'])))
  11. output(403, 'Wrong value for <code>content</code>.');
  12. knotcZoneExec($_POST['zone'], array(
  13. $values['domain'],
  14. $values['ttl'],
  15. 'TLSA',
  16. $_POST['use'],
  17. $_POST['selector'],
  18. $_POST['type'],
  19. $_POST['content']
  20. ));
  21. output(200, 'Enregistrement ajouté/retiré.');
  22. }
  23. ?>
  24. <p>
  25. <?= linkToDocs('record-tlsa', 'Documentation du type d\'enregistrement TLSA') ?>
  26. </p>
  27. <form method="post">
  28. <?php require 'form.ns.php'; ?>
  29. <br>
  30. <label for="use">Utilisation</label>
  31. <br>
  32. <select required="" name="use" id="use">
  33. <option value="" selected="" disabled="">-</option>
  34. <option value="0">0 (PKIX-TA, <abbr title="also known as">aka<abbr> CA constraint)</option>
  35. <option value="1">1 (PKIX-EE, <abbr title="also known as">aka<abbr> Service certificate constraint)</option>
  36. <option value="2">2 (DANE-TA, <abbr title="also known as">aka<abbr> Trust Anchor Assertion)</option>
  37. <option value="3">3 (DANE-EE, <abbr title="also known as">aka<abbr> Domain issued certificate)</option>
  38. </select>
  39. <br>
  40. <label for="selector">Selecteur</label>
  41. <br>
  42. <select required="" name="selector" id="selector">
  43. <option value="" selected="" disabled="">-</option>
  44. <option value="0">0 (le certificat entier doit correspondre)</option>
  45. <option value="1">1 (la clé publique du certificat doit correspondre)</option>
  46. </select>
  47. <br>
  48. <label for="type">Type de correspondance</label>
  49. <br>
  50. <select required="" name="type" id="type">
  51. <option value="" selected="" disabled="">-</option>
  52. <option value="0">0 (certificat entier)</option>
  53. <option value="1">1 (SHA-256)</option>
  54. <option value="2">2 (SHA-512)</option>
  55. </select>
  56. <br>
  57. <label for="content">Contenu</label>
  58. <br>
  59. <input id="content" minlenght="3" maxlength="1024" pattern="^[a-zA-Z0-9.-]{3,1024}$" placeholder="gjioerjgioer" name="content" type="text">
  60. <br>
  61. <input value="Valider" type="submit">
  62. </form>