Solved

Apache/sendmail Virtual Servers

Posted on 2000-04-09
20
361 Views
Last Modified: 2013-11-18
I'm running Red Hat 6.1 with the latest Apache and sendmail - On apache i have virtual servers with multiple domains I want to setup each domains with e-mail I also need for them or would like for them to pop their e-mail with their own domain name - for instance

John owns bubba.com
and
mary owns wowpants.com

i want john's "pop" account to be mail.bubba.com and marys to be mail.wowpants.com

I only have one linux server to do this on.  so i could really use some advice - I'm giving as many points as i have - so please have mercy on me.


0
Comment
Question by:ttrogden
  • 11
  • 9
20 Comments
 
LVL 40

Expert Comment

by:jlevie
ID: 2699061
Sendmail can handle the virtual domains easily with the virtual user table facility. You give each use a Linux account w/wo login privs (your choice) and put entries in /etc/sendmail.cw for each domain to tell sendmail that it's to accept mail for those domains, like:

bubba.com
wowpants.com

Make sure that "Fw/etc/sendmail.cw" is in your /etc/sendmail.cf and that it's not commented out. Then create a virtual user table, perhaps something like:

@bubba.com      %1
@wowpants.com      %1

I always include a couple of standard definitions for each virtual domain point to the appropriate person, like:

Postmaser@bubba.com      local-postmaster-name
Webmaster@bubba.com      local-webmaster-name

The above will allow multiple email addresses for each virtual domain and they'll be mapped to local accounts on myserver.mydomain.com (your server's official name) of the same name, i.e. mary@wowpants.com maps to the local user mary. If you don't want/need multiple email accounts, or you want to be able to have the client's email address be different from the local account name, use:

mary@wowpants.com      mary-local

Whichever way you decide to do it, put each virtual user definition in a file, one per line. I normally keep the virtual user definition in /etc/virtualusers. The virtual user table is normally implemented as a dbm hash, defined like so:

Kvirtuser hash -o /etc/mail/virtusertable

in sendamil.cf. Make sure it's there and not commented out. You make the dbm hash file like:

makemap hash /etc/mail/virtusertable </etc/virtualusers

If desired, you can create CNAME records for you clients in the DNS zone file for their virtual domain like:

$ORIGIN  wowpants.com.
mail     IN CNAME  myserver.mydomain.com.

so that they can specify mail.bubba.com as their "pop server" (it'll resolve to your server's IP).

Make sure that your DNS has MX records for each of the virtual domains, like:

wowpants.com      IN MX  10 myserver.mydomain.com.

and tell the clients to use their virtual email account info as the "Reply To:" address, i.e. mary@wowpants.com.

If you want to reverse map out the user's domain, you'll likely need to build your own sendmail.cf from the .mc file(s) and include support for "genericstable". There's more information about that and virtual hosting at: http://www.sendmail.org/virtual-hosting.html


0
 
LVL 40

Expert Comment

by:jlevie
ID: 2699063
Oh, I almost forgot... We've got to stop meeting like this... people will talk...
0
 
LVL 1

Author Comment

by:ttrogden
ID: 2699142
you know - I should just give you all my points and you just tell me when i can't ask anymore questions.  It's bad enought i'm going to have to wait a month to build up more points so that i can ask more questions :)

ok - let me make sure i understand this

*************
Make sure that "Fw/etc/sendmail.cw" is in your /etc/sendmail.cf and that it's not commented out. Then create a virtual user table, perhaps something like:

@bubba.com %1
@wowpants.com %1
**************

I looked at the first thing in sendmail.cf and there was the /etc/sendmail.cf thing in there and it wasn't commented out.

I looked into sendmail.cw and found a few domain names i had put in there a while back but with no @ sign and no %1 sign - i put those in (why do they need that)

*********

I always include a couple of standard definitions for each virtual domain point to the appropriate person, like:

Postmaser@bubba.com local-postmaster-name
Webmaster@bubba.com local-webmaster-name
***********

Where do i put the above stuff at ??

**************
Whichever way you decide to do it, put each virtual user definition in a file, one per line. I normally keep the virtual user definition in /etc/virtualusers. The virtual user table is normally implemented as a dbm hash, defined like so:

