secrets.tx 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <div id="backoffice">
  2. <h2>Stored Secrets</h2>
  3. <p>
  4. Passwords that are not tCMS's, which tCMS needs in order to do something
  5. on your behalf &mdash; the passphrase to the provisioner's secrets
  6. database, to begin with. Store one here and the next thing that needs
  7. it asks you for a TOTP code instead, which is a thing you have on you
  8. rather than a thing you have written down.
  9. </p>
  10. : if ( !$has_vault ) {
  11. <p class="guest-reprovision-warning">
  12. This installation has no vault key, so there is nowhere to keep a secret
  13. and nothing below will save. See <code>Trog::Vault</code>: the key is
  14. handed to the service by systemd, and without one the things that would
  15. have used a stored secret go on asking for the password directly.
  16. </p>
  17. : }
  18. : if ( $secrets ) {
  19. <table class="cooltext" style="width:100%;border-collapse:collapse;">
  20. <thead>
  21. <tr style="text-align:left;">
  22. <th style="padding:4px 8px;">Name</th>
  23. <th style="padding:4px 8px;">Stored</th>
  24. <th style="padding:4px 8px;">Last used</th>
  25. <th style="padding:4px 8px;"></th>
  26. </tr>
  27. </thead>
  28. <tbody>
  29. : for $secrets -> $secret {
  30. <tr>
  31. <td style="padding:4px 8px;font-family:monospace;"><: $secret.name :></td>
  32. <td style="padding:4px 8px;white-space:nowrap;"><: $secret.stored :></td>
  33. <td style="padding:4px 8px;white-space:nowrap;"><: $secret.used :></td>
  34. <td style="padding:4px 8px;">
  35. : # A row sealed under a key this installation no longer has
  36. : # is not going to open, and saying so beats letting somebody
  37. : # find out at the moment they were relying on it.
  38. : if ( !$secret.readable ) {
  39. <span class="tag guest-state" title="this will not open: it was sealed with a vault key this installation no longer has. Store it again.">unreadable</span>
  40. : }
  41. <form method="POST" action="/secrets/forget" style="display:inline;">
  42. <input type="hidden" name="name" value="<: $secret.name :>" />
  43. <button class="coolbutton guest-destroy" type="submit">Forget</button>
  44. </form>
  45. </td>
  46. </tr>
  47. : }
  48. </tbody>
  49. </table>
  50. : } else {
  51. <p>Nothing stored.</p>
  52. : }
  53. : # No key, no form. Everything it could submit would be refused, and a form
  54. : # that cannot work is worse than no form: it reads as something that ought
  55. : # to have worked.
  56. : if ( $has_vault ) {
  57. <br />
  58. <h3>Store one</h3>
  59. <p>
  60. Storing under a name that is already here replaces it. Nothing on this
  61. page ever shows a value back to you &mdash; if you have forgotten one,
  62. replace it.
  63. </p>
  64. <form method="POST" action="/secrets/save">
  65. <label>
  66. Name
  67. <input required class="cooltext" type="text" name="name" pattern="[A-Za-z0-9][A-Za-z0-9._-]*" maxlength="64"
  68. placeholder="provisioner"
  69. title="letters, digits, dot, dash and underscore. 'provisioner' is the one reprovisioning looks for." />
  70. </label>
  71. <label>
  72. Secret
  73. <input required class="cooltext" type="password" name="secret" autocomplete="off" />
  74. </label>
  75. <input class="coolbutton" type="submit" value="Store it" />
  76. </form>
  77. : }
  78. </div>