Hello dear Dovecot users
I have a somewhat special request: I have a single file in mbox format which I want to make accessible via IMAP to anonymous logins. The mbox file is being updated outside of Dovecot and should not be changeable by Dovecot.
So far I created a Docker container based on the official image (https://hub.docker.com/r/dovecot/dovecot) and configured the Dovecot according to https://doc.dovecot.org/configuration_manual/shared_mailboxes/public_shared/. The volume with the mbox file is mounted in the running container under /var/mail. Each time a client tries to access this public mailbox the following error is logged and no content is returned:
May 26 21:57:06 imap(mutt)<16>
Note that I don't need the file to be a shared mailbox. Instead I would also be happy to have all (anonymous) users mapped to the read-only mbox somewhere in the filesystem.
Dockerfile: FROM dovecot/dovecot
RUN mkdir -p /var/indexes/public RUN chown 1000:1000 /var/indexes/public ADD dovecot.conf /etc/dovecot/dovecot.conf
/etc/dovecot/dovecot.conf: ## You should mount /etc/dovecot if you want to ## manage this file
mail_home=/srv/mail/%Lu mail_location=sdbox:~/Mail mail_uid=1000 mail_gid=1000
#protocols = imap pop3 submission sieve lmtp protocols = imap
first_valid_uid = 1000 last_valid_uid = 1000
passdb { driver = static args = password=pass }
ssl=yes
ssl_cert= namespace {
type = private
inbox = yes
separator = /
} namespace {
type = public
prefix = Public/
location = mbox:/var/mail/:INDEX=/var/indexes/public
subscriptions = no
} listen = * log_path=/dev/stdout
info_log_path=/dev/stdout
debug_log_path=/dev/stdout
On 2023-05-26 22:59, liecj3@bfh.ch wrote:
May 26 21:57:06 imap(mutt)<16>
: Error: Mailbox Public/archive: open() failed with mbox: Read-only file system. /etc/dovecot/dovecot.conf:
mail_uid=1000 mail_gid=1000
namespace { type = public prefix = Public/ location = mbox:/var/mail/:INDEX=/var/indexes/public subscriptions = no }
Might be worth also setting the location of control files:
location = mbox:/var/mail/:INDEX=/var/indexes/public:CONTROL=/var/control/%u
Where /var/control is writable by uid 1000.
https://doc.dovecot.org/configuration_manual/mail_location/mbox/
Has this to say about mbox control files:
"Under mbox format, Dovecot maintains the subscribed mailboxes list in a file .subscriptions which by default is stored in the mail location root. So in the example configuration this would be at ~/mail/.subscriptions.
If you want to put this somewhere else, you can change the directory in which the .subscriptions file is kept by using the CONTROL parameter."
Also this:
https://doc.dovecot.org/admin_manual/mailbox_formats/mbox
Describes various file locking requirements for mbox format.
https://doc.dovecot.org/configuration_manual/mail_location/mbox/mboxlocking
Seems dovecot is going to check if it can create a .lock file (or otherwise lock the file using flock())
A couple of workarounds are described there.
As the docs note, mbox isn't a great format to do this with.
You might also like to investigate Dovecot access lists to make 'read only' folders etc:
https://doc.dovecot.org/configuration_manual/acl
Rob
participants (2)
-
liecj3@bfh.ch
-
Rob Lister