Replication .dovecot-sync.lock

2014-10-24 Thread Hans-Werner Paulsen
Hello all,
I have set up two servers with dovecot and replication. The mail location is
mail_location = sdbox:/var/spool/mail/%u
Everything works fine when I override the homedirectories
userdb {
  driver = passwd
  override_fields = home=/var/spool/mail/%u
}
But, when I do not override the homedirectories, replication does not work,
and the following error is logged:
Oct 24 14:40:45 dsync-local(hans): Error: Couldn't create lock 
/afs/mpa/home/hans/.dovecot-sync.lock: Permission denied

With a self-written module an IMAP user can get access to his homedirectory:
protocol imap {
  mail_plugins = afsToken
}
The user has to type in his password. Obviously this does not work for
replication.
Is there a way to specify a different location for the lockfile?
Isn't better to use the maildirectory but the homedirectory?
Is there a way to set the homedirectory differently for replication?

Thank you for any help.
HW

-- 
Hans-Werner Paulsen h...@mpa-garching.mpg.de
MPI für Astrophysik Tel 089-3-2602
Karl-Schwarzschild-Str. 1   Fax 089-3-2235  
D-85741 Garching


Re: [Dovecot] INBOX stored in AFS

2008-10-30 Thread Hans-Werner Paulsen
On Mon, Oct 20, 2008 at 06:56:55PM +0300, Timo Sirainen wrote:
> On Mon, 2008-10-20 at 16:16 +0200, Hans-Werner Paulsen wrote:
> > When I start my imap-client, I see the content of the INBOX, and I can
> > read, delete, ... the different entries. But when new mail arrives dovecot
> > (and my imap-client) will never notice this. And when I quit my imap-client
> > the dovecot imap server will write back its view of the INBOX, and delete
> > this new mail.
> > This seems to be a problem related to AFS. I poked in the dovecot code and
> > have the following theory: dovecot opens the INBOX R/W, dovecot calls "stat"
> > on the INBOX file periodically to look for modifications. But this does
> > not work, because this machine will stat the local copy (AFS cache) of the
> > INBOX as long as this file is still open R/W.
> 
> I'd have thought that the local view was updated at least after fcntl
> locking the mailbox.
> 
> > My questions:
> > Is it possible to have a configuration, that the INBOX file is not left open
> > when stat-ing this file?
> > Or is it possible to open the INBOX file R/W only when it us locked?
> > Or is it necessary to modify the code?
> 
> It's necessary to modify the code. Probably not difficult (maybe in
> mbox_unlock()), but I'd rather not change that code permanently since
> this is a pretty AFS-specific problem..
> 

I checked flock (fcntl locking is not working at all) semantics on the AFS
filesystem with some small test programs:
Calling flock does NOT update the local view of the AFS file, if it is
opened R/W. But, status information seems to be up-to-date if the file
is opened R/O.
Now I want to modify the dovecot code for mbox processing in the following
way:
open the mbox R/O
before modifying the mbox file: close it, dot-lock the file and open it R/W
after modifying the mbox file: close it, remove the dot-lock, and open it R/O

Any hints in which files I have to look for the necessary modifications?

Thank you for your help,
HW

-- 
Hans-Werner Paulsen [EMAIL PROTECTED]
MPI für Astrophysik Tel 089-3-2602
Karl-Schwarzschild-Str. 1   Fax 089-3-2235  
D-85741 Garching


[Dovecot] INBOX stored in AFS

2008-10-20 Thread Hans-Werner Paulsen
Hello,
currently we are storing the incoming mail in the user's home directory,
which is within a distributed filesystem called AFS (OpenAFS).
Accessing the "mbox" file directly (using the distributed filesystem)
works fine with mutt, thunderbird, ...
To access the INBOX from a machine, which does not have access to this
distributed filesystem, we are using IMAP (UW-imap).
Now I wanted to check if dovecot can do the job (maybe faster than UW),
and I had the following problem:
This is my configuration:
---
# 1.1.4: /opt/dovecot-1.1.4/etc/dovecot.conf
log_path: /var/log/dovecot
ssl_cert_file: /etc/ssl/certs/imapd.pem
ssl_key_file: /etc/ssl/keys/imapd.pem
login_dir: /var/run/dovecot/login
login_executable: /opt/dovecot-1.1.4/libexec/dovecot/imap-login
first_valid_uid: 100
mail_location: mbox:~/Mail:INBOX=~/.maildir/incoming
mail_debug: yes
mmap_disable: yes
mail_nfs_storage: yes
mail_nfs_index: yes
mbox_write_locks: fcntl
mbox_dirty_syncs: no
mbox_lazy_writes: no
mail_executable: /opt/dovecot-1.1.4/libexec/dovecot/afs-token 
/opt/dovecot-1.1.4/libexec/dovecot/imap
auth default:
  verbose: yes
  debug: yes
  passdb:
driver: pam
args: setcred=yes session=yes dovecot
  userdb:
driver: passwd
---
When I start my imap-client, I see the content of the INBOX, and I can
read, delete, ... the different entries. But when new mail arrives dovecot
(and my imap-client) will never notice this. And when I quit my imap-client
the dovecot imap server will write back its view of the INBOX, and delete
this new mail.
This seems to be a problem related to AFS. I poked in the dovecot code and
have the following theory: dovecot opens the INBOX R/W, dovecot calls "stat"
on the INBOX file periodically to look for modifications. But this does
not work, because this machine will stat the local copy (AFS cache) of the
INBOX as long as this file is still open R/W.
My questions:
Is it possible to have a configuration, that the INBOX file is not left open
when stat-ing this file?
Or is it possible to open the INBOX file R/W only when it us locked?
Or is it necessary to modify the code?

Thank you for any help,
HW 

-- 
Hans-Werner Paulsen [EMAIL PROTECTED]
MPI für Astrophysik Tel 089-3-2602
Karl-Schwarzschild-Str. 1   Fax 089-3-2235  
D-85741 Garching