Re: debug SMTP commands sent/received to/from the submission service

2021-04-09 Thread Victor Sudakov
Aki Tuomi wrote:
> > 
> > I'm trying to debug SMTP commands clients send to the submission
> > service. 
> > 
> > I've tried 
> > 
> > protocol submission {
> >   rawlog_dir = /var/tmp/dovecot
> > }
> > 
> > but /var/tmp/dovecot remains empty. What am I missing? I'd use Wireshark
> > but the communication between SMTP clients and Dovecot is encrypted
> > after STARTTLS, so Wireshark is pretty useless here.
> > 
> > Can you please point me to the right direction to log all SMTP commands?
> > All is happening on Debian/buster, Dovecot 2.3.4.1.
> > 
> > -- 
> > Victor Sudakov VAS4-RIPE
> > http://vas.tomsk.ru/
> > 2:5005/49@fidonet
> 
> Sorry for sending empty mail first...
> 
> I would recommend using
> 
>rawlog_dir = /var/tmp/dovecot/%u
> 
> and then ensuring that the directory, which expands to the username,
> *exists* and is *writable* to your mail user. Dovecot will not attempt
> to create this directory.
> 

Well, I did not use the "%u" macro as I would be happy to have all raw logs
in one directory, but the directory /var/tmp/dovecot/ does exist and is
chmod 777, and I did "systemctl reload dovecot" after changing the
config, still there is nothing there.

Any more ideas? 

-- 
Victor Sudakov VAS4-RIPE
http://vas.tomsk.ru/
2:5005/49@fidonet


signature.asc
Description: PGP signature


Re: debug SMTP commands sent/received to/from the submission service

2021-04-09 Thread Victor Sudakov
Plutocrat wrote:
> On 09/04/2021 15.13, Victor Sudakov wrote:
> > I'd use Wireshark but the communication between SMTP clients and Dovecot is 
> > encrypted
> > after STARTTLS, so Wireshark is pretty useless here.
> 
> You might get some useful information connecting with openssl s_client
> 
> Here's a page googled at random.
> https://halon.io/blog/how-to-test-smtp-servers-using-the-command-line/

Maybe I had phrased my question incorrectly, but I am interested in
snooping the exchange between Dovecot and an SMTP client (PHP Mailer in
my case), not in manual sending of SMTP commands.

-- 
Victor Sudakov VAS4-RIPE
http://vas.tomsk.ru/
2:5005/49@fidonet


signature.asc
Description: PGP signature


debug SMTP commands sent/received to/from the submission service

2021-04-09 Thread Victor Sudakov
Dear Colleagues,

I'm trying to debug SMTP commands clients send to the submission
service. 

I've tried 

protocol submission {
  rawlog_dir = /var/tmp/dovecot
}

but /var/tmp/dovecot remains empty. What am I missing? I'd use Wireshark
but the communication between SMTP clients and Dovecot is encrypted
after STARTTLS, so Wireshark is pretty useless here.

Can you please point me to the right direction to log all SMTP commands?
All is happening on Debian/buster, Dovecot 2.3.4.1.

-- 
Victor Sudakov VAS4-RIPE
http://vas.tomsk.ru/
2:5005/49@fidonet


signature.asc
Description: PGP signature


Re: How to move/reorganise existing e-mails to yearly subfolders

2020-10-20 Thread Victor Sudakov
R. Diez wrote:
> 
> I found some tools on the Internet to backup and export mails from IMAP to
> IMAP or maildir destinations. But I could not find a tool that just
> reorganises (moves) e-mails in such a manner inside an existing mailbox,
> maybe with a user-defined pattern for the destination folders.

You could try imapfilter (written in lua), it can move mails between
mailboxes and do other things.

A short example:

oldmails = account1["INBOX"]:is_older(365)
oldmails:move_messages(account1["Old"])

-- 
Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/


signature.asc
Description: PGP signature


Re: A user's last access time

2020-10-20 Thread Victor Sudakov
@lbutlr wrote:
> On 20 Oct 2020, at 00:33, Aki Tuomi  wrote:
> > plugin {
> > 
> >last_login_dict = file:/somewhere/lastlogin
> > 
> > }
> 
> It may be worth nothing that this can be specified as ~/.lastlogin
> As well as something along the liens of /usr/local/virtual/%d/%u/.lastlogin
> 
> Dovecot is smart enough to do the expansion per user in the ~

