Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 495
  • Last Modified:

Virtusertable

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
choccarlm
Asked:
choccarlm
  • 4
  • 4
  • 3
1 Solution
 
samriCommented:
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
 
choccarlmAuthor Commented:
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
 
samriCommented:
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
jlevieCommented:
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
 
choccarlmAuthor Commented:
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
 
jlevieCommented:
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
 
choccarlmAuthor Commented:
I'll take your word for it then!!
0
 
samriCommented:
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
 
jlevieCommented:
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
 
samriCommented:
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
 
jlevieCommented:
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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now