Kvirtuser hash -o /etc/mail/virtusertable

in sendamil.cf. Make sure it's there and not commented out. You make the dbm hash file like:

makemap hash /etc/mail/virtusertable </etc/virtualusers
*****************
HUH ???  way over my head - what is a dbm hash ?? and the makemap thing - i guess i was suppose to run this from the command line - but when i did it came back with an error of no such file or directory - but i have a virtusertable file in my /etc/mail folder


sorry about this - i really am trying to understand this.







0
 
LVL 40

Expert Comment

by:jlevie
ID: 2699181
The lines like "@buba.com  %1"/"user@buba.com  local-user" would go in the virtual users file, not sendmail.cw. Only domain names go in sendmail.cw and sendmail uses those domain names to determine who it's supposed to accept email for.

Where you put the virtual user definitions is up to you. RH does create an empty /etc/mail/virtusertable file, and you can put the definitions in that file. Lets assume for the moment that mary & bob are the Linux user names. My /etc/virtusertable file could look like:

mary@wowpants.com        mary
postmaster@wowpants.com  ttrogden
webmaster@wowpants.com   ttrogden
bob@bubba.com            bob
postmaster@bubba.com     ttrogden
webmaster@bubba.com      ttrogden

and I'd make the map with:

makemap hash /etc/mail/virtusertable </etc/mail/virtusertable

If you look in /etc/mail you'll see virtusertable & virtusertable.db files. The makemap command read input from virtusertable and put the data in the dbm file virtusertable.db for sendmail's use. A dbm has is a simple form of a database. It's composed of key-value pairs (like key=bob@bubba.com, value=bob). It's very fast for sendmail to look up the value (bob) when it has the key (bob@bubba.com). Speed doesn't much matter in this case as you're only hosting a few virtual domains. But suppose you were a major site and had a few tens of thousands of virtual domains to host...

Does that help?
0
 
LVL 1

Author Comment

by:ttrogden
ID: 2700159
ok - i looked inside my /etc/mail/virtusertable and it had the @wowpants.com %1 etc etc, am i suppose to skip down a few lines and put in the

postmaster@wowpants.com  ttrogden

or does that go into another file ??  I ran the makemap command na di guess it worked - it did create a virtusertable.db file - also is there a difference between and virtual user file and a virtual user definition ??
0
 
LVL 40

Expert Comment

by:jlevie
ID: 2700661
I used the term "virtual user definition" to refer to lines that would be in the "virtual user file" that defined how a virtual user is to be mapped to some real user.

If you have definitions like "@wowpants.com %1" in the virtual user file, then you don't necessarily need other definitions like "postmaster@wowpants.com  ttrogden". It depends on how the sendmail alises file is set up and what you want to accomplish.

An entry in the virtual user file of the form "@domain.com  %1" says that for any email address like user@domain.com, postmaster@domain.com, etc. the email will be sent to what's left after "@domain.com" is stripped off. So the email would be sent to user, postmaster, etc. You can set who gets all mail for postmaster in the aliases file.

Now, if you want email for postmaster, webmaster, etc to go somplace other than where sendmail would ordinarily send it, you would then want to add specific lines to the virtual user file for those email addresses, like webmaster@domain.com  ttrogden".
0
 
LVL 1

Author Comment

by:ttrogden
ID: 2700693
ok - you know i think i'm starting to understand this - i added to the virtusertable all the domain names i want to host with @domainname.com %1


ok - i have 2 domain names pointed at my box with virtual servers and they are working great - they both pull up different websites (like they are suppose to ) and i setup a mail alias to forward e-mail bound for the main domain name to my home e-mail address.  i want to change that and pop it down - so i setup a eudora test and tried to pop my mail from the server and it said it was refused - have  i missed something ??


0
 
LVL 40

Expert Comment

by:jlevie
ID: 2700774
Have you installed a POP3/IMAP server? The rpm is imap-4.5-4.i386.rpm on RH 6.1.

BTW: my email is jlevie@bellsouth.net
0
 
LVL 1

Author Comment

by:ttrogden
ID: 2700857
where on RH 6.1 is that file ??  i tried a whereis and it couldn't find it
0
 
LVL 1

Author Comment