Thanks for the hint.

-- 
Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/


signature.asc
Description: PGP signature


Re: A user's last access time

2020-10-20 Thread Victor Sudakov
@lbutlr wrote:
> On 19 Oct 2020, at 20:31, Victor Sudakov  wrote:
> > I have seen this but I do not want this information in a database. 
> …
> 
> > Even a local sqlite database would do.
> 
> What?
> 

This meant that an external DMBS/daemon process (MySQL, Redis etc) was not
desirable, but any on-disk format Dovecot can save the data in was fine
with me. The sqlite format too.

-- 
Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/


signature.asc
Description: PGP signature


Re: A user's last access time

2020-10-20 Thread Victor Sudakov
Aki Tuomi wrote:
> 
> On 20.10.2020 9.30, Matthias Lay wrote:
> > Am Tue, 20 Oct 2020 09:31:16 +0700
> > schrieb Victor Sudakov :
> >
> >
> >> Hello Sami,
> >>
> >> I have seen this but I do not want this information in a database. If
> >> you know how to make the lastlogin_plugin write to a local file, that
> >> would be very helpful. Even a local sqlite database would do.
> >>
> >> The documentation for the plugin seems very scarce.
> >>
> >>
> > you could touch a file in the postlogin script
> 
> 
> You can use lastlogin plugin to write to a file too. It's not just database.
> 
> plugin {
> 
>    last_login_dict = file:/somewhere/lastlogin
> 
> }

Thanks, works this way. 

The contents of the lastlogin text file looks odd, but there is nothing AWK 
cannot transform :-)

-- 
Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/


signature.asc
Description: PGP signature


Re: A user's last access time

2020-10-19 Thread Victor Sudakov
Sami Ketola wrote:
> 
> 
> > On 19. Oct 2020, at 18.54, Victor Sudakov  wrote:
> > 
> > Dear Colleagues,
> > 
> > Is there a file or directory within a user's Maildir, whose date of
> > modification or access indicates the last time the user accessed his/her
> > E-mail via IMAP or POP3?
> > 
> > I'd like to figure out the time a user last logged in into his/her mail
> > account, not the last time a mail was delivered to the INBOX.
> > 
> > This information is probably available in the log, but a file which is
> > touched each time a user accesses his/her mail, is more convenient.
> 
> Not directly but you might want to take a look at this: 
> https://doc.dovecot.org/configuration_manual/lastlogin_plugin/

Hello Sami,

I have seen this but I do not want this information in a database. If
you know how to make the lastlogin_plugin write to a local file, that
would be very helpful. Even a local sqlite database would do.

The documentation for the plugin seems very scarce.


-- 
Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/


signature.asc
Description: PGP signature


A user's last access time

2020-10-19 Thread Victor Sudakov
Dear Colleagues,

Is there a file or directory within a user's Maildir, whose date of
modification or access indicates the last time the user accessed his/her
E-mail via IMAP or POP3?

I'd like to figure out the time a user last logged in into his/her mail
account, not the last time a mail was delivered to the INBOX.

This information is probably available in the log, but a file which is
touched each time a user accesses his/her mail, is more convenient.

-- 
Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/


Re: Changing IMAP separator - does it break things?

2020-10-14 Thread Victor Sudakov
@lbutlr wrote:
> On 13 Oct 2020, at 20:36, Victor Sudakov  wrote:
> > I am using Dovecot 2.3.4.1 with maildirs. Just found out that MacOS Mail
> > clients cannot work with nested folders, presumably because the MacOS
> > Mail does not understand "." as the IMAP separator.
> 
> This is not correct. Mac Mail has no problems with nested folders and never 
> has had any problem with nested folders. I have always used the '.' separator 
> and I've had a 'Root' mail folder with subfolders since at least 2004.

I think I have already posted this link: 
https://discussions.apple.com/thread/8347018

Also this: http://hints.macworld.com/article.php?story=2007090423071517
It contains weird advice but at least proves that the problem exists for *some* 
people.
See also the comments therein.

> 
> > I don't want to break mail for 50 people just to please one Mac Mail
> > user. The users are advanced developers actively using mail sorting
> > rules, nested folders etc.
> 
> And what makes them think nested folders do not work?

