summaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorSteffen Hansen <steffen@kdab.com>2004-11-23 20:26:48 (GMT)
committerSteffen Hansen <steffen@kdab.com>2004-11-23 20:26:48 (GMT)
commit577a649826a90f517887c5f50cb934bb16b2c779 (patch)
tree3998614cc63e9f6cc05bbb7f681b085f7a68a42c /libexec
parent9ea2c6572c5089687e8b84c93bd5e94cc30054e0 (diff)
downloadkolab-server-577a649826a90f517887c5f50cb934bb16b2c779.tar.gz
New package name kolabd2.0-kolabd
Diffstat (limited to 'libexec')
-rwxr-xr-xlibexec/adduser112
-rwxr-xr-xlibexec/deluser55
-rwxr-xr-xlibexec/listusers31
-rwxr-xr-xlibexec/newconfig25
-rwxr-xr-xlibexec/services30
-rwxr-xr-xlibexec/showlog74
-rwxr-xr-xlibexec/showuser36
-rwxr-xr-xlibexec/start26
-rwxr-xr-xlibexec/stop26
9 files changed, 415 insertions, 0 deletions
diff --git a/libexec/adduser b/libexec/adduser
new file mode 100755
index 0000000..f297371
--- /dev/null
+++ b/libexec/adduser
@@ -0,0 +1,112 @@
+## Copyright (c) 2004 Code Fusion cc
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License as
+## published by the Free Software Foundation; either version 2, or
+## (at your option) any later version.
+##
+## This program is distributed 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
+## General Public License for more details.
+##
+## You can view the GNU General Public License, online, at the GNU
+## Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
+##
+
+if [ ".$1" = ".--showhelp" ]; then
+ echo "Add a user mailbox"
+ exit 0
+ HASHELP
+fi
+
+#Collect some vitals
+SERVER=127.0.0.1
+PREFIX=@l_prefix@
+BINDDN=`cat $PREFIX/etc/kolab/kolab.conf | grep "bind_dn :" | sed -e "s;bind_dn : ;;"`
+BINDPW=`cat $PREFIX/etc/kolab/kolab.conf | grep "bind_pw :" | sed -e "s;bind_pw : ;;"`
+BASEDN=`cat $PREFIX/etc/kolab/kolab.conf | grep "base_dn :" | sed -e "s;base_dn : ;;"`
+HOMESERV=`cat $PREFIX/etc/kolab/kolab.conf | grep "fqdnhostname :" | sed -e "s;fqdnhostname : ;;"`
+
+echo "Please specify the firstname:"
+read FIRSTNAME
+echo "Please specify the lastname:"
+read LASTNAME
+echo "Please specify the email address:"
+read EMAIL
+echo "Please specify the password:"
+read PASSWORD
+echo "Please specify the quota (kb):"
+read QUOTA
+
+CN="$FIRSTNAME $LASTNAME"
+SN="$LASTNAME"
+
+#Sanity checks
+if test "$FIRSTNAME" = ""; then
+echo "You must specify a firstname"
+exit 255
+fi
+if test "$LASTNAME" = ""; then
+echo "You must specify a lastname"
+exit 255
+fi
+if test "$EMAIL" = ""; then
+echo "You must specify a valid mail address"
+exit 255
+fi
+if test "$PASSWORD" = ""; then
+echo "You must specify a password"
+exit 255
+fi
+
+#Echo to user - last chance
+echo "--"
+echo "About to add the following user:"
+echo "Name: $CN"
+echo "Mail: $EMAIL"
+echo "Password: $PASSWORD"
+if test "$QUOTA" != ""; then
+echo "Quota: ${QUOTA}kb"
+fi
+echo "--"
+
+#Check if the user already exists
+DN=`$PREFIX/bin/kolab showuser $EMAIL | grep dn`
+if test "$DN" != ""; then
+echo User already found! Or other error occurred.
+exit 255
+fi
+
+echo "Are you sure you want to procede? (y/n)"
+read ANS
+if test "$ANS" != "y"; then
+echo Aborted
+exit 255
+fi
+
+
+
+#Create the ldif
+LDIFFILE="/tmp/cfadduser.ldif"
+trap "rm $LDIFFILE" 0 1 2 3 15
+
+cat <<LDIF > $LDIFFILE
+dn: cn=$CN,$BASEDN
+objectClass: top
+objectClass: inetOrgPerson
+objectClass: kolabInetOrgPerson
+mail: $EMAIL
+uid: $EMAIL
+sn: $LASTNAME
+givenName: $FIRSTNAME
+cn: $CN
+userPassword: $PASSWORD
+kolabHomeServer: $HOMESERV
+LDIF
+
+if test "$QUOTA" != ""; then
+echo "userquota: $QUOTA" >> $LDIFFILE
+fi
+
+$PREFIX/bin/ldapadd -x -D "$BINDDN" -w $BINDPW -h $SERVER -f $LDIFFILE
diff --git a/libexec/deluser b/libexec/deluser
new file mode 100755
index 0000000..2e1496f
--- /dev/null
+++ b/libexec/deluser
@@ -0,0 +1,55 @@
+## Copyright (c) 2004 Code Fusion cc
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License as
+## published by the Free Software Foundation; either version 2, or
+## (at your option) any later version.
+##
+## This program is distributed 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
+## General Public License for more details.
+##
+## You can view the GNU General Public License, online, at the GNU
+## Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
+##
+
+
+if [ ".$1" = ".--showhelp" ]; then
+ echo "Delete a user mailbox"
+ exit 0
+ HASHELP
+fi
+
+#Collect some vitals
+SERVER=127.0.0.1
+PREFIX=@l_prefix@
+BINDDN=`cat $PREFIX/etc/kolab/kolab.conf | grep "bind_dn :" | sed -e "s;bind_dn : ;;"`
+BINDPW=`cat $PREFIX/etc/kolab/kolab.conf | grep "bind_pw :" | sed -e "s;bind_pw : ;;"`
+BASEDN=`cat $PREFIX/etc/kolab/kolab.conf | grep "base_dn :" | sed -e "s;base_dn : ;;"`
+HOMESERV=`cat $PREFIX/etc/kolab/kolab.conf | grep "fqdnhostname :" | sed -e "s;fqdnhostname : ;;"`
+
+DN=`$PREFIX/bin/kolab showuser $1 | grep dn`
+if test "$DN" = ""; then
+echo User not found!
+exit 255
+else
+ echo $DN
+ echo Are you sure you want to delete this user?
+ read ANS
+ if test "$ANS" != "y"; then
+ exit 0
+ fi
+fi
+
+
+LDIFFILE="/tmp/cfdeluser.ldif"
+trap "rm $LDIFFILE" 0 1 2 3 15
+
+cat <<LDIF > $LDIFFILE
+$DN
+add: kolabdeleteflag
+kolabdeleteflag: $HOMESERV
+LDIF
+
+$PREFIX/bin/ldapmodify -x -D "$BINDDN" -w $BINDPW -h $SERVER -f $LDIFFILE
diff --git a/libexec/listusers b/libexec/listusers
new file mode 100755
index 0000000..d4b79ee
--- /dev/null
+++ b/libexec/listusers
@@ -0,0 +1,31 @@
+## Copyright (c) 2004 Code Fusion cc
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License as
+## published by the Free Software Foundation; either version 2, or
+## (at your option) any later version.
+##
+## This program is distributed 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
+## General Public License for more details.
+##
+## You can view the GNU General Public License, online, at the GNU
+## Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
+##
+
+prefix=@l_prefix@
+
+if [ ".$1" = ".--showhelp" ]; then
+ echo "Display a list of mailboxes"
+ exit 0
+ HASHELP
+fi
+
+server=127.0.0.1
+binddn=`cat ${prefix}/etc/kolab/kolab.conf | grep "bind_dn :" | sed -e "s;bind_dn : ;;"`
+bindpw=`cat ${prefix}/etc/kolab/kolab.conf | grep "bind_pw :" | sed -e "s;bind_pw : ;;"`
+basedn=`cat ${prefix}/etc/kolab/kolab.conf | grep "base_dn :" | sed -e "s;base_dn : ;;"`
+
+
+${prefix}/bin/ldapsearch -x -LLL -b "$basedn" -D "$binddn" -w $bindpw -h $server "(&(objectClass=kolabInetOrgPerson)(mail=*))" mail | grep mail | sed -e "s;mail: ;;"
diff --git a/libexec/newconfig b/libexec/newconfig
new file mode 100755
index 0000000..51ebab5
--- /dev/null
+++ b/libexec/newconfig
@@ -0,0 +1,25 @@
+## Copyright (c) 2004 Code Fusion cc
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License as
+## published by the Free Software Foundation; either version 2, or
+## (at your option) any later version.
+##
+## This program is distributed 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
+## General Public License for more details.
+##
+## You can view the GNU General Public License, online, at the GNU
+## Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
+##
+
+prefix=@l_prefix@
+
+if [ ".$1" = ".--showhelp" ]; then
+ echo "Propogate changes made to Kolab templates"
+ exit 0
+ HASHELP
+fi
+
+${prefix}/sbin/kolabconf
diff --git a/libexec/services b/libexec/services
new file mode 100755
index 0000000..55496ec
--- /dev/null
+++ b/libexec/services
@@ -0,0 +1,30 @@
+## Copyright (c) 2004 Code Fusion cc
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License as
+## published by the Free Software Foundation; either version 2, or
+## (at your option) any later version.
+##
+## This program is distributed 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
+## General Public License for more details.
+##
+## You can view the GNU General Public License, online, at the GNU
+## Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
+##
+
+
+prefix=@l_prefix@
+
+if [ ".$1" = ".--showhelp" ]; then
+ echo "Display a list of services"
+ exit 0
+ HASHELP
+fi
+
+
+services=`ls ${prefix}/etc/rc.d`
+echo "${services}" | sed -e 's/rc\.//'
+
+
diff --git a/libexec/showlog b/libexec/showlog
new file mode 100755
index 0000000..a1e6b0a
--- /dev/null
+++ b/libexec/showlog
@@ -0,0 +1,74 @@
+## Copyright (c) 2004 Code Fusion cc
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License as
+## published by the Free Software Foundation; either version 2, or
+## (at your option) any later version.
+##
+## This program is distributed 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
+## General Public License for more details.
+##
+## You can view the GNU General Public License, online, at the GNU
+## Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
+##
+
+prefix=@l_prefix@
+
+if [ ".$1" = ".--showhelp" ]; then
+ echo "Display the Kolab server logs"
+ exit 0
+ HASHELP
+fi
+
+#list of logfiles, maintainers please update
+logfiles="
+$prefix/var/proftpd/proftpd.log
+$prefix/var/amavisd/amavis.log
+$prefix/var/fsl/fsl.log
+$prefix/var/sasl/log/saslauthd.log
+$prefix/var/resmgr/resmgr.log
+$prefix/var/resmgr/freebusy.log
+$prefix/var/clamav/clamd.log
+$prefix/var/imapd/log/master.log
+$prefix/var/imapd/log/misc.log
+$prefix/var/apache/log/apache-error.log
+$prefix/var/apache/log/apache-access.log
+$prefix/var/openldap/openldap.log
+$prefix/var/postfix/log/postfix.log
+"
+
+if [ ".$PAGER" = "." ]; then
+ PAGER=less
+fi
+
+
+if [ ".$1" = "." ]; then
+ for log in $logfiles; do
+ echo $log
+ done
+ echo
+ echo "To view a log please specify the <logname> or \"-t <logname>\""
+ echo "It is also possible to abbreviate the logname, for example:"
+ echo "\"showlog postfix\" will display the postfix log."
+else
+ if [ ".$1" = ".-t" ]; then
+ PAGER="tail -f "
+ if [ ".$2" = "." ]; then
+ exit 0;
+ else
+ showme=$2
+ fi
+ else
+ showme=$1
+ fi
+
+ for log in $logfiles; do
+ match=`echo $log | grep $showme`
+ if [ ".$match" != "." ]; then
+ $PAGER $log
+ fi
+ done
+fi
+
diff --git a/libexec/showuser b/libexec/showuser
new file mode 100755
index 0000000..3bd4296
--- /dev/null
+++ b/libexec/showuser
@@ -0,0 +1,36 @@
+## Copyright (c) 2004 Code Fusion cc
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License as
+## published by the Free Software Foundation; either version 2, or
+## (at your option) any later version.
+##
+## This program is distributed 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
+## General Public License for more details.
+##
+## You can view the GNU General Public License, online, at the GNU
+## Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
+##
+
+prefix=@l_prefix@
+
+if [ ".$1" = ".--showhelp" ]; then
+ echo "Display information on a user"
+ exit 0
+ HASHELP
+fi
+
+server=127.0.0.1
+binddn=`cat ${prefix}/etc/kolab/kolab.conf | grep "bind_dn :" | sed -e "s;bind_dn : ;;"`
+bindpw=`cat ${prefix}/etc/kolab/kolab.conf | grep "bind_pw :" | sed -e "s;bind_pw : ;;"`
+basedn=`cat ${prefix}/etc/kolab/kolab.conf | grep "base_dn :" | sed -e "s;base_dn : ;;"`
+
+
+if [ ".$1" = "." ]; then
+ echo "Please specify an email address"
+ exit 2
+fi
+
+${prefix}/bin/ldapsearch -x -LLL -b "$basedn" -D "$binddn" -w $bindpw -h $server "(&(objectClass=kolabInetOrgPerson)(mail=$1))"
diff --git a/libexec/start b/libexec/start
new file mode 100755
index 0000000..d13f284
--- /dev/null
+++ b/libexec/start
@@ -0,0 +1,26 @@
+## Copyright (c) 2004 Code Fusion cc
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License as
+## published by the Free Software Foundation; either version 2, or
+## (at your option) any later version.
+##
+## This program is distributed 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
+## General Public License for more details.
+##
+## You can view the GNU General Public License, online, at the GNU
+## Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
+##
+
+prefix=@l_prefix@
+
+if [ ".$1" = ".--showhelp" ]; then
+ echo "Start the server"
+ exit 0
+ HASHELP
+fi
+
+
+${prefix}/bin/openpkg rc all start
diff --git a/libexec/stop b/libexec/stop
new file mode 100755
index 0000000..b572e70
--- /dev/null
+++ b/libexec/stop
@@ -0,0 +1,26 @@
+## Copyright (c) 2004 Code Fusion cc
+##
+## This program is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License as
+## published by the Free Software Foundation; either version 2, or
+## (at your option) any later version.
+##
+## This program is distributed 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
+## General Public License for more details.
+##
+## You can view the GNU General Public License, online, at the GNU
+## Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
+##
+
+prefix=@l_prefix@
+
+if [ ".$1" = ".--showhelp" ]; then
+ echo "Stop the server"
+ exit 0
+ HASHELP
+fi
+
+
+${prefix}/bin/openpkg rc all stop