summaryrefslogtreecommitdiff
path: root/hosted-kolab/15-adjust-configuration.sh
blob: 48c38219cde78c7da367c1c99cb6acf6066f9623 (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
#!/bin/bash

. ./settings.sh

rm -rf /etc/kolab/kolab.conf.orig
cp /etc/kolab/kolab.conf /etc/kolab/kolab.conf.orig

sed -r -i \
    -e "s/^domain_base_dn.*$/domain_base_dn = ${domain_base_dn}/g" \
    -e 's/^primary_mail.*/primary_mail = %(uid)s@%(domain)s/g' \
    -e '/^secondary_mail/,+10d' \
    -e '/^primary_mail/ a\
daemon_rcpt_policy = False' \
    -e '/kolab_wap/ a\
login_filter = (uid=%U@%d)\
devel_mode = 1\
debug_mode = trace' \
    -e 's/^auth_attributes.*$/auth_attributes = uid/g' \
    -e 's/^result_attribute.*$/result_attribute = uid/g' \
    -e 's/^domain_filter.*$/domain_filter = (\&(objectclass=domainrelatedobject)(associateddomain=*))/g' \
    -e 's/^user_filter.*$/user_filter = (|(\&(uid=cyrus-admin)(!(objectclass=kolabinetorgperson)))(objectclass=kolabinetorgperson))/g' \
    /etc/kolab/kolab.conf

if [ -z "$(grep ^auth_mechanism /etc/kolab/kolab.conf)" ]; then
    echo "WARNING: No more auth_mechanism setting?"
    sed -i -e '/\[kolab\]/ a\
auth_mechanism = ldap' \
    /etc/kolab/kolab.conf
fi

sed -r -i \
    -e 's/^ldap_filter:.*$/ldap_filter: (|(\&(uid=cyrus-admin)(uid=%u)(objectclass=inetorgperson)(!(objectclass=kolabinetorgperson)))(\&(uid=%u)(objectclass=kolabinetorgperson)))/g' \
    -e 's/^ldap_base:.*$/ldap_base: dc=example,dc=org/g' \
    -e 's/^ldap_user_attribute:.*$/ldap_user_attribute: uid/g' \
    -e 's/^ldap_group_base:.*%$/ldap_group_base: dc=example,dc=org/g' \
    -e 's/^ldap_group_filter:.*$/ldap_group_filter: (\&(objectclass=kolabgroupofuniquenames)(mail=%u))/g' \
    -e 's/^ldap_member_base:.*$/ldap_member_base: dc=mykolab,dc=com/g' \
    -e 's/^ldap_member_method:.*$/ldap_member_method: filter/g' \
    -e 's/^ldap_member_filter:.*$/ldap_member_filter: (uniquemember=%D)/g' \
    -e 's/^ldap_member_attribute:.*$/ldap_member_attribute: mail/g' \
    -e '/^ldap_domain_base_dn/d' \
    -e '/^debug:/d' \
    -e '/^auditlog:/d' \
    -e '/^chatty:/d' \
    -e '/^ldap_member_attribute:.*$/ a\
ldap_domain_base_dn: ou=Domains,dc=example,dc=org' \
    /etc/imapd.conf

echo "debug: 1" >> /etc/imapd.conf
echo "auditlog: 1" >> /etc/imapd.conf
echo "chatty: 1" >> /etc/imapd.conf

service cyrus-imapd restart

service kolabd restart
service kolab-saslauthd restart

if [ ! -d "/usr/share/kolab-hkccp/" ]; then
    git clone ssh://git@git.kolab.org/diffusion/H/hkccp.git /usr/share/kolab-hkccp/
    mkdir -p /usr/share/kolab-hkccp/temp/session
    chown apache:apache /usr/share/kolab-hkccp/temp/session
fi

rm -rf /usr/share/kolab-hkccp/config/config.ini
cp /usr/share/kolab-hkccp/config/config.ini.kolab /usr/share/kolab-hkccp/config/config.ini

pushd /usr/share/kolab-hkccp/
uri=$(grep ^cache_uri /etc/kolab/kolab.conf | awk '{print $3}')
service_auth_pw=$(grep ^service_bind_pw /etc/kolab/kolab.conf | awk '{print $3}')

sed -r -i \
    -e "s|^dsn =.*$|dsn = $uri|g" \
    -e "s|^dsnr =.*$|dsnr = $uri|g" \
    -e "s|^service_auth_pw =.*$|service_auth_pw = $service_auth_pw|g" \
    -e '/^root_dn = / a\
mgmt_root_dn = "dc=example,dc=org"\
hosted_root_dn = "dc=mykolab,dc=com"' \
    config/config.ini

password=$(grep ^cache_uri /etc/kolab/kolab.conf | awk '{print $3}' | cut -d':' -f3 | cut -d'@' -f1)
mysql -u kolab --password="${password}" kolab < SQL/mysql.sql
popd

pushd /usr/share/kolab-webadmin/
php sample-insert-hosted-user_types.php
popd

pushd /usr/share/kolab-hkccp

mkdir -p temp/session/
chown apache temp/session/

#php bin/backend.php adduser doe@example.org --tenant 1 --verbose
#php bin/backend.php adduser kanarip@kanarip.com --tenant 1 --verbose
#php bin/backend.php adduser doe@kolabnow.com --tenant 1 --verbose
#php bin/backend.php adduser sixpack@kolabnow.com --tenant 1 --verbose
#php bin/backend.php adduser doe@mykolab.com --tenant 1 --verbose
popd