I don't have the exact error message from him but it was pretty
obvious about a folder "foo/bar/bob" being non-existent or inaccessible.
And indeed, it's "~/Maildir/.foo.bar.bob" on the IMAP server's disk, there are 
no
subdirectories for mail folders.

-- 
Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/


signature.asc
Description: PGP signature


Re: Changing IMAP separator - does it break things?

2020-10-14 Thread Victor Sudakov
@lbutlr wrote:
> On 14 Oct 2020, at 04:24, Sami Ketola  wrote:
> > On 14. Oct 2020, at 12.51, Victor Sudakov  wrote:
> >> Those Mac clients who do not use nested folders do not seem to be
> >> affected. That is, I've already suggested to the Mac Mail user that he
> >> start Thunderbird, move all his mailboxes into the IMAP root folder, and
> >> then go on using Mac Mail. I hope that's what he has done.
> 
> > There is a bug in Mail.app that it always assumes / as hierarchy separator 
> > and 
> > completely ignores server provided separator.
> 
> Cite? Because no, that is not my experience at all.

Cannot site a bug, can only site a users's complaint:
https://discussions.apple.com/thread/8347018

> 
> From my maildir on my FreeBSD server:
> 
>  # ls -lnd .root*
> drwx--  5 89  89  512 Oct 14 05:16 .root
> drwx--  5 89  89  512 Oct 14 02:02 .root.44
> drwx--  5 89  89  512 Oct 14 02:02 .root.Cron
> drwx--  5 89  89  512 Oct 14 05:16 .root.Hastur
> … etc
> 
> Works fine in Mail.app on Mac OS and has for at least 16 years.

-- 
Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/


signature.asc
Description: PGP signature


Re: Changing IMAP separator - does it break things?

