使用 Postfix/Dovecot 設定 Roundcube 密碼插件

使用 Postfix/Dovecot 設定 Roundcube 密碼插件

我正在使用 Roundcube v1.6.0,我正在努力得到密碼插件才能正常工作。

但是,我收到以下錯誤訊息(在瀏覽器中):

Could not save new password.
Encryption function missing.

為什麼 Roundcube 要存取我的私鑰?

我正在使用為 Postfixadmin 虛擬使用者配置的 Postfix/Dovecot。


配置

/srv/live/php/roundcubemail-1.6.0/logs/errors.log

[13-Dec-2022 11:16:31 -0500]: PHP Error: Password plugin: Failed to execute command: /usr/bin/doveadm pw -s 'CRAM-MD5'.  
Error: doveconf: Fatal: Error in configuration file /etc/dovecot/dovecot.conf line 12: ssl_cert: Can't open file /etc/ssl/private/fullchain.pem: Permission denied in /srv/live/php/roundcubemail-1.6.0/plugins/password/password.php on line 747 (POST /?_task=settings&_action=plugin.password-save)

編輯我錯誤地將以下內容列為 Roundcube 主設定檔;這是密碼插件配置

/srv/live/php/roundcubemail-1.6.0/plugins/password

$config['password_driver'] = 'sql';
$config['password_strength_driver'] = 'zxcvbn';
$config['password_zxcvbn_min_score'] = 5;
$config['password_confirm_current'] = true;
$config['password_minimum_length'] = 8;
$config['password_minimum_score'] = 0;
$config['password_algorithm'] = 'dovecot';
$config['password_algorithm_options'] = [];
$config['password_algorithm_prefix'] = '';
$config['password_dovecotpw'] = '/usr/bin/doveadm pw';
$config['password_dovecotpw_method'] = 'CRAM-MD5';
$config['password_dovecotpw_with_method'] = true;

/etc/dovecot/dovecot-sql.conf

driver = mysql
connect = host=localhost dbname=postfix_db user=postfix password=<redacted>
default_pass_scheme = MD5-CRYPT
user_query = SELECT '/var/www/mail/vmail/%d/%n' as home, 'maildir:/var/www/mail/vmail/%d/%n' as mail, 2000 AS uid, 2000 AS gid, concat('dirsize:storage=',  quota) AS quota FROM mailbox WHERE username = '%u' AND active = '1'
# Get the password
password_query = SELECT username as user, password, '/var/www/mail/vmail/%d/%n' as userdb_home, 'maildir:/var/www/mail/vmail/%d/%n' as userdb_mail, 2000 as userdb_uid, 2000 as userdb_gid FROM mailbox WHERE username = '%u' AND active = '1'
# If using client certificates for authentication, comment the above and uncomment the following
#password_query = SELECT null AS password, ‘%u’ AS user

預先非常感謝您的幫忙!


附註:我找不到任何詳細說明我的確切問題的帖子。

我確實找到了兩張具有相當相似設定/錯誤的海報,這些海報透過更改 Dovecot 的密碼模式來解決MD5密碼。我不確定為什麼這會有所幫助;但既然我打算這樣做,請告訴我這是否是解決方案。

答案1

這是一段漫長的旅程,但我修好了。最終去了後綴管理 git並發現這個問題這個帖子。隨後的錯誤Error: net_connect_unix(/run/dovecot/stats-writer) failed: Permission denied得到解決,感謝這個帖子

總結一下:

1. 新建 dovecot 設定文件

您將首先在/etc/dovecot/(或您的 dovecot 設定檔所在的任何位置)建立新檔案。
我打電話給我的ssl-keys.conf。該檔案的權限是0600(所有者是root:root

這將僅包含從主 dovecot 設定檔中移動的兩 (2) 行(大概dovecot.conf):

ssl-keys.conf

ssl_cert                   = </etc/ssl/private/fullchain.pem
ssl_key                    = </etc/ssl/private/privkey.pem

2.修改dovecot主設定文件

在 中dovecot.conf,新增以下行

!include_try ssl-keys.conf

service stats {
    unix_listener stats-reader {
        group = vmail
        mode = 0666
    }

    unix_listener stats-writer {
        group = vmail
        mode = 0666
    }
}

確保 postfixadmin 是 dovecot/vmail 群組的一部分(其中 vmail 是您的郵件或虛擬使用者群組)。

如果您還沒有這樣做,請刪除dovecot.conf已新增至新檔案的行ssl-keys.conf。保持其他一切不變。

3.修改dovecot資料庫設定文件

在你的 Dovecot 資料庫設定檔(dovecot-sql.conf對我來說)中修改以下內容:

default_pass_scheme = BLF-CRYPT

在你的 Roundcube 密碼插件設定檔中,修改以下內容(其餘與我的操作相同):

$config['password_dovecotpw_method'] = 'BLF-CRYPT';
$config['password_dovecotpw'] = '/usr/bin/doveadm pw -r 12';

相關內容