Skip to content

Commit 5f3b87b

Browse files
committed
mail-crypt: Rewrite "Choosing Encryption Password"
After config-rewrite there are no more issues with % characters.
1 parent fedb21a commit 5f3b87b

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

docs/core/plugins/mail_crypt.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,21 @@ crypt_user_key_curve = secp521r1
322322
crypt_user_key_require_encrypted = yes
323323
```
324324

325-
The password that is used to decrypt the users master/private key, must be
326-
provided via password query:
325+
The password that is used to decrypt the user's private key must be
326+
provided via the [[setting,crypt_user_key_password]] setting. See below.
327+
328+
#### Choosing Encryption Password
329+
330+
It is recommended to use a hash of the user's plaintext password as the
331+
encryption key password instead of the plaintext password directly. This way
332+
the plaintext password is less likely to become visible accidentally, such as
333+
in debug logs.
334+
335+
Another issue that you must consider when using user's password is that
336+
when the password changes, **you must re-encrypt the user private key**.
337+
338+
Example config where the user's password is used as the encryption key
339+
password:
327340

328341
```[dovecot.conf]
329342
passdb sql {
@@ -333,17 +346,6 @@ passdb sql {
333346
}
334347
```
335348

336-
#### Choosing Encryption Password
337-
338-
DO NOT use passwords directly. It can contain `%` which is interpreted as
339-
variable expansion and can cause errors. Also, it might be visible in
340-
debug logging. Suggested approaches are base64 encoding, hex encoding
341-
or hashing the password. With hashing, you get the extra benefit that
342-
password won't be directly visible in logs.
343-
344-
Another issue that you must consider when using user's password is that
345-
when the password changes, **you must re-encrypt the user private key**.
346-
347349
## Base64-encoded Keys
348350

349351
Mail-crypt plugin can read keys that are base64 encoded. This is intended

0 commit comments

Comments
 (0)