2020-10-14 Thread Victor Sudakov
Filip Hajný wrote:
> 14. 10. 2020 v 11:51, Victor Sudakov :
> > 
> >> I had to do it with 10-20 live users and it went fine, nobody noticed
> >> anything (I made the change in the night hours just to be sure
> >> though). I had to go down and fix some erratic folder names that
> >> resulted from the botched separator handling on some macOS Mail
> >> accounts.
> > 
> > Did it change anything on Dovecot disk/storage or is the IMAP separator just
> > "virtual" - ephemeral ?
> 
> Changing the separator won't fix anything that already exists. You should see 
> nonsense folders in the form of  '.folder\2esubfolder‘ there that cannot be 
> worked with in any way. I manually moved the contents of these to their 
> properly named ('.folder.subfolder‘) variants - on disk.
> 

I was asking because the section "Hierarchy separators" in
https://doc.dovecot.org/configuration_manual/namespace/ somewhat implies
that 

However, changing the separator doesn’t change the on-disk “layout separator”.

That's why I thought that the separator is in fact virtual.

At present, if my folder layout in the mail client is

Inbox
  |
  +---Friends
 |
 +Paul
 |
 +Jessica

the folder "Jessica" on-disk is something like 
~/Maildir/.Friends.Jessica/{cur,new,tmp}/

Do you mean to say that if I change the IMAP separator to "/", Dovecot
will not translate "/" into "." and the folder "Jessica" will become
inaccessible?



-- 
Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/


signature.asc
Description: PGP signature


Re: Changing IMAP separator - does it break things?

2020-10-14 Thread Victor Sudakov
Filip Hajný wrote:
> > 
> >> I had to do it with 10-20 live users and it went fine, nobody noticed
> >> anything (I made the change in the night hours just to be sure
> >> though). I had to go down and fix some erratic folder names that
> >> resulted from the botched separator handling on some macOS Mail
> >> accounts.
> > 
> > Did it change anything on Dovecot disk/storage or is the IMAP separator just
> > "virtual" - ephemeral ?
> 
> Changing the separator won't fix anything that already exists. You should see 
> nonsense folders in the form of  '.folder\2esubfolder‘ there that cannot be 
> worked with in any way. I manually moved the contents of these to their 
> properly named ('.folder.subfolder‘) variants - on disk.

Thanks for the warning Filip!

-- 
Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/


signature.asc
Description: PGP signature


Re: Changing IMAP separator - does it break things?

2020-10-14 Thread Victor Sudakov
Markus Winkler wrote:
> 
> On 14.10.20 04:36, Victor Sudakov wrote:
> > Do you think I can change the hierarchy separator in the "inbox"
> > namespace without breaking other clients and the mail layout on disk,
> > losing mail etc?
> 
> I personally would try to avoid such a change (really IMHO), especially if
> it's "only":
> 
> > I don't want to break mail for 50 people just to please one Mac Mail
> > user.
> 
> _one_ user. Could Thunderbird or another IMAP client be an option for this
> single user? And perhaps Apple can tell some details when their Mail client
> will be standards-compliant?

Looking at https://discussions.apple.com/thread/8347018 I don't hold my breath.

> 
> Besides that: changing the hierarchy separator is generally possible. But
> you schould try and check that with a test system to prevent problems with
> your productive environment and all the other users.
> 

I was hoping someone had already done that and I could skip this step :-)

-- 
Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/


signature.asc
Description: PGP signature


Re: Changing IMAP separator - does it break things?

2020-10-14 Thread Victor Sudakov
Filip Hajný wrote:
> > 
> > On 14.10.20 04:36, Victor Sudakov wrote:
> >> Do you think I can change the hierarchy separator in the "inbox"
> >> namespace without breaking other clients and the mail layout on disk,
> >> losing mail etc?
> > 
> > I personally would try to avoid such a change (really IMHO), especially if 
> > it's "only":
> > 
> >> I don't want to break mail for 50 people just to please one Mac Mail
> >> user.
> > 
> > _one_ user. Could Thunderbird or another IMAP client be an option for this 
> > single user? And perhaps Apple can tell some details when their Mail client 
> > will be standards-compliant?
> > 
> > Besides that: changing the hierarchy separator is generally possible. But 
> > you schould try and check that with a test system to prevent problems with 
> > your productive environment and all the other users.
> > 
> 
> I had to do it with 10-20 live users and it went fine, nobody noticed
> anything (I made the change in the night hours just to be sure
> though). I had to go down and fix some erratic folder names that
> resulted from the botched separator handling on some macOS Mail
> accounts.

Did it change anything on Dovecot disk/storage or is the IMAP separator just
"virtual" - ephemeral ?

> 
> The funny thing is that I set up a vanilla Dovecot server elsewhere
> and subfolders worked fine there on the very same macOS client.
> Couldn’t find any significant difference in the configs that would
> explain the problem, also the relative lack of similar reports out
> there seemed mind boggling.

Those Mac clients who do not use nested folders do not seem to be
affected. That is, I've already suggested to the Mac Mail user that he
start Thunderbird, move all his mailboxes into the IMAP root folder, and
then go on using Mac Mail. I hope that's what he has done.

> 
> (I’m using the Dovecot-based Mailcow mail stack for production, which
> makes troubleshooting a little more challenging.)

-- 
Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/


signature.asc
Description: PGP signature


Changing IMAP separator - does it break things?

2020-10-13 Thread Victor Sudakov
Dear Colleagues,

I am using Dovecot 2.3.4.1 with maildirs. Just found out that MacOS Mail
clients cannot work with nested folders, presumably because the MacOS
Mail does not understand "." as the IMAP separator.

Other clients (ThunderBird, Sylpheed, mutt) work fine.

Do you think I can change the hierarchy separator in the "inbox"
namespace without breaking other clients and the mail layout on disk,
losing mail etc? 

I don't want to break mail for 50 people just to please one Mac Mail
user. The users are advanced developers actively using mail sorting
rules, nested folders etc.


My `doveconf -n` is here: https://termbin.com/w1wd


-- 
Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/


signature.asc
Description: PGP signature


all of a sudden, slow resync

2019-01-27 Thread Victor Sudakov
Dear Colleagues,

All of a sudden, I've begun receiving this output when reindexing my mail boxes:

# /usr/local/bin/doveadm force-resync -u vas "*"
doveadm(vas): Warning: Transaction log file 
/home/vas/Mail/sibptus/.imap/sent/dovecot.index.log was locked for 55 seconds 
(Mailbox was synchronized)
doveadm(vas): Warning: Transaction log file 
/home/vas/Mail/sibptus/.imap/dss-30-06-2010/dovecot.index.log was locked for 56 
seconds (Mailbox was synchronized)
doveadm(vas): Warning: Transaction log file 
/home/vas/Mail/sibptus/.imap/dss-2014/dovecot.index.log was locked for 95 
seconds (Mailbox was synchronized)
doveadm(vas): Warning: Transaction log file 
/home/vas/Mail/sibptus/.imap/dss-20-06-2012/dovecot.index.log was locked for 72 
seconds (Mailbox was synchronized)
doveadm(vas): Warning: Transaction log file 
/home/vas/Mail/sibptus/.imap/dss-18-05-2009/dovecot.index.log was locked for 31 
seconds (Mailbox was synchronized)
doveadm(vas): Warning: Transaction log file 
/home/vas/Mail/sibptus/.imap/dss-07-12-2008/dovecot.index.log was locked for 56 
seconds (Mailbox was synchronized)
doveadm(vas): Warning: Transaction log file 
/home/vas/Mail/sibptus/.imap/dns-operations/dovecot.index.log was locked for 95 
seconds (Mailbox was synchronized)

And it really takes forever to finish.  What could cause this?

FreeBSD 11.2-RELEASE-p8, dovecot-2.3.3_4

-- 
Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/


Re: mailbox locking

2018-12-16 Thread Victor Sudakov

Victor Sudakov wrote:


I use exim's appendfile transport, procmail and a local mutt on my
system, they all (to my knowledge) use lockfiles when working with
mboxes.


[vas@adm2 ~] procmail -v | & grep Locking
Locking strategies: dotlocking, lockf()

vas@adm2 ~] mutt -v|grep -i lock 
Configure options: '--disable-fcntl' '--with-ssl=/usr' '--with-docdir=/usr/local/share/doc/mutt' '--sysconfdir=/usr/local/etc' '--enable-external-dotlock' '--enable-pop' '--enable-imap' '--enable-compressed' '--enable-sidebar' '--disable-flock' '--disable-gpgme' '--with-gss=/usr' 'CFLAGS=-I/usr/include -O2 -pipe  -fstack-protector -fno-strict-aliasing ' 'LDFLAGS=-L/usr/lib  -L/usr/local/lib -Wl,-rpath=/usr/local/lib:/usr/lib -ltinfow  -fstack-protector ' 'LIBS=-lkrb5 -lgssapi -lgssapi_krb5 ' 'KRB5CONFIG=/usr/bin/krb5-config' '--without-bdb' '--without-kyotocabinet' '--disable-hcache' '--without-tokyocabinet' '--with-libiconv-prefix=/usr/local' '--with-idn2' '--enable-locales-fix' '--disable-nls' '--with-sasl=/usr/local' '--enable-smtp' '--prefix=/usr/local' '--localstatedir=/var' '--mandir=/usr/local/man' '--disable-silent-rules' '--infodir=/usr/local/info/' '--build=amd64-portbld-freebsd11.2' 'build_alias=amd64-portbld-freebsd11.2' 'CC=cc -I/usr/local/include' 'CPPFLAGS=' 'CPP=cpp' -HOMESPOOL  +USE_SETGID  +USE_DOTLOCK  +DL_STANDALONE  -USE_FCNTL  -USE_FLOCK   
[vas@adm2 ~] 


