Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checking if user exists

Status
Not open for further replies.
Nov 23, 2003
9
RU
Hi experts!
I've setted up sendmail box to work as mail hub: it recieves mail from outside and relay it to internal exchange server.
m4 configuration is like this:
Everything works fine, but it checks only domain name when recieving a message. For example it will recieve a post to abrakadabra@my_domain.com
A lot of spam to non-existing users come to exchange server and it have to generate NDR's.
Does any one know, can i make any file or base with existing users, so that sendmail would check incoming mail with it? Or is there other ways?
Thanks!
 
This idea may not work if you have a great deal of users. I use the virtusertable. What this allows me to do is list each user for all of the domains I host. Then at the bottom of the list I use the catchall so if a user is not in the list, the sender is given an error message. Here is a very brief example of what I mean:

user1@mydomain.com user1
webmaster@mydomain.com user2@hotmail.com
@mydomain.com error:nouser No Such User

Any e-mail address not accounted for in the list, gets bounced back with the error message, "No Such User". Each line has to parts. The first is one of the following: virtual user such as webmaster, An actual e-mail address on your system or an entire domain. On the righthand side, you put the destination. This can be either a system user name, any valid e-mail address or another domain. You would have to do this for every domain you host on your system being sure to use the catchall for each domain. As you can see, this may not be too practical if you have a large amount of users. I also am not sure how to use this setup for your exchange server. If your system already uses the linux system user accounts, then this will work fine.
 
Thank you very much for answer!
I've read something about virtusertable, but i didn't understood how it will work in my system. Normally inbound messages come to mailhub to someone@my_domain.com , checked against domain and if it's mine, emmediately relayed to Exchange machine IP with no mix of domain or user name in destination address.
So virtusertable must look as:
user1@mydomain.com user1@mydomain.com
user2@mydomain.com user2@mydomain.com
@mydomain.com error:nouser No Such User

Right?
 
I don't think so. Here is how you can check. Don't use the catchall (@mydomain.com). Now, just add your e-mail address.

me@mydomain.com me (your linux user name)

After editing /etc/mail/virtusertable, run this command:

makemap hash /etc/mail/virtusertable.db < /etc/mail/virtusertable

Nothing in the e-mail's header information gets changed at this point. When sendmail gets mail for me@mydomain.com it sees that it goes to &quot;me&quot; who is a user at mydomain.com. Since there is no difference nothing is done (it is untouched) and it goes along the path it did before. The only e-mails that get changed from here are ones that you direct to another server or ones that fall through to the catchall which get sent back with an error message. In other words, mail for spam@mydomain.com and unknown@mydomain.com will never see the exchange server.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top