Solved

Virtusertable

Posted on 2002-04-16
11
473 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
  • 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
 
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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
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

Do email signature updates give you a headache?

Do you feel like you are constantly making changes to email signatures? Are the images not formatting how you want them to? Want high-quality HTML signatures on all devices, including on mobiles and Macs? Then, let Exclaimer solve all your email signature problems today.

Join & Write a Comment

Microsoft Outlook is not just an email client but it is full featured Personal Information Manager. But sometimes Outlook gets disconnected and you simply can’t access it. What steps can you perform before calling IT support? In this article we will…
Easy CSR creation in Exchange 2007,2010 and 2013
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
In this video we show how to create a User Mailbox 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 >> Mailb…

707 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

11 Experts available now in Live!

Get 1:1 Help Now