# exim -bP transport local_delivery | grep -i lock
lock_fcntl_timeout = 0s
lock_flock_timeout = 0s
lock_interval = 3s
lock_retries = 10
lockfile_mode = 0600
lockfile_timeout = 30m
use_fcntl_lock
no_use_flock_lock
use_lockfile
no_use_mbx_lock



However, `doveconf | grep lock` says

dotlock_use_excl = yes
lock_method = fcntl
mail_max_lock_timeout = 0
mbox_dotlock_change_timeout = 2 mins
mbox_lock_timeout = 5 mins
mbox_read_locks = fcntl
mbox_write_locks = dotlock fcntl
pop3_lock_session = no


Do I need to change anything in dovecot's default locking setup? Does
it still use lockfiles on mboxes or not? There are some contradictory
parameters IMHO.


--
Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/


mailbox locking

2018-12-15 Thread Victor Sudakov

Dear Colleagues,

I use exim's appendfile transport, procmail and a local mutt on my 
system, they all (to my knowledge) use lockfiles when working with 
mboxes.


However, `doveconf | grep lock` says

dotlock_use_excl = yes
lock_method = fcntl
mail_max_lock_timeout = 0
mbox_dotlock_change_timeout = 2 mins
mbox_lock_timeout = 5 mins
mbox_read_locks = fcntl
mbox_write_locks = dotlock fcntl
pop3_lock_session = no


