mirror of
https://github.com/postfixadmin/postfixadmin.git
synced 2024-09-19 19:22:14 +02:00
768f2ee844
Suggested from: https://github.com/postfixadmin/postfixadmin/issues/441#issuecomment-774736944
17 lines
514 B
Bash
17 lines
514 B
Bash
#!/bin/bash
|
|
|
|
# Example script for dovecot mail-crypt-plugin
|
|
# https://doc.dovecot.org/configuration_manual/mail_crypt_plugin/
|
|
|
|
IFS= read -r -d $'\0' OLD_PASSWORD
|
|
IFS= read -r -d $'\0' NEW_PASSWORD
|
|
|
|
# New user
|
|
if [ -z "$OLD_PASSWORD" ]; then
|
|
OLD_PASSWORD="$(openssl rand -hex 16)"
|
|
doveadm -o plugin/mail_crypt_private_password="$OLD_PASSWORD" mailbox cryptokey generate -u "$1" -U
|
|
fi
|
|
|
|
# Password change
|
|
printf "%s\n%s\n" "$OLD_PASSWORD" "$NEW_PASSWORD" | doveadm mailbox cryptokey password -u "$1" -N -O ""
|