From 01d8e9f3b4256084b73617188da0afe6ab2edd3a Mon Sep 17 00:00:00 2001 From: Joshua Tauberer Date: Sat, 13 May 2023 06:17:49 -0400 Subject: [PATCH 1/3] Revert "Disable Roundcube password plugin since it was corrupting the user database (#2198)" This reverts commit 15872487621a66e900d550ba095b8cdd12c5fcc0. See subsequent commits. --- setup/webmail.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/webmail.sh b/setup/webmail.sh index 90e97aed..791bda57 100755 --- a/setup/webmail.sh +++ b/setup/webmail.sh @@ -134,7 +134,7 @@ cat > $RCM_CONFIG < ~256 bits for AES-256, see above -\$config['plugins'] = array('html5_notifier', 'archive', 'zipdownload', 'managesieve', 'jqueryui', 'persistent_login', 'carddav'); +\$config['plugins'] = array('html5_notifier', 'archive', 'zipdownload', 'password', 'managesieve', 'jqueryui', 'persistent_login', 'carddav'); \$config['skin'] = 'elastic'; \$config['login_autocomplete'] = 2; \$config['login_username_filter'] = 'email'; From 3c150816738d1fe555496642eaace79190cbcdd9 Mon Sep 17 00:00:00 2001 From: KiekerJan Date: Sat, 5 Nov 2022 21:02:49 +0100 Subject: [PATCH 2/3] Remove journal PRAGMA from Roundcube source which broke the database for postfix See #2185. --- setup/webmail.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/setup/webmail.sh b/setup/webmail.sh index 791bda57..dee44f4c 100755 --- a/setup/webmail.sh +++ b/setup/webmail.sh @@ -23,7 +23,8 @@ echo "Installing Roundcube (webmail)..." apt_install \ dbconfig-common \ php${PHP_VER}-cli php${PHP_VER}-sqlite3 php${PHP_VER}-intl php${PHP_VER}-common php${PHP_VER}-curl php${PHP_VER}-imap \ - php${PHP_VER}-gd php${PHP_VER}-pspell php${PHP_VER}-mbstring libjs-jquery libjs-jquery-mousewheel libmagic1 + php${PHP_VER}-gd php${PHP_VER}-pspell php${PHP_VER}-mbstring libjs-jquery libjs-jquery-mousewheel libmagic1 \ + sqlite3 # Install Roundcube from source if it is not already present or if it is out of date. # Combine the Roundcube version number with the commit hash of plugins to track @@ -209,6 +210,16 @@ php$PHP_VER ${RCM_DIR}/bin/updatedb.sh --dir ${RCM_DIR}/SQL --package roundcube chown www-data:www-data $STORAGE_ROOT/mail/roundcube/roundcube.sqlite chmod 664 $STORAGE_ROOT/mail/roundcube/roundcube.sqlite +# Patch the Roundcube code to eliminate an issue that causes postfix to reject our sqlite +# user database (see https://github.com/mail-in-a-box/mailinabox/issues/2185) +sed -i.miabold 's/^[^#]\+.\+PRAGMA journal_mode = WAL.\+$/#&/' \ +/usr/local/lib/roundcubemail/program/lib/Roundcube/db/sqlite.php + +# Because Roundcube wants to set the PRAGMA we just deleted from the source, we apply it here +# to the roundcube database (see https://github.com/roundcube/roundcubemail/issues/8035) +# Database should exist, created by migration script +sqlite3 $STORAGE_ROOT/mail/roundcube/roundcube.sqlite 'PRAGMA journal_mode=WAL;' + # Enable PHP modules. phpenmod -v $PHP_VER imap restart_service php$PHP_VER-fpm From 8aa98b25b5e4d69d1aa61b57df867b91ab16e641 Mon Sep 17 00:00:00 2001 From: KiekerJan Date: Thu, 27 Oct 2022 21:39:54 +0200 Subject: [PATCH 3/3] Update configuration of Roundcube password plugin for Roundcube 1.6 --- setup/webmail.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/setup/webmail.sh b/setup/webmail.sh index dee44f4c..e4429adf 100755 --- a/setup/webmail.sh +++ b/setup/webmail.sh @@ -185,10 +185,9 @@ cp ${RCM_PLUGIN_DIR}/password/config.inc.php.dist \ tools/editconf.py ${RCM_PLUGIN_DIR}/password/config.inc.php \ "\$config['password_minimum_length']=8;" \ "\$config['password_db_dsn']='sqlite:///$STORAGE_ROOT/mail/users.sqlite';" \ - "\$config['password_query']='UPDATE users SET password=%D WHERE email=%u';" \ - "\$config['password_dovecotpw']='/usr/bin/doveadm pw';" \ - "\$config['password_dovecotpw_method']='SHA512-CRYPT';" \ - "\$config['password_dovecotpw_with_method']=true;" + "\$config['password_query']='UPDATE users SET password=%P WHERE email=%u';" \ + "\$config['password_algorithm']='sha512-crypt';" \ + "\$config['password_algorithm_prefix']='{SHA512-CRYPT}';" # so PHP can use doveadm, for the password changing plugin usermod -a -G dovecot www-data