Do I need to change anything in dovecot's default locking setup? Does 
it still use lockfiles on mboxes or not? There are some contradictory 
parameters IMHO.


--
Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/


Re: Local access to IMAP mailboxes

2018-09-29 Thread Victor Sudakov
Aki Tuomi wrote:
> > 
> > Is this that corrupted index case? It even causes the panic in the
> > daemon. Can I fix the index or somehow reindex the mailbox?
> > 
> 
> You can use doveadm force-resync -u vas "*"

Thanks!

-- 
Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/


Re: Local access to IMAP mailboxes

2018-09-28 Thread Victor Sudakov
This time an Android IMAP client complains about the "unexpected end
of the network stream" while opening a mailbox named "dss", and
dovecot logs:

Sep 28 23:01:34 admin dovecot: imap-login: Login: user=, method=PLAIN, 
rip=78.140.19.131, lip=95.179.154.55, mpid=85536, TLS, 
session=<6ITSkfB2JfNOjBOD>
Sep 28 23:01:35 admin dovecot: Error: imap(vas)<85536><6ITSkfB2JfNOjBOD>: 
Corrupted record in index cache file 
/home/vas/Mail/.imap/dss/dovecot.index.cache: UID 56: Broken physical size in 
mailbox dss: read(/home/vas/Mail/dss) failed: Cached message size smaller than 
expected (8271 < 8282, box=dss, UID=56)
Sep 28 23:01:35 admin dovecot: Error: imap(vas)<85536><6ITSkfB2JfNOjBOD>: 
Mailbox dss: UID=56: read(/home/vas/Mail/dss) failed: Cached message size 
smaller than expected (8271 < 8282, box=dss, UID=56) (FETCH BODY[2])
Sep 28 23:01:35 admin dovecot: imap(vas)<85536><6ITSkfB2JfNOjBOD>: FETCH read() 
failed in=896 out=54723 deleted=0 expunged=0 trashed=0 hdr_count=15 
hdr_bytes= body_count=14 body_bytes=37063
Sep 28 23:02:54 admin dovecot: imap-login: Login: user=, method=PLAIN, 
rip=78.140.19.131, lip=95.179.154.55, mpid=85560, TLS, 
session=
Sep 28 23:02:55 admin dovecot: Error: imap(vas)<85560>: 
Corrupted record in index cache file 
/home/vas/Mail/.imap/dss/dovecot.index.cache: UID 27: Broken physical size in 
mailbox dss: read(/home/vas/Mail/dss) failed: Cached message size smaller than 
expected (4867 < 4878, box=dss, UID=27)
Sep 28 23:02:55 admin dovecot: imap(vas)<85560>: Panic: file 
istream.c: line 315 (i_stream_read_memarea): assertion failed: (old_size <= 
_stream->pos - _stream->skip)
Sep 28 23:02:55 admin dovecot: imap(vas)<85560>: Fatal: 
master: service(imap): child 85560 killed with signal 6 (core not dumped - 
https://dovecot.org/bugreport.html#coredumps - set service imap { 
drop_priv_before_exec=yes })


Is this that corrupted index case? It even causes the panic in the
daemon. Can I fix the index or somehow reindex the mailbox?

-- 
Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/


Re: Local access to IMAP mailboxes

2018-09-28 Thread Victor Sudakov
Joseph Tam wrote:

[dd]

> 
> Whether you use any of them is up to you.  As I said, direct mailbox
> file access will work.  However, if you deal with Gb size mailboxes,
> re-indexing and general mail operations will be painful.
> 
> > My mail goes through procmail, so Dovecot will not be the only one to
> > touch the mboxes anyway.
> 
> Not a deterrent: replace all mailbox recipies with a pipe to dovecot's LDA
> 
>   :0 ... pattern ...
>   | /path/to/dovecot-lda -d {user} -m {mailbox}
> 
>   ...
> 
>   # End of file: deliver to inbox
>   :0 w
>   | /path/to/dovecot-lda -d {user}
> 

This will clutter up ~/.procmailrc, but may be I'll try someday.

Now I have encountered a different problem. My Android IMAP client
(the Gmail map) shows lots of mails in my Inbox. However, I already
deleted those mails locally from /var/mai/vas. They are being cached
somewhere. 

Is it not dovecot caching them? 

