Update of /cvsroot/tmda/tmda/contrib
In directory sc8-pr-cvs1:/tmp/cvs-serv6037/contrib
Modified Files:
vadduser-tmda vtmdarc
Log Message:
vadduser-tmda improvements from Cory Wright/Ben Bullock.
Index: vadduser-tmda
===================================================================
RCS file: /cvsroot/tmda/tmda/contrib/vadduser-tmda,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- vadduser-tmda 12 Mar 2003 21:49:16 -0000 1.2
+++ vadduser-tmda 3 Apr 2003 20:52:27 -0000 1.3
@@ -4,7 +4,7 @@
# #
# vadduser-tmda - A TMDA wrapper script for vpopmail's vadduser program #
# #
-# Version: 0.1 #
+# Version: 0.2 #
# #
# Copyright (C) 2003 Cory Wright - http://www.standblue.net/ #
# #
@@ -25,6 +25,16 @@
##############################################################################
##############################################################################
+# Release History #
+# #
+# * 0.1 - February 12, 2003 - Initial release as part of TMDA #
+# * 0.2 - April 2, 2003 - Thanks to Ben Bullock ([EMAIL PROTECTED]) the #
+# vadduser-tmda script can now add TMDA on existing vpopmail #
+# accounts, with other improvements. #
+# #
+##############################################################################
+
+##############################################################################
# Installation and Usage #
# #
# Copy the vadduser-tmda script to the ~vpopmail/bin/ directory. Copy the #
@@ -56,38 +66,49 @@
VPOPROOT="/var/vpopmail/"
PATH="$VPOPROOT/bin:$TMDAROOT/bin:$PATH"
VTMDARC="$VPOPROOT/etc/vtmdarc"
-VUID="vpopmail" # These two can, and should, be set by #
-VGID="vchkpw" # looking at vdominfo #
# #
##############################################################################
-# We need the full parameters passed so that we can send
-# them straight through to the vadduser program.
+# We need the full parameters passed so that we can send them straight through
+# to the vadduser program.
FULLPARAM="$*"
-# Determine the email address. There's probably a better
-# way to do this.
-LASTPARAM=`eval echo $#`
-EMAILADDR=`eval echo \\\$${LASTPARAM}`
-
-# First things first, add the new user.
-vadduser $FULLPARAM
-
-# Must not continue if creation was not successful.
-if [ "$?" != 0 ]; then
- echo There was a problem adding the account. Exiting...
+# Determine the email address. There's probably a better way to do this.
+EMAILADDR=`eval echo \\\$${#}`
+
+# Set up a few variables that we need. Many of these are useful in vtmdarc
+VUSERNAME=`echo $EMAILADDR | cut -d@ -f1`
+VDOMAIN=`echo $EMAILADDR | cut -d@ -f2`
+
+# Add the new user if the account does not already exist
+if ! vuserinfo $EMAILADDR > /dev/null 2>&1 ; then
+ echo "Creating the virtual user account..."
+
+ # Does the domain directory exist?
+ if ! vdominfo $VDOMDIR > /dev/null 2>&1 ; then
+ echo "Error: $VDOMDIR does not exist. Exiting..."
exit 1
+ fi
+
+ # Add the virtual user account
+ $VPOPROOT/bin/vadduser $FULLPARAM
+
+ # Stop if creation was not successful.
+ if [ "$?" != 0 ]; then
+ echo "There was a problem adding the account. Exiting..."
+ exit 1
+ fi
fi
-# Set up a few variables that we need.
-# Many of these are useful in vtmdarc
VUSERDIR=`vuserinfo -d $EMAILADDR`
-VUSERNAME=`echo $EMAILADDR | cut -d@ -f1`
-VDOMAIN=`echo $EMAILADDR | cut -d@ -f2`
VDOMDIR=`vdominfo -d $VDOMAIN`
-python -c 'import cdb' 2> /dev/null
+VUID=`vdominfo -u $VDOMAIN`
+VGID=`vdominfo -g $VDOMAIN`
+
+# Check python's cdb support
CDB=""
+python -c 'import cdb' 2> /dev/null
cdbcheckret=$?
if [ $cdbcheckret = "0" ]; then
CDB="-autocdb"
@@ -97,10 +118,12 @@
mkdir -p $VUSERDIR/.tmda/filters $VUSERDIR/.tmda/lists
mkdir -p $VUSERDIR/.tmda/pending $VUSERDIR/.tmda/responses
touch $VUSERDIR/.tmda/filters/incoming $VUSERDIR/.tmda/filters/outgoing
-touch $VUSERDIR/.tmda/lists/whitelist $VUSERDIR/.tmda/config
-echo "from-file $CDB $VUSERDIR/.tmda/lists/whitelist ok" >>
$VUSERDIR/.tmda/filters/incoming
+touch $VUSERDIR/.tmda/lists/whitelist $VUSERDIR/.tmda/lists/blacklist
+touch $VUSERDIR/.tmda/config
+echo "from-file $CDB $VUSERDIR/.tmda/lists/whitelist ok" >>
$VUSERDIR/.tmda/filters/incoming
+echo "from-file $CDB $VUSERDIR/.tmda/lists/blacklist drop" >>
$VUSERDIR/.tmda/filters/incoming
cp -R $TMDAROOT/templates $VUSERDIR/.tmda/
-tmda-keygen -b > $VUSERDIR/.tmda/crypt_key
+$TMDAROOT/bin/tmda-keygen -b > $VUSERDIR/.tmda/crypt_key
chmod 600 $VUSERDIR/.tmda/crypt_key
# Create the .qmail files.
Index: vtmdarc
===================================================================
RCS file: /cvsroot/tmda/tmda/contrib/vtmdarc,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- vtmdarc 12 Mar 2003 21:49:17 -0000 1.2
+++ vtmdarc 3 Apr 2003 20:52:28 -0000 1.3
@@ -1,3 +1,6 @@
CRYPT_KEY_FILE = "$VUSERDIR/.tmda/crypt_key"
CONFIRM_APPEND = "$VUSERDIR/.tmda/lists/whitelist"
DATADIR = "$VUSERDIR/.tmda/"
+PENDING_WHITELIST_APPEND = CONFIRM_APPEND
+PENDING_RELEASE_APPEND = CONFIRM_APPEND
+FILTER_INCOMING = "$VUSERDIR/.tmda/filters/incoming"
_______________________________________
tmda-cvs mailing list
http://tmda.net/lists/listinfo/tmda-cvs