Koozali.org: home of the SME Server

Virtual DOmain Question

Jose Paez

Virtual DOmain Question
« on: April 03, 2002, 07:15:30 PM »
Hi,

I'm a little bit new about e-smith, i'm using the 4.2 version as a gateway and it works great! but now i have a valid fixed ip address and i was wondering if i could host about 10 different small sites, all having different domains and running a dns on the same server using the same ip address for all this.

I've done this before using a cobalt network's raq2 server appliance that i no longer have so it would be very appreciated if somebody could help me find a way to do this with e-smith or sme.

Thanks!

Dan Brown

Re: Virtual DOmain Question
« Reply #1 on: April 03, 2002, 07:32:43 PM »
You can't, by default, use the e-smith box as a public DNS server, though some people have written HOWTOs explaining how to change that.  Hosting multiple domains is easy, though; you're looking for "virtual domains" in the user's guide.

By default, however, all the domains share the same namespace for e-mail--IOW, fred@domain1 is the same as fred@domain2.  There's another HOWTO on this, but it isn't pretty.

Tom Carroll

Re: Virtual DOmain Question
« Reply #2 on: April 05, 2002, 01:02:24 AM »
Dan, can you point me to that how-to?

I looked in the contrib/how-to areas on the e-smith.org site and yours and Darrell's sites with no joy...

Thanks!

Tom

Dan Brown


Dan G.

Re: Virtual DOmain Question
« Reply #4 on: April 05, 2002, 03:31:36 AM »
Not sure if this will be helpful, or if it's 100% correct, but I made this ugly script by mashing together two of Darrell's contribs. I took the script structure from his addusers script and the instructions from the virtual mail alias how-to, and created the script below.  It *appears* to work.  Keep in mind, I know nothing about shell scripting, other than reading thru others, and "figuring out" what they do.  I used this to load about 60 mail aliases on a server, but haven't had a chance to test it live yet.  Overall, the management of virtual domain mail is a dirty manual kludge, in need of a slicker way to manager it.   I just cooked up a faster way to kludge a bunch of them.


#!/bin/sh
#
# USAGE:
#
# Create the file /root/vmailalias in the following format:
#
# USERNAME1:VDOMAIN1
# USERNAME2:VDOMAIN2
#
# and so on...
#
# This script will create .qmail-default files in each user's home directory,
# and set correct ownership and rights to that user.
#
################################################################################

# Make sure template fragment exists
   mkdir -p /etc/e-smith/templates-custom/var/qmail/control/virtualdomains
   touch /etc/e-smith/templates-custom/var/qmail/control/virtualdomains/90aliases

UFILE=/root/vmailalias

if [ ! -f $UFILE ]; then
echo User database $UFILE missing
exit
fi

# export record=cat $UFILE
# if [ "$record" != "" ]; then
for record in cat $UFILE
do
username=echo $record | awk -F":" {'print $1'}
vdomain=echo $record | awk -F":" {'print $2'}


# echo username into /userhomedir/.qmail-default
   touch  /home/e-smith/files/users/$username/.qmail-default
   echo  $username > /home/e-smith/files/users/$username/.qmail-default

# Set the ownership and rights on .qmail-default to the user only:
   chown $username:$username /home/e-smith/files/users/$username/.qmail-default
   chmod 644 /home/e-smith/files/users/$username/.qmail-default

# In the 90aliases file enter virtual alias in the form username@virtualdomain:username.
# In the example below info@domain1.com is to go to user fred.
#   info@domain1.com:fred
   
   echo $username@$vdomain:$username >> /etc/e-smith/templates-custom/var/qmail/control/virtualdomains/90aliases

done

# Update the /var/qmail/control/virtualdomains configuration file
/sbin/e-smith/signal-event console-save

# Restart qmail
service qmail restart
#===============================================