Nor can I find a way to forcefully rescan an IMAP folder in the Gmail app.


-- 
Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/


Re: Local access to IMAP mailboxes

2018-09-28 Thread Victor Sudakov
Joseph Tam wrote:

[dd]

> 
> Whether you use any of them is up to you.  As I said, direct mailbox
> file access will work.  However, if you deal with Gb size mailboxes,
> re-indexing and general mail operations will be painful.
> 
> > My mail goes through procmail, so Dovecot will not be the only one to
> > touch the mboxes anyway.
> 
> Not a deterrent: replace all mailbox recipies with a pipe to dovecot's LDA
> 
>   :0 ... pattern ...
>   | /path/to/dovecot-lda -d {user} -m {mailbox}
> 
>   ...
> 
>   # End of file: deliver to inbox
>   :0 w
>   | /path/to/dovecot-lda -d {user}
> 

This will clutter up ~/.procmailrc, but may be I'll try someday.

Now I have encountered a different problem. My Android IMAP client
(the Gmail map) shows lots of mails in my Inbox. However, I already
deleted those mails locally from /var/mai/vas. They are being cached
somewhere. 

Is it not dovecot caching them? 

Nor can I find a way to forcefully rescan an IMAP folder in the Gmail app.


-- 
Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/


Re: Local access to IMAP mailboxes

2018-09-27 Thread Victor Sudakov
Larry Rosenman wrote:
> 
> Larry Rosenman wrote:
> > I have my dovecot running with TLS, so the passwords are NOT 
> transmitted in
> > the clear (starttls).
> 
> The problem is not transmitting them in the clear but keeping them in
> the clear in a local file like muttrc, or entering the password each
> time you launch mutt.
> 
> 
> Hence my gpg text file trick. (  

Do you enter your gpg password each time you launch mutt, or do you
use some kind of gpg agent?

-- 
Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/


Re: Local access to IMAP mailboxes

2018-09-27 Thread Victor Sudakov
Larry Rosenman wrote:
> I have my dovecot running with TLS, so the passwords are NOT transmitted in
> the clear (starttls).

The problem is not transmitting them in the clear but keeping them in
the clear in a local file like muttrc, or entering the password each
time you launch mutt.


-- 
Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/


Re: Local access to IMAP mailboxes

2018-09-27 Thread Victor Sudakov
Larry Rosenman wrote:
> What I do is keep my passwords in a file encrypted by GPG and have mutt do:
> source "gpg -q --textmode -d ~/.neomutt/passwords.gpg  |"
> 
> that way they're not readable except by use of a passworded GPG key.
> 

Very clever, I must admit.

-- 
Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/


Re: Local access to IMAP mailboxes

2018-09-27 Thread Victor Sudakov
Joseph Tam wrote:
> 
> > However, I often read and modify the mailboxes locally with mutt (e.g.
> > append and delete mails).
> >
> > Should I expect any problems wit Dovecot indexes etc? What if I even
> > do "rm ~/Mail/some/mailbox", will Dovecot be mad at me?
> 
> I do it all the time.  Works fine.

Great, thank you!

> 
> As others have written, you may see performance degradation as Dovecot
> will have to rebuild indices, but if you have small mailboxes, this won't
> be too bad.  The only reason I use direct file access rather than IMAP
> is that I'm too lazy to work out a passwordless access method.  If this
> doesn't bother you or you can configure this (e.g. Kerberos, keyring,
> etc.), IMAP access is preferable since you won't pull the indices out
> from Dovecot's feet.

What passwordless access methods does Dovecot support? I'm more or
less experienced with GSSAPI but for the present I would not like to
set up a KDC somewhere on a box exposed to the Internet.

> 
> You'll also get a lot of innocuous griping in the log files about
> UIDVALIDITY and mailbox corruption, but they can be safely ignored.

My mail goes through procmail, so Dovecot will not be the only one to
touch the mboxes anyway.

-- 
Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/


Re: Local access to IMAP mailboxes

2018-09-27 Thread Victor Sudakov
Thomas Leuxner wrote:
> 
> > > >> However, I often read and modify the mailboxes locally with Mutt (e.g.
> > > >> append and delete mails).
> 
> Why not use Mutt's IMAP capabilities and keep the indexes nice and clean?

Maybe the only reason is that I don't want to bother with
authentication and don't want to keep my password in muttrc.

