6 commits - ucs/conffiles ucs/kolab-ucs-join-script.sh ucs/kolab-ucs-unjoin-script.sh

Christoph Wickert wickert at kolabsys.com
Wed Sep 9 12:07:36 CEST 2015


 ucs/conffiles/etc/imapd.conf                        |    2 
 ucs/conffiles/etc/init.d/postfix                    |  312 ++++++++++++++++----
 ucs/conffiles/etc/roundcubemail/config.inc.php      |    7 
 ucs/conffiles/etc/roundcubemail/kolab_files.inc.php |    7 
 ucs/kolab-ucs-join-script.sh                        |   28 +
 ucs/kolab-ucs-unjoin-script.sh                      |    6 
 6 files changed, 287 insertions(+), 75 deletions(-)

New commits:
commit 31ae2dd6a8e524aeea83c034092b3760cdaf840c
Author: Christoph Wickert <wickert at kolabsys.com>
Date:   Wed Sep 9 12:07:28 2015 +0200

    Fix email address mapping (#2841)

diff --git a/ucs/conffiles/etc/roundcubemail/config.inc.php b/ucs/conffiles/etc/roundcubemail/config.inc.php
index 6e62da6..cf8091f 100644
--- a/ucs/conffiles/etc/roundcubemail/config.inc.php
+++ b/ucs/conffiles/etc/roundcubemail/config.inc.php
@@ -215,13 +215,14 @@ else:
                     'sizelimit'                 => '0',
                     'timelimit'                 => '0',
                     'fieldmap'                  => Array(
-                            // Roundcube        => LDAP
+                            // Roundcube        => LDAP:limit
                             'name'              => 'displayName',
                             'surname'           => 'sn',
                             'firstname'         => 'givenName',
                             'prefix'            => 'title',
-                            'email:primary'        => 'mailPrimaryAddress',
-                            'email:other'       => 'mail',
+                            'email:primary'     => 'mailPrimaryAddress:1',
+                            'email:other'       => 'mailAlternativeAddress:*',
+                            'email:work'        => 'mail:*',
                             'nickname'          => 'displayName',
                             'jobtitle'          => 'title',
                             'organization'      => 'o',


commit 405001ada6e00137cab2bec889ccbcc20c2373d0
Author: Christoph Wickert <wickert at kolabsys.com>
Date:   Wed Aug 12 17:51:50 2015 +0200

    Resync postfix init script from upstream (univention-mail-postfix rev. 21923)

diff --git a/ucs/conffiles/etc/init.d/postfix b/ucs/conffiles/etc/init.d/postfix
index 066044f..957f06f 100755
--- a/ucs/conffiles/etc/init.d/postfix
+++ b/ucs/conffiles/etc/init.d/postfix
@@ -1,20 +1,58 @@
-#!/bin/bash
+#!/bin/sh -e
 @%@UCRWARNING=# @%@
-
+#
+#
 # Start or stop Postfix
 #
 # LaMont Jones <lamont at debian.org>
 # based on sendmail's init.d script
 
+### BEGIN INIT INFO
+# Provides:          postfix mail-transport-agent
+# Required-Start:    $local_fs $remote_fs $syslog $named $network $time
+# Required-Stop:     $local_fs $remote_fs $syslog $named $network
+# Should-Start:      postgresql mysql clamav-daemon postgrey spamassassin saslauthd dovecot
+# Should-Stop:       postgresql mysql clamav-daemon postgrey spamassassin saslauthd dovecot
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: start and stop the Postfix Mail Transport Agent
+# Description:       postfix is a Mail Transport agent
+### END INIT INFO
+
+#
+# Copyright 2001-2015 Univention GmbH
+#
+# http://www.univention.de/
+#
+# All rights reserved.
+#
+# The source code of this program is made available
+# under the terms of the GNU Affero General Public License version 3
+# (GNU AGPL V3) as published by the Free Software Foundation.
+#
+# Binary versions of this program provided by Univention to you as
+# well as other copyrighted, protected or trademarked materials like
+# Logos, graphics, fonts, specific documentations and configurations,
+# cryptographic keys etc. are subject to a license agreement between
+# you and Univention and not subject to the GNU AGPL V3.
+#
+# In the case you use this program under the terms of the GNU AGPL V3,
+# the program is provided in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public
+# License with the Debian GNU/Linux or Univention distribution in file
+# /usr/share/common-licenses/AGPL-3; if not, see
+# <http://www.gnu.org/licenses/>.
+
 PATH=/bin:/usr/bin:/sbin:/usr/sbin
 DAEMON=/usr/sbin/postfix
-PIDFILE=/var/run/postfix.pid
 NAME=Postfix
 TZ=
 unset TZ
 
-. /lib/lsb/init-functions
-
 # Defaults - don't touch, edit /etc/default/postfix
 SYNC_CHROOT="y"
 
@@ -22,82 +60,240 @@ test -f /etc/default/postfix && . /etc/default/postfix
 
 test -x $DAEMON && test -f /etc/postfix/main.cf || exit 0
 
-case "$1" in
-    start)
-	log_action_msg "Starting mail transport agent: Postfix"
-
-        # check ucr autostart setting
-        if [ -f "/usr/share/univention-config-registry/init-autostart.lib" ]; then
-                source "/usr/share/univention-config-registry/init-autostart.lib"
-                check_autostart postfix postfix/autostart
-        fi
-
-	# see if anything is running chrooted.
-	NEED_CHROOT=$(awk '/^[0-9a-z]/ && ($5 == "-") { print "y"; exit}' /etc/postfix/master.cf)
-
-	if [ -n "$NEED_CHROOT" ] && [ -n "$SYNC_CHROOT" ]; then
-	    # Make sure that the chroot environment is set up correctly.
-	    oldumask=$(umask)
-	    umask 022
-	    cd $(postconf -h queue_directory)
-
-	    # if we're using unix:passwd.byname, then we need to add etc/passwd.
-	    local_maps=$(postconf -h local_recipient_maps)
-	    if [ "X$local_maps" != "X${local_maps#*unix:passwd.byname}" ]; then
-		if [ "X$local_maps" = "X${local_maps#*proxy:unix:passwd.byname}" ]; then
-		    sed 's/^\([^:]*\):[^:]*/\1:x/' /etc/passwd > etc/passwd
-		    chmod a+r etc/passwd
+. /lib/lsb/init-functions
+#DISTRO=$(lsb_release -is 2>/dev/null || echo Debian)
+
+enabled_instances() {
+	postmulti -l -a | awk '($3=="y") { print $1}'
+}
+
+running() {
+    INSTANCE="$1"
+    if [ "X$INSTANCE" = X ]; then
+	    POSTCONF="postconf"
+    else
+	    POSTCONF="postmulti -i $INSTANCE -x postconf"
+    fi
+
+    queue=$($POSTCONF -h queue_directory 2>/dev/null || echo /var/spool/postfix)
+    if [ -f ${queue}/pid/master.pid ]; then
+	pid=$(sed 's/ //g' ${queue}/pid/master.pid)
+	# what directory does the executable live in.  stupid prelink systems.
+	dir=$(ls -l /proc/$pid/exe 2>/dev/null | sed 's/.* -> //; s/\/[^\/]*$//')
+	if [ "X$dir" = "X/usr/lib/postfix" ]; then
+	    echo y
+	fi
+    fi
+}
+
+configure_instance() {
+    INSTANCE="$1"
+    if [ "X$INSTANCE" = X ]; then
+	    POSTCONF="postconf"
+    else
+	    POSTCONF="postmulti -i $INSTANCE -x postconf"
+    fi
+
+
+    # if you set myorigin to 'ubuntu.com' or 'debian.org', it's wrong, and annoys the admins of
+    # those domains.  See also sender_canonical_maps.
+
+    MYORIGIN=$($POSTCONF -h myorigin | tr 'A-Z' 'a-z')
+    if [ "X${MYORIGIN#/}" != "X${MYORIGIN}" ]; then
+	MYORIGIN=$(tr 'A-Z' 'a-z' < $MYORIGIN)
+    fi
+    if [ "X$MYORIGIN" = Xubuntu.com ] || [ "X$MYORIGIN" = Xdebian.org ]; then
+	log_failure_msg "Invalid \$myorigin ($MYORIGIN), refusing to start"
+	log_end_msg 1
+	exit 1
+    fi
+
+    config_dir=$($POSTCONF -h config_directory)
+    # see if anything is running chrooted.
+    NEED_CHROOT=$(awk '/^[0-9a-z]/ && ($5 ~ "[-yY]") { print "y"; exit}' ${config_dir}/master.cf)
+
+    if [ -n "$NEED_CHROOT" ] && [ -n "$SYNC_CHROOT" ]; then
+	# Make sure that the chroot environment is set up correctly.
+	oldumask=$(umask)
+	umask 022
+	queue_dir=$($POSTCONF -h queue_directory)
+	cd "$queue_dir"
+
+	# copy the CA path if specified
+	ca_path=$($POSTCONF -h smtp_tls_CApath)
+	case "$ca_path" in
+	    '') :;; # no ca_path
+	    $queue_dir/*) :;;  # skip stuff already in chroot
+	    *)
+		if test -d "$ca_path"; then
+		    dest_dir="$queue_dir/${ca_path#/}"
+		    new=0
+		    if test -d "$dest_dir"; then
+			# write to a new directory ...
+			dest_dir="${dest_dir%/}.NEW"
+			new=1
+		    else
+			mkdir --parent ${dest_dir%/*}
+		    fi
+		    # handle files in subdirectories
+		    (cd "$ca_path" && find . -name '*.pem' -print0 | cpio -0pdL --quiet "$dest_dir") 2>/dev/null || 
+		        (log_failure_msg failure copying certificates; exit 1)
+		    c_rehash "$dest_dir" >/dev/null 2>&1
+		    if [ "$new" = 1 ]; then
+			# and replace the old directory
+			rm -r "${dest_dir%.NEW}"
+			mv "$dest_dir" "${dest_dir%.NEW}"
+		    fi
+		fi
+		;;
+	esac
+
+	# if there is a CA file, copy it
+	ca_file=$($POSTCONF -h smtp_tls_CAfile)
+	case "$ca_file" in
+	    $queue_dir/*) :;;  # skip stuff already in chroot
+	    '') # no ca_file
+		# or copy the bundle to preserve functionality
+		ca_bundle=/etc/ssl/certs/ca-certificates.crt
+		if [ -f $ca_bundle ]; then
+		    mkdir --parent "$queue_dir/${ca_bundle%/*}"
+		    cp -L "$ca_bundle" "$queue_dir/${ca_bundle%/*}"
+		fi
+		;;
+	    *)
+		if test -f "$ca_file"; then
+		    dest_dir="$queue_dir/${ca_path#/}"
+		    mkdir --parent "$dest_dir"
+		    cp -L "$ca_file" "$dest_dir"
 		fi
+		;;
+	esac
+
+	# if we're using unix:passwd.byname, then we need to add etc/passwd.
+	local_maps=$($POSTCONF -h local_recipient_maps)
+	if [ "X$local_maps" != "X${local_maps#*unix:passwd.byname}" ]; then
+	    if [ "X$local_maps" = "X${local_maps#*proxy:unix:passwd.byname}" ]; then
+		sed 's/^\([^:]*\):[^:]*/\1:x/' /etc/passwd > etc/passwd
+		chmod a+r etc/passwd
 	    fi
+	fi
+
+	FILES="etc/localtime etc/services etc/resolv.conf etc/hosts \
+	    etc/nsswitch.conf etc/nss_mdns.config"
+	for file in $FILES; do
+	    [ -d ${file%/*} ] || mkdir -p ${file%/*}
+	    if [ -f /${file} ]; then rm -f ${file} && cp /${file} ${file}; fi
+	    if [ -f  ${file} ]; then chmod a+rX ${file}; fi
+	done
+	# ldaps needs this. debian bug 572841
+	(echo /dev/random; echo /dev/urandom) | cpio -pdL --quiet . 2>/dev/null || true
+	rm -f usr/lib/zoneinfo/localtime
+	mkdir -p usr/lib/zoneinfo
+	ln -sf /etc/localtime usr/lib/zoneinfo/localtime
+
+	LIBLIST=$(for name in gcc_s nss resolv; do
+	    for f in /lib/*/lib${name}*.so* /lib/lib${name}*.so*; do
+	       if [ -f "$f" ]; then  echo ${f#/}; fi;
+	    done;
+	done)
 
-	    FILES="etc/localtime etc/services etc/resolv.conf etc/hosts \
-		etc/nsswitch.conf"
-	    for file in $FILES; do 
-		[ -d ${file%/*} ] || mkdir -p ${file%/*}
-		if [ -f /${file} ]; then rm -f ${file} && cp /${file} ${file}; fi
-		if [ -f  ${file} ]; then chmod a+rX ${file}; fi
+	if [ -n "$LIBLIST" ]; then
+	    for f in "$LIBLIST"; do
+		rm -f "$f"
 	    done
-	    rm -f usr/lib/zoneinfo/localtime
-	    ln -sf /etc/localtime usr/lib/zoneinfo/localtime
-	    rm -f lib/libnss_*so*
-	    tar cf - /lib/libnss_*so* 2>/dev/null |tar xf -
-	    umask $oldumask
+	    tar cf - -C / $LIBLIST 2>/dev/null |tar xf -
 	fi
+	umask $oldumask
+    fi
+}
 
-	${DAEMON} start 2>&1 |
-		(grep -v 'starting the Postfix' 1>&2 || /bin/true)
-	log_action_end_msg 0
+case "$1" in
+    start)
+	log_daemon_msg "Starting Postfix Mail Transport Agent" postfix
+	# check ucr autostart setting
+	if [ -f "/usr/share/univention-config-registry/init-autostart.lib" ]; then
+	    . "/usr/share/univention-config-registry/init-autostart.lib"
+	    check_autostart postfix postfix/autostart
+	fi
+	RET=0
+	# for all instances that are not already running, handle chroot setup if needed, and start
+	for INSTANCE in $(enabled_instances); do
+	    RUNNING=$(running $INSTANCE)
+	    if [ "X$RUNNING" = X ]; then
+		configure_instance $INSTANCE
+		CMD="/usr/sbin/postmulti -- -i $INSTANCE -x ${DAEMON}"
+		if ! start-stop-daemon --start --exec $CMD quiet-quick-start; then
+		    RET=1
+		fi
+	    fi
+	done
+	log_end_msg $RET
     ;;
 
     stop)
-	log_action_msg "Stopping mail transport agent: Postfix"
-	${DAEMON} stop 2>&1 |
-		(grep -v 'stopping the Postfix' 1>&2 || /bin/true)
-	log_action_end_msg 0
+	log_daemon_msg "Stopping Postfix Mail Transport Agent" postfix
+	RET=0
+	# for all instances that are not already running, handle chroot setup if needed, and start
+	for INSTANCE in $(enabled_instances); do
+	    RUNNING=$(running $INSTANCE)
+	    if [ "X$RUNNING" != X ]; then
+		CMD="/usr/sbin/postmulti -i $INSTANCE -x ${DAEMON}"
+		if ! ${CMD} quiet-stop; then
+		    RET=1
+		fi
+	    fi
+	done
+	log_end_msg $RET
     ;;
 
     restart)
         $0 stop
         $0 start
     ;;
-    
+
     force-reload|reload)
-	log_action_msg "Reloading Postfix configuration"
-	${DAEMON} reload 2>&1 |
-		(grep -v 'refreshing the Postfix' 1>&2 || /bin/true)
-	log_action_end_msg 0
+	log_action_begin_msg "Reloading Postfix configuration"
+	if ${DAEMON} quiet-reload; then
+	    log_action_end_msg 0
+	else
+	    log_action_end_msg 1
+	fi
     ;;
 
-    flush)
-	${DAEMON} flush
+    status)
+	ALL=1
+	ANY=0
+	# for all instances that are not already running, handle chroot setup if needed, and start
+	for INSTANCE in $(enabled_instances); do
+	    RUNNING=$(running $INSTANCE)
+	    if [ "X$RUNNING" != X ]; then
+	    	ANY=1
+	    else
+	    	ALL=0
+	    fi
+	done
+	# handle the case when postmulti returns *no* configured instances
+	if [ $ANY = 0 ]; then
+	   ALL=0
+	fi
+	if [ $ALL = 1 ]; then
+	   log_success_msg "postfix is running"
+	   exit 0
+	elif [ $ANY = 1 ]; then
+	   log_success_msg "some postfix instances are running"
+	   exit 0
+	else
+	   log_success_msg "postfix is not running"
+	   exit 3
+	fi
     ;;
 
-    check)
-	${DAEMON} check
+    flush|check|abort)
+	${DAEMON} $1
     ;;
 
     *)
-	echo "Usage: /etc/init.d/postfix {start|stop|restart|reload|flush|check|force-reload}"
+	log_action_msg "Usage: /etc/init.d/postfix {start|stop|restart|reload|flush|check|abort|force-reload|status}"
 	exit 1
     ;;
 esac


commit de974f7f6cc64b23d42474d75df7149d638310dc
Author: Christoph Wickert <wickert at kolabsys.com>
Date:   Fri Jun 5 12:46:33 2015 +0200

    Make kolab_files_url setting work with both HTTP and HTTPS (#2436, OTRS #1010702)

diff --git a/ucs/conffiles/etc/roundcubemail/kolab_files.inc.php b/ucs/conffiles/etc/roundcubemail/kolab_files.inc.php
index b25268b..e70cdfb 100644
--- a/ucs/conffiles/etc/roundcubemail/kolab_files.inc.php
+++ b/ucs/conffiles/etc/roundcubemail/kolab_files.inc.php
@@ -3,12 +3,7 @@
 @%@UCRWARNING=// @%@
 
 // URL of kolab-chwala installation
-@!@
-if configRegistry.get('mail/kolab/https', 0) > 0:
-    print "$config['kolab_files_url'] = 'http://'.$_SERVER['HTTP_HOST'].'/chwala';"
-else:
-    print "$config['kolab_files_url'] = 'https://'.$_SERVER['HTTP_HOST'].'/chwala';"
-@!@
+$config['kolab_files_url'] = '/chwala/';
 
 // List of files list columns. Available are: name, size, mtime, type
 $config['kolab_files_list_cols'] = array('name', 'mtime', 'size');


commit 5207777fc2b61e40f2393fa8f06ec6fc0c1e1606
Author: Christoph Wickert <wickert at kolabsys.com>
Date:   Thu Jun 4 17:26:05 2015 +0200

    Enable 'date' extension for sieve in imapd.conf (#3529)

diff --git a/ucs/conffiles/etc/imapd.conf b/ucs/conffiles/etc/imapd.conf
index 454040d..b6e2c08 100644
--- a/ucs/conffiles/etc/imapd.conf
+++ b/ucs/conffiles/etc/imapd.conf
@@ -56,7 +56,7 @@ ldap_time_limit: 10
 unixhierarchysep: 1
 virtdomains: userid
 annotation_definitions: /etc/imapd.annotations.conf
-sieve_extensions: fileinto reject envelope body vacation imapflags notify include regex subaddress relational copy
+sieve_extensions: fileinto reject envelope body vacation imapflags notify include regex subaddress relational copy date index
 allowallsubscribe: 0
 allowusermoves: 1
 altnamespace: 1


commit e47070c90c06a93e7600ecb1135a37ac0d50ceca
Author: Christoph Wickert <wickert at kolabsys.com>
Date:   Fri Apr 24 14:45:07 2015 +0200

    Use our own container for the extented attributes (#1298)

diff --git a/ucs/kolab-ucs-join-script.sh b/ucs/kolab-ucs-join-script.sh
index 2a18453..6988252 100755
--- a/ucs/kolab-ucs-join-script.sh
+++ b/ucs/kolab-ucs-join-script.sh
@@ -1,9 +1,10 @@
 #!/bin/bash
 
-VERSION=3
+VERSION=4
 
-. /usr/share/univention-join/joinscripthelper.lib
+# We should probably just use base.sh and ldap.sh, for now we just use all.sh
 . /usr/share/univention-lib/all.sh
+. /usr/share/univention-join/joinscripthelper.lib
 joinscript_init
 
 function addUserAttribute {
@@ -11,7 +12,7 @@ function addUserAttribute {
 	shift
 	udm settings/extended_attribute create \
 		--ignore_exists \
-		--position "cn=custom attributes,cn=univention,$ldap_base" \
+		--position "cn=kolab,cn=custom attributes,cn=univention,$ldap_base" \
 		--set tabName="Mail" \
 		--append translationTabName='"de_CH" "Mail"' \
 		--append translationTabName='"de_DE" "Mail"' \
@@ -27,6 +28,27 @@ eval "$(univention-config-registry shell)"
 echo -n "Removing legacy Kolab 2 service reference from LDAP ... "
 ucs_removeServiceFromLocalhost "kolab2" "$@"
 
+# Delete old custom attributes (we use our own container now, see below)
+for ATTRIBUTE in \
+	KolabEnabled \
+	KolabForwardAddress \
+	KolabForwardActive \
+	KolabForwardKeepCopy \
+	KolabForwardUCE \
+	KolabVacationText \
+	KolabVacationActive \
+	KolabVacationAddress \
+	KolabVacationNoReactDomain \
+	KolabDeliveryToFolderName \
+	KolabDeliveryToFolderActive ; \
+do udm settings/extended_attribute remove \
+	--dn "cn=$ATTRIBUTE,cn=custom attributes,cn=univention,$ldap_base" ; done
+
+# Create a container for all Kolab-related custom attributes
+univention-directory-manager container/cn create "$@" --ignore_exists \
+	--position "cn=custom attributes,cn=univention,$ldap_base" \
+	--set name=kolab
+
 # Register Kolab service
 echo -n "Creating Kolab service in LDAP ... "
 ucs_addServiceToLocalhost "kolab" "$@"
diff --git a/ucs/kolab-ucs-unjoin-script.sh b/ucs/kolab-ucs-unjoin-script.sh
index ca32922..402fb7c 100755
--- a/ucs/kolab-ucs-unjoin-script.sh
+++ b/ucs/kolab-ucs-unjoin-script.sh
@@ -54,7 +54,7 @@ for ATTRIBUTE in \
 	KolabDeliveryToFolderName \
 	KolabDeliveryToFolderActive ; \
 do udm settings/extended_attribute remove \
-	--dn "cn=$ATTRIBUTE,cn=custom attributes,cn=univention,$ldap_base" ; done
+	--dn "cn=$ATTRIBUTE,cn=kolab,cn=custom attributes,cn=univention,$ldap_base" ; done
 
 # Remove user template
 udm settings/usertemplate remove \


commit 60010347faf7a7d2165f3a47f302066c9dbc7f43
Author: Christoph Wickert <wickert at kolabsys.com>
Date:   Fri Apr 24 14:26:59 2015 +0200

    Simplify removal of custom attributes in kolab-ucs-unjoin-script.sh

diff --git a/ucs/kolab-ucs-unjoin-script.sh b/ucs/kolab-ucs-unjoin-script.sh
index b4b0778..ca32922 100755
--- a/ucs/kolab-ucs-unjoin-script.sh
+++ b/ucs/kolab-ucs-unjoin-script.sh
@@ -42,6 +42,7 @@ eval "$(ucr shell)"
 
 # remove extented attributes
 for ATTRIBUTE in \
+	KolabEnabled \
 	KolabForwardAddress \
 	KolabForwardActive \
 	KolabForwardKeepCopy \
@@ -55,9 +56,6 @@ for ATTRIBUTE in \
 do udm settings/extended_attribute remove \
 	--dn "cn=$ATTRIBUTE,cn=custom attributes,cn=univention,$ldap_base" ; done
 
-udm settings/extended_attribute remove \
-	--dn "cn=KolabEnabled,cn=custom attributes,cn=univention,$ldap_base"
-
 # Remove user template
 udm settings/usertemplate remove \
 	--dn "cn=$domainname Groupware Account,cn=templates,cn=univention,${ldap_base}"




More information about the commits mailing list