by:ttrogden
ID: 2700942
never mind - i found a copy on the net and downloaded it - but when i ran rpm -ivh imap-4.7-5.i386.rpm and then it said

error: failed dependencies
krb5-libs
krb5-configs
libcom_err.so.3
libgssapi_krb5.so.2
libk5crypto.so.2
libkrb5.so.2


what did i do wrong ??


0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 40

Expert Comment

by:jlevie
ID: 2700996
You need the one off the RH 6.1 CD. The one you dwnloaded is for 6.2, I believe. At any rate it needs later libs than you've got.

If you don't have the CD handy you can download the correct version from: ftp://ftp.freesoftware.com/pub/linux/redhat/redhat-6.1/i386/RedHat/RPMS/ or any othe RedHat mirror.
0
 
LVL 1

Author Comment

by:ttrogden
ID: 2701074
ok i did that - and ran it with
rpm -ivh imap-4.5-4.i386.rpm and what was returned to me was
imap   ######################

and that was it - i don't think it worked, what do you think ??


tommyt
0
 
LVL 40

Expert Comment

by:jlevie
ID: 2701165
It sure did. That's exactly what you ought to see with those install options (v - verbose, h - show hash marks). You can double check by querying for the installed package with "rpm -q imap" and should return "imap-4.5-4". I don't think there's anything else you need to do, POP & IMAP are normally invoked by inetd (and there out to be a couple of lines that got added to /etc/inetd.conf for the pop3 & imap daemons).
0
 
LVL 1

Author Comment

by:ttrogden
ID: 2701181
your right (as always) i looked in the inetd file and they show POP and imap mail services et al
and then they have
#pop-2 stream tcp ....
#pop-3 stream tcp ....
#imap stream tcp ...


i'm pretty sure i need to remove those # right ??


and when i do - do i need to restart something ??

0
 
LVL 40

Expert Comment

by:jlevie
ID: 2701241
Yep, uncomment them. And no you shouldn't need to "start anything" The way inetd works is that it will initially accept the inbound POP2/3 or IMAP connection, look in it's config file and start the daemon listed for that service, passing it the connection. Later when the pop/imap daemon is finished it'll exit so the system doesn't fill up with pop/imap tasks.

You will need to reboot or signal inetd to re-read it's config file. To do it w/o a reboot, first find the process id of inetd (ps -ef | grep inetd | grev -v grep). The first number in the output is the process id, send it a HUP with "kill -HUP pid#".
0
 
LVL 1

Author Comment

by:ttrogden
ID: 2701279
ok - i rebooted the computer and it seems to be working right  except that it's not taking my password when it tries to login.  I verified that i was using the right password by telneting into the box and it worked great - do you have any idea why it's not taking my password ??


0
 
LVL 1

Author Comment

by:ttrogden
ID: 2701416
forget that last entry  - I'm a complete idiot !!  i had spelled my name wrong - what a dumb #@$ on my part - oh well - on to the last and final request - that is setting up the dns for the different domain names.  I've got the virtual domain names in apache setup - now i want to setup the MX record for each domain (so they can pop form there onw domain name)- you said i need to setup virtual dns entries for each of these domains - where do i create these entries.  in the /var/named area ??
0
 
LVL 40

Accepted Solution

by:
jlevie earned 100 total points
ID: 2701596
I got your email & I'll work up a "sample config" tonight that follows the "DNS & Bind" book. Then we'll sort out how to tweak it to your exact needs.
0
 
LVL 1

Author Comment

by:ttrogden
ID: 2701604
thanks
0
 
LVL 1

Author Comment

by:ttrogden
ID: 2761457
Thanks for your help
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
How to add replacement disk to HP RAID ? 16 47
Tape vs RDX backup 7 60
Backup Exec & Exchange 2 21
Problem to picture file 3 41
Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
The article will include the best Data Recovery Tools along with their Features, Capabilities, and their Download Links. Hope you’ll enjoy it and will choose the one as required by you.
This tutorial will walk an individual through the process of installing the necessary services and then configuring a Windows Server 2012 system as an iSCSI target. To install the necessary roles, go to Server Manager, and select Add Roles and Featu…
The viewer will learn how to dynamically set the form action using jQuery.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now