Re: Question for upgrading

2018-12-16 Thread John Capo via Info-cyrus
On Thu, December 13, 2018 13:25, Egoitz Aurrekoetxea wrote:
> Hi again!
>
>
> Else as a simplication way can you replicate any manner a 2.3 with some
> newer version?. At least in manual mode (not rolling)?.

The replication protocol in 2.4 is not compatible wit 2.3.

There is no easy way.  I'm rsync'ing one account at a time between 2.3 and 2.4 
with IMAP/POP and LMTP access disabled, followed by a reconstruct, and then 
enabling IMAP/POP and LMTP access.

Many terrabytes to go.

You could also look at imapsync but its slow.

>
> Cheers.
>
>
> ---
>
>
> EGOITZ AURREKOETXEA
> Departamento de sistemas
> 944 209 470
> Parque Tecnológico. Edificio 103
> 48170 Zamudio (Bizkaia)
> ego...@sarenet.es www.sarenet.es [1] Antes de imprimir este correo 
> electrónico piense si es
> necesario hacerlo.
>
> El 13-12-2018 16:52, Egoitz Aurrekoetxea escribió:
>
>
>> Good afternoon,
>>
>>
>> I was trying to upgrade part of our Cyrus imap installation, concretely that 
>> one consisting in
>> still 2.3. I was planning to set up Cyrus 3.0. I have seen all works 
>> properly except for the
>> unexpunge command because as someone stated here, a reconstruct -V max was 
>> needed.The problem
>> is that this reconstruct command, takes ages and I'm not able to keep the 
>> service offline so
>> many time. So I have been thinking in the following scenario :
>>
>> - Cyrus 2.3 master -> Cyrus 2.4 slave
>>
>>
>> Get this 2.4 slave ready and set it as master. But here comes my first 
>> doubt. Does the 2.4
>> replication work with the 2.3 replication?. Can in this pair, both (the 2.3 
>> and the 2.4) be
>> both master and slave?. I mean to switch roles in the pair. Make one become 
>> master and the
>> other slave and  vice versa?.
>>
>> Let's think now Cyrus 2.4 is ready and working.
>>
>>
>> - Now, I would set up a new 3.0 slave. I know 2.4 could replicate with 3.0. 
>> So I would get the
>> 3.0 ready and then set 3.0 as master. Can in this pair both the 2.4 and 3.0 
>> be master and
>> slave?. Meaning again to the same role switching commented before... to make 
>> one to be master
>> and the other slave or vice versa
>>
>> I'l will end up with 2 3.0 master and slave... but I need to trace the 
>> path...
>>
>>
>> Does anyone see any other way?.
>>
>>
>> Best regards,
>>
>>
>> -
>>
>>
>> --
>>
>>
>> EGOITZ AURREKOETXEA
>> Departamento de sistemas
>> 944 209 470
>> Parque Tecnológico. Edificio 103
>> 48170 Zamudio (Bizkaia)
>> ego...@sarenet.es www.sarenet.es [1] Antes de imprimir este correo 
>> electrónico piense si es
>> necesario hacerlo. 
>> Cyrus Home Page: http://www.cyrusimap.org/
>> List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/
>> To Unsubscribe:
>> https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus
>>
>
>
> Links:
> --
> [1] http://www.sarenet.es



Cyrus Home Page: http://www.cyrusimap.org/
List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/
To Unsubscribe:
https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus


Shared folders (AKA public) namespace showing twice

2018-12-16 Thread Binarus
Dear all,

hopefully, this is my last post for today.

I just have put a new server running 2.5.10 live and have noticed that the 
Shared Folders are appearing twice. Please note that I have renamed the "Shared 
Folders" prefix to "public" (see below). When a user who has access to the 
Shared Folders logs in (e.g. via Thunderbird), that user's mailbox folder 
hierarchy shows up as follows:

Inbox
Drafts
Sent
Junk
Trash
public <--- expected ("Shared folders" namespace)
  Folder1
  Folder2
  public <--- This is my problem
  Folder3
  ...

As you can see, the "virtual" public folder contains all shared (public) 
subfolders (nothing is missing, the permissions and all IMAP operations are 
working as expected), but there is an additional subfolder "public" which never 
has been actively created and which was empty every time we examined it.

I originally thought that this was an artifact which had been created when 
moving all data from the old server to the new one, and deleted it. Upon 
deletion, Thunderbird did not show any error and moved that folder into 
"Trash". From then on, it was not visible any more at its original place. But 
guess what: It was there again as soon as Thunderbird had been restarted.

To make sure that this was not due to a Thunderbird bug, I connected to the 
server in question as administrator (cyrus in this case) via cyradm and listed 
all mailboxes and subfolders (lm command). Indeed, there was *no* mailbox or 
folder which had "public" as its name.

I investigated the issue further with the help of telnet, which revealed 
something interesting (I logged in as a normal non-admin user who has access to 
the shared (public) folders; I have left out the prologue and the LOGIN dialog 
for brevity and clarity):

root@morn:/etc# telnet localhost imap
[...]
A1 NAMESPACE
* NAMESPACE (("" ".")) (("other." ".")) (("public." "."))
A1 OK Completed
A1 LIST "" "%"
* LIST (\Noinferiors \HasNoChildren) "." INBOX
* LIST (\HasNoChildren) "." Drafts
* LIST (\HasNoChildren) "." Junk
* LIST (\HasNoChildren) "." Sent
* LIST (\HasChildren) "." Trash
* LIST (\Noselect \HasChildren) "." public.public
A1 OK Completed (0.003 secs 7 calls)

The NAMESPACE command's return value is as expected, but the LIST command 
returns "public.public" at the place where it (IMHO) just should return 
"public". I believe that this is the reason for our problem, and that this 
can't be correct.

This might or might not be related to the following bug report / discussion 
from 2005: https://github.com/cyrusimap/cyrus-imapd/issues/744

In every case, listing "public.public" is wrong, isn't it?

I can further tell that we did not have that problem with our old server 
running 2.4.16 with the *literally same* configuration files (imapd.conf and 
cyrus.conf).

These are the snippets from imapd.conf which are probably relevant:

altnamespace: yes
userprefix: other
sharedprefix: public
unixhierarchysep: no
autocreate_quota: 0

Could somebody please tell me if the behavior I have observed is a bug or if I 
am doing something wrong? If it's a bug, is there something I can do about it 
(besides compiling the newest version of Cyrus imapd myself or changing the 
Linux distro)?

Thank you very much in advance,

Binarus


Cyrus Home Page: http://www.cyrusimap.org/
List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/
To Unsubscribe:
https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus


Documentation for Cyrus::IMAP::Admin and friends

2018-12-16 Thread Binarus
Dear all,

as described in my previous messages, I recently had a hard time relocating 
(i.e. moving) mailboxes and the public namespace from 2.4.16 to a new server 
running 2.5.10. I would have happily written a Perl script which surely had 
solved much of my problems, but I couldn't do that due to the lack of 
documentation for the respective Perl modules.

This is best explained by example:

I have found a Perl script on the 'net which looks trustworthy at the first 
sight and which contains (among others) the following lines of code:

use Cyrus::IMAP::Admin;

# Connect to Cyrus
$imap = Cyrus::IMAP::Admin->new("my_server") || die "Unable to connect to 
my_server";

$imap->authenticate(-user => "foo", 
-mechanism => "LOGIN",
-password => "password",
);

I wanted to understand exactly what the script does and thus tried to find 
Cyrus::IMAP::Admin's documentation. So I issued

man Cyrus::IMAP::Admin

and found that some methods are documented, but not the authenticate() method 
which is needed first and one of the most important ones. However, the man page 
states (in the section about the "new()" method):

