<vault>
The default is 24h. The line sets how long a key obtained from the vault lives in the node’s memory before it is requested again.
And a separate caveat that is easy to forget: a missing key is always cached for an hour. This line does not change that value — it is hard-coded.
This leads to two different wait times. A key that was changed in the vault reaches the node within the period from this line. A key that was added after an unsuccessful lookup reaches it no sooner than an hour later.
The line lives in the <vault> block together with the vault address and the access token.
The right order is the reverse: first the key in the vault, then the reference to it in the configuration.
The other half is rotation. A key change reaches the node within the period from this line, and a day by default means a day during which the node signs with the old key taken from the vault.
That is why rotation follows our own rules — a new selector, waiting for queues to drain, removing the old one — and is not complicated by the hour-long cache of a missing key.
What to set. The period is chosen by how often keys change:
| Value | When |
|---|---|
| 24h (default) | keys change on a schedule, and a day of delay is acceptable |
| 1h–2h | rotation is frequent or a key may be revoked urgently |
| longer than a day | the vault is far or unreliable, and keys hardly ever change |
A short period costs a trip to the vault for every key — and the vault must be available at that moment. A long one saves trips at the cost of a delay during rotation.
# rotation is frequent — a day of delay is too much <vault> server-url https://10.1.2.3:4500 access-token akhdfasdhf786282684734kjsdhf cache-ttl 2h</vault>
what people get wrong and how it ends2 mistakes▶
§ 3.3.23.3
our experience
2 relations
domain-keyGlobalSigning keys are what is most often taken from the vault; the cache period decides how fast their change arrives. § 3.3.23.3Lock down permissions on configuration filesA vault is an alternative to keys on disk; it does not cancel the configuration file permissions. § 3.3.23.3
grep -n -A4 '^<vault>' /etc/pmta/config pmta clear secretscache
3 articles
◇Secrets in an external vaultSigning keys can be kept in HashiCorp Vault: the configuration keeps a path, and the engine fetches the key over HTTP and keeps it in memory without writing it to disk.◇Who is allowed to submit mail and for whom to accept itOut of the box, the node accepts submission only from the machine itself; two different questions — “who can send through us” and “for whose addresses we accept mail” — are answered by different directives.◇The group that grants management rightsMembership in the pmta group gives an unprivileged user the right to call the node’s commands and use submission.