Anyway, my mail is sorted and delivered to ~/Mail/* by procmail, so
the mboxes will be touched by a process outside of dovecot.


-- 
Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/


Re: Best way to move mail from one server to another

2018-09-27 Thread Victor Sudakov
Communigate Pro has a nice Migration/MoveIMAPMail utility. As
Communigate is free to use for up to five accounts, I think it is
legal to install it and use the MoveIMAPMail utility.

I have used it once to migrate mail from Communigate to dovecot.

-- 
Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/


Re: Local access to IMAP mailboxes

2018-09-26 Thread Victor Sudakov
Sami Ketola wrote:
> > On 26 Sep 2018, at 13.07, Aki Tuomi  wrote:
> > 
> >> 
> >> I have made mailboxes in ~/Mail available via IMAP (Dovecot 2.3.2.1),
> >> that is: "mail_location = mbox:~/Mail:INBOX=/var/mail/%u"
> >> 
> >> However, I often read and modify the mailboxes locally with Mutt (e.g.
> >> append and delete mails).
> >> 
> >> Should I expect any problems wit Dovecot indexes etc? What if I even
> >> do "rm ~/Mail/some/mailbox", will Dovecot be mad at me?
> >> 
> > 
> > Dovecot is tolerant to changes with mbox and maildir. It will reindex if
> > it detects someone changing them outside.

That is good news! Thank you Aki!

> 
> That is true but it however has performance impacts if the caching
> is impaired but still does works.

Ah, is this perhaps the reason why my Android IMAP client sometimes takes so
long to list a folder's contents? I must have touched the folder
locally by Mutt and Dovecot is reindexing, is that right?

-- 
Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/


Local access to IMAP mailboxes

2018-09-26 Thread Victor Sudakov
Dear Colleagues,

I have made mailboxes in ~/Mail available via IMAP (Dovecot 2.3.2.1),
that is: "mail_location = mbox:~/Mail:INBOX=/var/mail/%u"

However, I often read and modify the mailboxes locally with mutt (e.g.
append and delete mails).

Should I expect any problems wit Dovecot indexes etc? What if I even
do "rm ~/Mail/some/mailbox", will Dovecot be mad at me?

-- 
Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/


Re: dovecot/FreeBSD and Android IMAP clients

2018-09-25 Thread Victor Sudakov
Aki Tuomi wrote:
> You can try doing this:
> 
> protocol imap {
> 
>   rawlog_dir = %h/rawlogs
> 
> }
> 
> then make directory under user's homedir called rawlogs and chmod 0777 it.
> 
> Then try, you should end up with lots of files that are full of chatter
> between the client & server, maybe it gives you more indication what
> goes wrong.

I am afraid I don't know the protocol well enough to parse this
chatter. I was looking for a more cookbook solution.

-- 
Victor Sudakov,  VAS4-RIPE, VAS47-RIPN
2:5005/49@fidonet http://vas.tomsk.ru/


dovecot/FreeBSD and Android IMAP clients

2018-09-24 Thread Victor Sudakov
Dear Colleagues,

I have a fairly vanilla setup of dovecot on FreeBSD, serving IMAP and POP3. 
Thunderbird/IMAP works fine, and so does mutt/IMAP.

However, Android clients (Gmail/IMAP and K-9 Mail) have problems
accessing folders other than the INBOX. They either show them empty
with no mails (K-9) or just wait forever to view the contents (Gmail app).

Do I need to set up some workarounds or hacks in dovecot for Android
IMAP clients to work correctly? Any advice is appreciated.


My config is below:

# 2.3.2.1 (0719df592): /usr/local/etc/dovecot/dovecot.conf
# OS: FreeBSD 11.2-RELEASE-p3 amd64  
# Hostname: admin.sibptus.ru
mail_location = mbox:~/Mail:INBOX=/var/mail/%u
mail_privileged_group = mail
namespace inbox {
  inbox = yes
  location = 
  mailbox Drafts {
special_use = \Drafts
  }
  mailbox Junk {
special_use = \Junk
  }
  mailbox Sent {
special_use = \Sent
  }
  mailbox "Sent Messages" {
special_use = \Sent
  }
  mailbox Trash {
special_use = \Trash
  }
  prefix = 
}
passdb {
  driver = pam
}
protocols = imap pop3
ssl_cert = http://vas.tomsk.ru/