Solved

Virtusertable

Posted on 2002-04-16
11
481 Views
Last Modified: 2013-12-17
Hi,

Does the VUT need to be sorted into ascending order?

Im asking this because I have many instances of

me@domain.com user@mail.domain.com
@domain.com someone@mail.domain.com

Would it matter what entry went in to the table first?
0
Comment
Question by:choccarlm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 3
11 Comments
 
LVL 15

Expert Comment

by:samri
ID: 6944554
It does do the match from top to bottom.

More info on this website.
Section 18.3.6 /etc/mail/virtusertable
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/sendmail.html

I think with the following map, the mail will always go "localjoe".
joe@yourdomain1.com             localjoe
joe@yourdomain1.com             joe@othercompany.com

I haven't got access at the moment to verify.

Some detail or virtual hosting.
http://www.sendmail.org/virtual-hosting.html

But it doesn't say anything about the sorting of entries makes a difference.

I personally does not really take the order seriously.  But surprisely, it does.

cheers.
0
 

Author Comment

by:choccarlm
ID: 6944599
Before I build the VUT, I have a file with all the email address's within it. I then sort this file, and build the VUT using the makemap hash command.

With this is mind, and what you just told me, what would be the best way to sort this file?

I currently use sort command.

Cheers
0
 
LVL 15

Expert Comment

by:samri
ID: 6946548
I think it should not matter which order, since "normally", there should be only one recepient for, for lets say the address joe@company.com -> joe_schmoe@the-real-company.com. Unless you need to have the mail adress to a virtual-user to be sent to two different (or more) real-user, it is best to use local alias file.  There is a note at http://www.sendmail.org/virtual-hosting.html
Sendmail Configuration, #1, Note2.

Other than that, sorting order really depends on personal approach.  If you are doing VirtualHosting for quite a number of clients, then splitting up the virtual-table text file by what VirtualDomain they belong to, and sort them by the virtual-user;

--domain-a.txt
a@domain-a.com         real-a@otherdomain.com
b@domain-a.com         real-b@otherdomain.com
etc...
z@domain-a.com         whomever@otherdomain.com

--domain-b.txt
a@domain-b.com         real-a@otherdomain2.com
b@domain-b.com         real-b@otherdomain1.com
etc.
etc.
z@domain-b.com         whomever@otherdomain-x.com

Prior to building the map, have a scripts to concatenate the file, or a simple "

# cat domain-a.txt domain-b.txt domain-x.txt > virtualusertable
# makemap ...

I would choose this option since it's easier to managed the list.  And if you make the file naming to conform to certan pattern, it's even easier to manage the list.
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 40

Expert Comment

by:jlevie
ID: 6947758
It doesn't matter whether the catchall is before, after, or anywhere in the virtusertable file. The process of matching an email address to virtusertable is to first attempt a lookup of the recipient address. If that fails to return a "local address" a lookup will be attempted for the catchall. So an ordinary ascii sort on the LHS is fine.

samri,

The issue of duplicate addresses on the LHS doesn't arise because the virtusertable map is normally a hash. The key is the LHS of each line and a hash doesn't allow duplicate keys. So attempting to make the map will result in an error.
0
 

Author Comment

by:choccarlm
ID: 6947770
Does that mean that I dont have to sort the original file at all? Can I just make the db file straight from the text file, without any sorting?

Cheers
0
 
LVL 40

Accepted Solution

by:
jlevie earned 20 total points
ID: 6947782
Yep, it should work fine. There are advantages to sorting the list if you have a lot of domains and virtual users. It's a lot easier to mantain the list if all of the virtual addresses are grouped by domain.
0
 

Author Comment

by:choccarlm
ID: 6947789
I'll take your word for it then!!
0
 
LVL 15

Expert Comment

by:samri
ID: 6948051
jlevie, choccarlm

Gee.. I think I'll have to take your words for that too... (next time I'll test before typing..)

Somewhere on this page, it mentioned that the order will go from top to bottom:
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/sendmail.html

Are we looking at a false info here (beside my false claim ::)

0
 
LVL 40

Expert Comment

by:jlevie
ID: 6948425
Well, that was what I remembered seeing in the sendmail code some time back when I was looking to see how some of that stuff worked. And before my last comment I did a quick test of placing the catchall first to prove to myself that the statement was accurate.

I don't know where the info in the above URL comes from. It's possible that it might have been true as some point in the past and it might still be true if virtusertable isn't configured to be a database. But, since none of the Sendmail configurations or documentation suggests using anything except a DB for the map it seems safe to make the claim above.

Based on what I see, I'd have to say that it's a false statement.
0
 
LVL 15

Expert Comment

by:samri
ID: 6949436
Hmm.. I started to see some logic here...

Yep.. confirmed, at least on rh7.2, sendmail 8.11.2.

makemap: virtusertable.db: line 2: key samri: duplicate key
make: *** [virtusertable.db] Error

thanks a lot.
0
 
LVL 40

Expert Comment

by:jlevie
ID: 6949775
Yeah, I know from having made the mistake of having duplicate keys that as far back as 8.9 you'll get an error.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

New-MailboxSearch Powershell Command and step by step approach to Search and Extract Emails form Exchange 2013 Journaling server.
Granting full access permission allows users to access mailboxes present in their database. By giving full access permission one can open and read the content of any mailbox but cannot send emails from that mailbox.
In this video we show how to create a Contact in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >> Contact ta…
The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager

718 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