summaryrefslogtreecommitdiff
path: root/Administrator_Guide/en-US/Upgrading_from_Kolab_2_on_OpenPKG.xml
blob: 4b342d6b2a3ebdb6ccd7631b950edca2bdd5e657 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % BOOK_ENTITIES SYSTEM "Administrator_Guide.ent">
%BOOK_ENTITIES;
]>
<chapter id="chap-Administrator_Guide-Upgrading_from_Kolab_2_on_OpenPKG">
    <title>Upgrading from Kolab 2 on OpenPKG</title>
    <para>
        As Kolab Groupware used to be distributed as an OpenPKG stack, with different locations for files, the upgrade of a Kolab 2 server to a Kolab 3 server is a largely manual process.
    </para>
    <note>
        <para>
            The Kolab 3 server used here has been set up for the same domain name space as the Kolab 2 server. No users have been created on the Kolab 3 server.
        </para>

    </note>
    <para>
        <literal>kolab2.example.org</literal> refers to the Kolab 2 server, <literal>kolab3.example.org</literal> refers to the Kolab 3 server.
    </para>
    <procedure id="proc-Administrator_Guide-Upgrading_from_Kolab_2_on_OpenPKG-Preparations">
        <title>Preparations</title>
        <step>
            <para>
                During the migration, the Kolab 2 server cannot be allowed to;
            </para>
            <para>
                <orderedlist>
                    <listitem>
                        <para>
                            Receive new email.
                        </para>

                    </listitem>
                    <listitem>
                        <para>
                            Let users post/submit new data.
                        </para>

                    </listitem>

                </orderedlist>

            </para>
            <para>
                The easiest way to prevent any of this happening is to shut down all Kolab Groupware related services on <literal>kolab2.example.org</literal>:
            </para>
            <para>

<screen># <userinput>/kolab/bin/openpkg rc stop all</userinput></screen>

            </para>

        </step>
        <step>
            <para>
                Create a backup of the data from <literal>kolab2.example.org</literal>.
            </para>

        </step>
        <step>
            <para>
                Shut down the Cyrus IMAP service on <literal>kolab3.example.org</literal>:
            </para>
            <para>

<screen># <userinput>service cyrus-imapd stop</userinput></screen>

            </para>

        </step>
        <step>
            <para>
                Shut down the Kolab daemon on <literal>kolab3.example.org</literal>:
            </para>
            <para>

<screen># <userinput>service kolabd stop</userinput></screen>

            </para>

        </step>
        <step>
            <para>
                Update the settings related to the recipient policy in <filename>/etc/kolab/kolab.conf</filename>. The following settings are important:
            </para>
            <para>
                <itemizedlist>
                    <listitem>
                        <para>
                            The <literal>primary_mail</literal> setting in the <literal>[<replaceable>$domain</replaceable>]</literal> section.
                        </para>
                        <para>
                            The policy MUST<footnote> <para>
                                the policy enforces consistency in the <literal>mail</literal> attribute values for all users - and therefore mailbox names, and ACL entry subject validity
                            </para>
                            </footnote> either match the former convention used, if any, or not be enabled at all. See <xref linkend="exam-Administrator_Guide-Upgrading_from_Kolab_2_on_OpenPKG-Example_Migration_of_example.org" /> for an example and some more gotchas.
                        </para>
                        <important>
                            <para>
                                In case the recipient policy is not to be applied, consider updating the <literal>user_types</literal> as per the instructions in <xref linkend="sect-Administrator_Guide-Kolab_Web_Administration_Panel-Editing_user_types" />.
                            </para>

                        </important>

                    </listitem>
                    <listitem>
                        <para>
                            The <literal>secondary_mail</literal> setting in the <literal>[<replaceable>$domain</replaceable>]</literal> section.
                        </para>
                        <para>
                            This part of the policy does not apply should the <literal>primary_mail</literal> setting already have been disabled.
                        </para>

                    </listitem>

                </itemizedlist>

            </para>

        </step>

    </procedure>

    <example id="exam-Administrator_Guide-Upgrading_from_Kolab_2_on_OpenPKG-Example_Migration_of_example.org">
        <title>Example Migration of example.org</title>
        <para>
            Our first example has had a running Kolab 2.3 on OpenPKG server, with a general email address convention of "surname"@example.org.
        </para>
        <para>
            By default, a Kolab &PRODUCT_VERSION; Groupware server will apply a recipient policy for the <literal>mail</literal> attribute value of "givenname"."surname"@example.org. The recipient policy must therefore be adjusted.
        </para>
        <para>
            In the <literal>[example.org]</literal> section in <filename>/etc/kolab/kolab.conf</filename>, the <literal>primary_mail</literal> setting must be adjusted to match the "surname"@example.org convention:
        </para>

<programlisting language="INI Files">(...snip...)
[example.org]
primary_mail = %(surname)s@%(domain)s
(...snip...)</programlisting>
        <para>
            Now, users that are created will get a <literal>mail</literal> attribute value of "surname"@example.org assigned.
        </para>
        <warning>
            <para>
                First adding user John Doe will give him a <literal>mail</literal> attribute value of <emphasis>doe@example.org</emphasis>, but should you have a Jane Doe as well, she would get <emphasis>doe2@example.org</emphasis>. It is therefore important to add users in order.
            </para>

        </warning>

    </example>
    <procedure id="proc-Administrator_Guide-Upgrading_from_Kolab_2_on_OpenPKG-Migrate_the_Data_Through_Copying">
        <title>Migrate the Data Through Copying</title>
        <step>
            <para>
                Login to <literal>kolab3.example.org</literal> to execute the steps in this procedure.
            </para>

        </step>
        <!--

   It doesn't seem this step causes the annotations.{db,txt} to transfer 1:1
        <step>
            <para>
                Export the annotations database as flat, from skiplist:
            </para>
            <para>

<screen># <userinput>/kolab/bin/cvt_cyrusdb /kolab/var/imapd/annotations.db skiplist \</userinput>
&gt; <userinput>/kolab/var/imapd/annotations.txt flat</userinput></screen>

            </para>

        </step>
        //    --> <step>
            <para>
                Copy mailboxes.db and annotations.db. These files are located in <filename>/kolab/var/imapd/</filename> on your Kolab 2 server.
            </para>
            <para>

<screen># <userinput>scp root@kolab2.example.org:/kolab/var/imapd/annotations.db \</userinput>
&gt;    <userinput>/var/lib/imap/annotations.db</userinput>
(...)
# <userinput>scp root@kolab2.example.org:/kolab/var/imapd/mailboxes.db \</userinput>
&gt;    <userinput>/var/lib/imap/mailboxes.db</userinput>
(...)</screen>

            </para>

        </step>
        <step>
            <para>
                Migrate the mail spool:
            </para>
            <para>

<screen># <userinput>rsync -rltpHvz --progress --partial \</userinput>
&gt;    <userinput>kolab2.example.org:/var/imapd/spool/ \</userinput>
&gt;    <userinput>/var/spool/imap/</userinput>
(...)</screen>

            </para>

        </step>
        <step>
            <para>
                Migrate the seen and subscription databases:
            </para>
            <para>

<screen># <userinput>rsync -rltpHvz --progress --partial \</userinput>
&gt;    <userinput>kolab2.example.org:/var/imapd/domain/ \</userinput>
&gt;    <userinput>/var/lib/imap/domain/</userinput>
(...)
# <userinput>rsync -rltpHvz --progress --partial \</userinput>
&gt;    <userinput>kolab2.example.org:/var/imapd/user/ \</userinput>
&gt;    <userinput>/var/lib/imap/user/</userinput>
(...)</screen>

            </para>

        </step>
        <step>
            <para>
                Ensure the filesystem permissions are correct:
            </para>
            <para>

<screen># <userinput>chown -R cyrus:mail /var/lib/imap/ /var/spool/imap/</userinput></screen>

            </para>

        </step>
        <step>
            <para>
                Ensure only the cyrus user can read and write, and the mail group can read the contents of either directory tree:
            </para>
            <para>

<screen># <userinput>find /var/lib/imap -type f -exec chmod 640 {} \;</userinput>
# <userinput>find /var/lib/imap -type d -exec chmod 750 {} \;</userinput>
# <userinput>find /var/spool/imap -type f -exec chmod 640 {} \;</userinput>
# <userinput>find /var/spool/imap -type d -exec chmod 750 {} \;</userinput></screen>

            </para>

        </step>
        <xi:include href="step-convert-seen-databases.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
        <step>
            <para>
                Stop the Kolab daemon:
            </para>
            <para>

<screen># <userinput>service kolabd stop</userinput></screen>

            </para>

        </step>
        <step>
            <para>
                Start the Cyrus IMAP service on <literal>kolab3.example.org</literal>:
            </para>
            <para>

<screen># <userinput>service cyrus-imapd start</userinput></screen>

            </para>
            <important>
                <para>
                    Users should not yet be allowed to interact with the system at this point. We suggest closing access to the system through the firewall.
                </para>

            </important>

        </step>
        <xi:include href="step-select-all-mailboxes.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
        <step>
            <para>
                Annotations...
            </para>
            <para>

<screen># <userinput>kolab -c conf/kolab-kolab2.example.org.conf \</userinput>
&gt; <userinput>list-mailbox-metadata "user/john.doe/Calendar*@example.org"</userinput>
Folder user/john.doe/Calendar@example.org
  /shared/vendor/cmu/cyrus-imapd/lastpop
  /shared/vendor/cmu/cyrus-imapd/partition&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;default
  /shared/vendor/cmu/cyrus-imapd/lastupdate&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;8-Aug-2012 16:16:06 +0200
  /shared/vendor/cmu/cyrus-imapd/size&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;266564
  /shared/vendor/cmu/cyrus-imapd/pop3newuidl&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;true
  /shared/vendor/cmu/cyrus-imapd/sharedseen&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;false
  /shared/vendor/kolab/folder-type&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;event.default
  /shared/vendor/cmu/cyrus-imapd/condstore&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;true
  /shared/vendor/cmu/cyrus-imapd/duplicatedeliver&nbsp;&nbsp;&nbsp;false
  /shared/vendor/kolab/incidences-for&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;admins
  /shared/vendor/kolab/folder-test&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;true
Folder user/john.doe/Calendar/Private@example.org
  /shared/vendor/cmu/cyrus-imapd/lastpop
  /shared/vendor/cmu/cyrus-imapd/partition&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;default
  /shared/vendor/cmu/cyrus-imapd/lastupdate&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;8-Aug-2012 16:08:58 +0200
  /shared/vendor/cmu/cyrus-imapd/condstore&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;true
  /shared/vendor/cmu/cyrus-imapd/pop3newuidl&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;true
  /shared/vendor/cmu/cyrus-imapd/size&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;305426
  /shared/vendor/cmu/cyrus-imapd/sharedseen&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;false
  /shared/vendor/kolab/folder-type&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;event
  /shared/vendor/cmu/cyrus-imapd/duplicatedeliver&nbsp;&nbsp;&nbsp;false
# <userinput>kolab list-mailbox-metadata "user/john.doe/Calendar*@example.org"</userinput>
Folder user/john.doe/Calendar@example.org
  /shared/vendor/cmu/cyrus-imapd/lastpop
  /shared/vendor/cmu/cyrus-imapd/partition&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;default
  /shared/vendor/cmu/cyrus-imapd/lastupdate&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;8-Aug-2012 16:16:27 +0200
  /shared/vendor/cmu/cyrus-imapd/duplicatedeliver&nbsp;&nbsp;&nbsp;false
  /shared/vendor/cmu/cyrus-imapd/pop3newuidl&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;true
  /shared/vendor/cmu/cyrus-imapd/size&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;266564
  /shared/vendor/cmu/cyrus-imapd/sharedseen&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;false
  /shared/vendor/kolab/folder-type&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;event.default
Folder user/john.doe/Calendar/Private@example.org
  /shared/vendor/cmu/cyrus-imapd/lastpop
  /shared/vendor/cmu/cyrus-imapd/partition&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;default
  /shared/vendor/cmu/cyrus-imapd/lastupdate&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;8-Aug-2012 16:27:44 +0200
  /shared/vendor/cmu/cyrus-imapd/duplicatedeliver&nbsp;&nbsp;&nbsp;false
  /shared/vendor/cmu/cyrus-imapd/pop3newuidl&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;true
  /shared/vendor/cmu/cyrus-imapd/size&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;305426
  /shared/vendor/cmu/cyrus-imapd/sharedseen&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;false</screen>

            </para>
            <para>
                Fix'em:
            </para>

<programlisting language="Bash">#!/bin/bash

# Interesting Annotations
declare -a ia

ia[${#ia[@]}]="/shared/vendor/kolab/folder-type"
ia[${#ia[@]}]="/shared/vendor/kolab/folder-test"

for folder_search in user/*@example.org shared/*@example.org; do
    kolab -c conf/kolab-kolab.kolabsys.com.conf \
        list-mailbox-metadata "${folder_search}" | \
        while read line; do
            if [ ! -z "$(echo $line | grep ^Folder)" ]; then
                current_folder=$(echo $line | cut -d' ' -f2-)

                echo "Folder: '${current_folder}'"
            else
                annotation_key=$(echo $line | awk '{print $1}')
                annotation_value=$(echo $line | awk '{print $2}')

                i=0
                set_annotation=0
                while [ $i -lt ${#ia[@]} ]; do
                    if [ "${ia[$i]}" == "${annotation_key}" ]; then
                        set_annotation=1
                        break
                    fi
                    let i++
                done

                if [ ${set_annotation} -eq 0 ]; then
                    continue
                fi

                echo "Setting ${annotation_key} to ${annotation_value}"

                kolab set-mailbox-metadata \
                    "${current_folder}" \
                    "${annotation_key}" \
                    "${annotation_value}"
            fi
        done

done</programlisting>

        </step>

    </procedure>

    <para>
        find /var/spool/imap -type f -name "*." | sort | while read file ; do grep -l "X-Mailer: z-push-Kolab Backend" "$file" ; done
    </para>

</chapter>