Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing the password on Roundcube WILL make Postfix unable to receive mail #85

Closed
ddavness opened this issue Oct 20, 2022 · 10 comments
Closed
Labels
Bug Stating that it's a feature is just lame - I'll need to fix this sometime soon. Critical The issue is a showstopper and needs to be addressed ASAP.

Comments

@ddavness
Copy link
Owner

ddavness commented Oct 20, 2022

God help me, this took a big, big while to figure out

So a technical TL;DR on this: SQLite has a few logging modes, among them wal (Write-Ahead-Log) and delete (aka none).

  1. Postfix can only work with the users.sqlite database when it is set to delete.
  2. But when changing the password on Roundcube, it will set the database to wal.
  3. Chaos ensues with errors like these:
postfix/trivial-rewrite[22530]: fatal: dict_sqlite_lookup: /etc/postfix/virtual-alias-maps.cf: SQL prepare failed: disk I/O error?

(which are as helpful as a submarine in the desert)
4. Postfix will never be able to process incoming mail because they cannot read the database the way the want to.

@ddavness ddavness added Bug Stating that it's a feature is just lame - I'll need to fix this sometime soon. Critical The issue is a showstopper and needs to be addressed ASAP. labels Oct 20, 2022
@ddavness ddavness pinned this issue Oct 20, 2022
@ddavness
Copy link
Owner Author

Possibly related to mail-in-a-box/mailinabox#2185

@kiekerjan
Copy link
Contributor

kiekerjan commented Oct 30, 2022

Issue 2185 concerns a misconfiguration of the Roundcube password plugin used by Mail-in-a-Box.

Update: removed link to Roundcube issue as I don't think it applies anymore.

@ddavness
Copy link
Owner Author

ddavness commented Oct 30, 2022

Both are indeed related. I want to keep an eye on how they'll eventually solve it.

This issue was caused due to the fix I applied on #77, though in all honesty is still a bit mysterious to me how it ended up happening: since that behavior goes back to Roundcube 1.4.x, I'd expect it to come up sooner.

Strangely enough nobody else reported this problem to me so far. I wonder if it actually happened to somebody else or if it was a spurious episode on my case.

@kiekerjan
Copy link
Contributor

kiekerjan commented Oct 30, 2022

I see your solution for the #77 bug is the same as mine for the 2185 bug. Of course, because it is the same issue ;) I don't think #77 caused the postfix sqlite bug. Probably most people don't change their password via Roundcube and thus the issue was not seen before. Also, I did not see errors in the MiaB status page, which thus also hides the issue somewhat.

Update: when testing this, an easy way to disable wal is sqlite3 users.sqlite 'PRAGMA journal_mode=delete;';

Another update: I think the reason we're seeing this only now, is because Roundcube only introduced the PRAGMA journal_mode=WAL line in version 1.6.0 of Roundcube. It was not part of Roundcube 1.5.3.

@ddavness
Copy link
Owner Author

ddavness commented Oct 30, 2022

Ah. Suddenly everything begins to make sense.

Update: when testing this, an easy way to disable wal is sqlite3 users.sqlite 'PRAGMA journal_mode=delete;'

I've came to the same conclusion, but this is probably not very practical or secure to automate via php. That leaves us with using the Mail-in-a-Box Driver somebody had already implemented for us. Unfortunately, the system password changes every time the admin panel is restarted, which doesn't make it a fast solution to implement right away, either.

@e-fu
Copy link

e-fu commented Nov 6, 2022

Both are indeed related. I want to keep an eye on how they'll eventually solve it.

This issue was caused due to the fix I applied on #77, though in all honesty is still a bit mysterious to me how it ended up happening: since that behavior goes back to Roundcube 1.4.x, I'd expect it to come up sooner.

Strangely enough nobody else reported this problem to me so far. I wonder if it actually happened to somebody else or if it was a spurious episode on my case.

i have this

God help me, this took a big, big while to figure out

So a technical TL;DR on this: SQLite has a few logging modes, among them wal (Write-Ahead-Log) and delete (aka none).

  1. Postfix can only work with the users.sqlite database when it is set to delete.
  2. But when changing the password on Roundcube, it will set the database to wal.
  3. Chaos ensues with errors like these:
postfix/trivial-rewrite[22530]: fatal: dict_sqlite_lookup: /etc/postfix/virtual-alias-maps.cf: SQL prepare failed: disk I/O error?

(which are as helpful as a submarine in the desert) 4. Postfix will never be able to process incoming mail because they cannot read the database the way the want to.

j have the same problem. cant receive any emails anymore

@kiekerjan
Copy link
Contributor

kiekerjan commented Nov 6, 2022

@e-fu go to the folder where your users.sqlite database is stored and run the following command:
sudo sqlite3 users.sqlite 'PRAGMA journal_mode=delete;';
That should restore the database for postfix.

@ddavness
Copy link
Owner Author

ddavness commented Nov 6, 2022

I have done some work on this and reached to a solution that more or less is able to please everyone-ish (see the PR above). It will have some drawbacks though; it's a good idea to take a look at it and share your thoughts :)

ddavness added a commit that referenced this issue Nov 6, 2022
@ddavness
Copy link
Owner Author

ddavness commented Nov 7, 2022

Fixed on v60.4

@ddavness ddavness closed this as completed Nov 7, 2022
@ddavness ddavness unpinned this issue Nov 21, 2022
@codihaus
Copy link

I'm not really using MiaB, but facing the same problem which my mail server is on Postfix (the cf refer to .db file), and the roundcube allow change password.

When user come to roundcube UI and change password, I can see it created -wal file and -shm file. Then postfix crashed.

Can you please suggest me a way to resolve this please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Stating that it's a feature is just lame - I'll need to fix this sometime soon. Critical The issue is a showstopper and needs to be addressed ASAP.
Projects
None yet
Development

No branches or pull requests

4 participants