"Instantiates a cyradm object.  This is in fact an Cyrus::IMAP object with a 
few additional methods, so all Cyrus::IMAP methods are available if needed.  
(In particular, you will always want to use the "authenticate" method.)"

This tricked me into believing that the "authenticate" method would be part of 
Cyrus::IMAP and would be explained in that module's documentation, so I issued

man Cyrus::IMAP

Well, this man page "documents" the method by exactly one line (identically in 
two places):

$client->authenticate;

It does not explain anything about it; notably, it does not mention any 
parameters. But from the example script mentioned above, I knew that there was 
more to it. So I read the rest of that man page and found:

"The Cyrus::IMAP module provides an interface to the Cyrus imclient library."

So I installed the development files for Cyrus imapd and issued

man imclient

Now, finally, this is a man page a C programmer probably can live with. But 
when looking more thoroughly into it, I saw that there is no "password" 
parameter to the authenticate() function although the Perl module's 
authenticate() method has one:

int imclient_authenticate (struct imclient *imclient, struct sasl_client 
**availmech, const char *service, const char *user, int protallowed);

Plus, I could not find any hints regarding the relationship between the 
parameters of the C functions and those of the Perl module methods.

I then headed over to cyrusimap.org and tried to find documentation for the 
Perl modules. Surprisingly, I couldn't. Not a single word. They don't seem to 
exist. The tools and helper programs are documented, but the Perl modules are 
not even mentioned.

The same applies to CPAN: The modules cannot be found there.

To make a long story short:

Where can I find reasonable (in the sense: may be short and bad, but must be 
*complete*) documentation for Cyrus::IMAP::Admin and Cyrus::IMAP so that I can 
write my own helper scripts in the future? Do I really have to unpack Cyrus 
imapd's sources and read the module source code to get some ideas?

Thank you very much in advance,

Binarus

Cyrus Home Page: http://www.cyrusimap.org/
List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/
To Unsubscribe:
https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus


Why do we need to run reconstruct after having moved mailboxes using cyradm's xfer command?

2018-12-16 Thread Binarus
Dear all,

yesterday, I have moved a bunch of user mailboxes and public folders from a 
server running 2.4.16 to another server running 2.5.10, using cyradm's xfer 
command (see my previous messages).

After having finished the migration, I noticed a weird behavior in Thunderbird 
(which is our standard email client): When trying to move a message from the 
Inbox to the Junk or Trash folder, the message disappeared from the Inbox for a 
short time, then reappeared. The log files on the server were showing the 
dreaded entries:

Dec 16 01:12:59 morn cyrus/imaps[14914]: Fatal error: Internal error: assertion 
failed: imap/mailbox.c: 2850: !message_guid_isnull(&record->guid)

"Fortunately", a lot of other users are affected by such log entries and weird 
email client behavior as well, so finding the solution on the 'net was not too 
difficult: Running reconstruct did not lead to anywhere, but running 
reconstruct -V max was the solution.

This lets me scratch my head:

In the past, I have upgraded Cyrus imapd at least three times, each time using 
imapsync (instead of cyradm's xfer command) to move the mailboxes and the 
public namespace (including all messages and subfolders) from the old server to 
the new one. In none of these cases, it was necessary to reconstruct anything 
afterwards. This would have been illogical anyway: Each time, the new server 
had been setup from scratch, and no mailboxes / messages / folders / subfolders 
had been moved directly via file transfer from the old to the new server.

Now that I have used cyradm's xfer command to relocate the mailboxes / messages 
/ folders / subfolders, I surprisingly had to run the "heaviest" form of 
reconstruct (-V max).

Could anybody please shortly explain why? What exactly are the techniques and 
mechanisms cyradm's xfer uses to do its thing? I had been quite sure that it 
just uses the IMAP protocol, but there seems to be more to it ...

Thank you very much for any insight,

Binarus

Cyrus Home Page: http://www.cyrusimap.org/
List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/
To Unsubscribe:
https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus


Feature request: Add wildcard capabilities to cyradm's xfer command or make it handle public namespaces reasonably

2018-12-16 Thread Binarus
Dear all,

yesterday, I have retired a server running 2.4.16 and have transferred the 
folder structure and all messages to a new server running 2.5.10.

In the past, I have used imapsync to do that sort of transfers, which worked 
reliably. But this time, I decided to prefer an "original vendor tool"; hence, 
I used cyradm and its xfer command.

After having fiddled around with the configuration files on the old and the new 
server, I could move the user mailboxes without any problem (all mailboxes 
whose name begins with "user."). This process went smoothly and worked 
reasonably fast, and (the most important thing for me) all subfolders in each 
mailbox have been moved recursively.

The problem:

I don't have too many users / mailboxes, but a huge and well-crafted (in terms 
of folder structure and permissions) public folder (namespace) which is an 
important collaboration tool. It did not seem possible to relocate the public 
folder in a reasonable manner using cyradm's xfer command. Obviously, it is 
able to relocate a single folder from one public namespace to another, but it 
does not relocate this folder's subfolders.

Unfortunately, in contrast to some other of cyradm's commands, xfer does not 
seem to support wildcards either.

This was the moment when I thought about stopping using cyradm for this task 
and using imapsync again. But I am a bit stubborn sometimes, so I went on and 
ended up with manually moving several thousands of folders (actually, it was 
semi-automatic: from within cyradm, I issued an lm command, copied a part of 
the listing from the terminal window into a text editor, generated the 
respective commands there (using macros within the editor), pasted the commands 
back into the terminal window, waited until it had finished, and restarted that 
process).

This is ugly and silly.

Hence the question:

Could we extend cyradm's xfer command so that we could give wildcards to it, 
like, for example, cyradm's lm command? Or (more elegant and desirable) so that 
it recursively includes all subfolders when it relocates a folder, even when 
this folder is in the public namespace?

Thank you very much for any thoughts,

Binarus

P.S. Please see my next messages for reasons why I didn't write a Perl script 
using Cyrus::IMAP:Admin for this task.

Cyrus Home Page: http://www.cyrusimap.org/
List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/
To Unsubscribe:
https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus


Running a script with cyradm throwing ReadLine errors

2018-12-16 Thread Binarus
Dear all,

I was just trying to explore cyradm a little bit further and hence was 
experimenting with its scripting capabilities. Having cyradm run a script 
should be pretty easy. man cyradm tells us:

  perl -MCyrus::IMAP::Shell -e 'run("myscript")'

So I created the simplest possible script (that means an empty one) and tried 
to run it:

  touch 000
  chmod a+x 000 (just in case ...)
  perl -MCyrus::IMAP::Shell -e 'run("000")'

The only thing I got was:

  Use of uninitialized value within @layers in string eq at 
/usr/local/lib/x86_64-linux-gnu/perl/5.24.1/Term/ReadLine/Gnu.pm line 280.
  Bad filehandle: __DATA__ at 
/usr/local/lib/x86_64-linux-gnu/perl/5.24.1/Term/ReadLine/Gnu.pm line 769.

Putting something meaningful into the script did not change the situation.

I have googled and read documentation (mainly on cyrusimapd.org) for several 
hours, but could not find the reason for the problem.

I even have put allowplaintext=yes into imapd.conf and restarted imapd (knowing 
that this probably wasn't very smart, but the term "layers" in the error 
message made me mistrustful because there are authentication "layers", and I 
don't have any problems with Term::ReadLine::Gnu in general). As expected, this 
didn't change the situation either.

This happened with 2.4.16 as well as with 2.5.10.

Could anybody please tell me what I might do wrong here?

Thank you very much in advance,

Binarus


Cyrus Home Page: http://www.cyrusimap.org/
List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/
To Unsubscribe:
https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus