summaryrefslogtreecommitdiff
path: root/hosted-kolab/19-test-aci.sh
diff options
context:
space:
mode:
Diffstat (limited to 'hosted-kolab/19-test-aci.sh')
-rwxr-xr-xhosted-kolab/19-test-aci.sh154
1 files changed, 146 insertions, 8 deletions
diff --git a/hosted-kolab/19-test-aci.sh b/hosted-kolab/19-test-aci.sh
index 47354dc..b6d3fb3 100755
--- a/hosted-kolab/19-test-aci.sh
+++ b/hosted-kolab/19-test-aci.sh
@@ -2,11 +2,149 @@
. ./settings.sh
-echo "== doe@kolabsys.net =="
-ldapsearch -x -h ${ldap_host} -D "uid=doe@kolabsys.net,ou=People,dc=kolabsys,dc=net" -w "123456" -b ${rootdn} -LLL
-echo "== doe@kolabnow.com =="
-ldapsearch -x -h ${ldap_host} -D "uid=doe@kolabnow.com,ou=People,dc=kolabnow,dc=com" -w "456789" -b ${hosted_domain_rootdn} -LLL
-echo "== sixpack@kolabnow.com =="
-ldapsearch -x -h ${ldap_host} -D "uid=sixpack@kolabnow.com,ou=People,dc=kolabnow,dc=com" -w "741852" -b ${hosted_domain_rootdn} -LLL
-echo "== kanarip@kanarip.com =="
-ldapsearch -x -h ${ldap_host} -D "uid=kanarip@kanarip.com,ou=People,ou=kanarip.com,dc=kolabnow,dc=com" -w "456789" -b ${hosted_domain_rootdn} -LLL
+max_domains=$(
+ ldapsearch -x -h localhost \
+ -D "${ldap_binddn}" \
+ -w "${ldap_bindpw}" \
+ -b "${domain_base_dn}" \
+ -s sub \
+ -LLL "(objectclass=domainrelatedobject)" dn | \
+ grep ^dn | \
+ wc -l
+ )
+
+num_domains=$(
+ ldapsearch -x -h localhost \
+ -D "uid=doe@${domain},ou=People,${rootdn}" \
+ -w "${default_user_password}" \
+ -b "${domain_base_dn}" \
+ -s sub \
+ -LLL "(&(objectclass=domainrelatedobject)(associateddomain=${domain}))" dn | \
+ grep ^dn | \
+ wc -l
+ )
+
+if [ ${num_domains} -ne 1 ]; then
+ echo "ERROR: Expected 1 domain, got ${num_domains} domains"
+fi
+
+num_domains=$(
+ ldapsearch -x -h localhost \
+ -D "uid=doe@${domain},ou=People,${rootdn}" \
+ -w "${default_user_password}" \
+ -b "${domain_base_dn}" \
+ -s sub \
+ -LLL '(objectclass=domainrelatedobject)' dn | \
+ grep ^dn | \
+ wc -l
+ )
+
+if [ ${num_domains} -lt 3 ]; then
+ echo "ERROR: Expected more than 3 domains, got ${num_domains} domain(s)"
+fi
+
+num_domains=$(
+ ldapsearch -x -h localhost \
+ -D "uid=kolab-service,ou=Special Users,${rootdn}" \
+ -w "$(grep ^service_bind_pw /etc/kolab/kolab.conf | awk '{print $3}')" \
+ -b "${domain_base_dn}" \
+ -s sub \
+ -LLL "(objectclass=domainrelatedobject)" dn | \
+ grep ^dn | \
+ wc -l
+ )
+
+if [ ${num_domains} -ne ${max_domains} ]; then
+ echo "ERROR: Expected ${max_domains} domains, got ${num_domains} domain(s)"
+fi
+
+num_users=$(
+ ldapsearch -x -h localhost \
+ -D "uid=kolab-service,ou=Special Users,${rootdn}" \
+ -w "$(grep ^service_bind_pw /etc/kolab/kolab.conf | awk '{print $3}')" \
+ -b "${hosted_domain_rootdn}" \
+ -s sub \
+ -LLL "(objectclass=kolabinetorgperson)" dn | \
+ grep ^dn | \
+ wc -l
+ )
+
+if [ ${num_users} -lt 6 ]; then
+ echo "ERROR: Expected 6 or more users, got ${num_users} user(s)"
+fi
+
+num_domains=$(
+ ldapsearch -x -h localhost \
+ -D "uid=kanarip@kanarip.com,ou=People,ou=kanarip.com,dc=mykolab,dc=com" \
+ -w "${default_user_password}" \
+ -b "${domain_base_dn}" \
+ -s sub \
+ -LLL "(&(objectclass=domainrelatedobject)(associateddomain=kanarip.com))" dn | \
+ grep ^dn | \
+ wc -l
+ )
+
+if [ ${num_domains} -ne 1 ]; then
+ echo "ERROR: Expected 1 domain, got ${num_domains} domains"
+fi
+
+num_domains=$(
+ ldapsearch -x -h localhost \
+ -D "uid=kanarip@kanarip.com,ou=People,ou=kanarip.com,dc=mykolab,dc=com" \
+ -w "${default_user_password}" \
+ -b "${domain_base_dn}" \
+ -s sub \
+ -LLL "(objectclass=domainrelatedobject)" dn | \
+ grep ^dn | \
+ wc -l
+ )
+
+if [ ${num_domains} -ne 3 ]; then
+ echo "ERROR: Expected 3 domains, got ${num_domains} domain(s)"
+fi
+
+num_entries=$(
+ ldapsearch -x -h localhost \
+ -D "uid=doe@mykolab.com,ou=People,dc=mykolab,dc=com" \
+ -w "${default_user_password}" \
+ -b "${hosted_domain_rootdn}" \
+ -s sub \
+ -LLL "(objectclass=*)" dn | \
+ grep ^dn | \
+ wc -l
+ )
+
+if [ ${num_entries} -ne 1 ]; then
+ echo "ERROR: Expected one entry on foreign domain search but got ${num_entries}"
+fi
+
+num_entries=$(
+ ldapsearch -x -h localhost \
+ -D "uid=kanarip@kanarip.com,ou=People,ou=kanarip.com,dc=mykolab,dc=com" \
+ -w "${default_user_password}" \
+ -b "${hosted_domain_rootdn}" \
+ -s sub \
+ -LLL "(objectclass=*)" dn | \
+ grep ^dn | \
+ wc -l
+ )
+
+if [ ${num_entries} -ne 8 ]; then
+ echo "ERROR: Expected some 8 entries on foreign domain hierarchy search but got ${num_entries}"
+fi
+
+num_domains=$(
+ ldapsearch -x -h localhost \
+ -D "uid=hosted-kolab-service,ou=Special Users,dc=example,dc=org" \
+ -w "${default_user_password}" \
+ -b "${domain_base_dn}" \
+ -s sub \
+ -LLL "(objectclass=domainrelatedobject)" dn | \
+ grep ^dn | \
+ wc -l
+ )
+
+if [ ${num_domains} -ne 4 ]; then
+ echo "ERROR: Expected 3 domains, got ${num_domains} domain(s)"
+fi
+