virtual server mail alias

8 posts / 0 new
Last post
#1 Sat, 04/29/2006 - 08:15
DavidTran

virtual server mail alias

hi all

i'm using virtualmin 2.610 on webmin 1.270 on fc4

i created a virtual server, then added some email addresses (virtual domain user mailboxes) to the server

and it all works fine, but...

the username i have to use for squirrelmail/thunderbird (desktop email client) is user.domain.com

when i use squirrelmail, or send mail from the command line it sends the email from user.domain.com@domain.com

just wanted to know how to make it so that when i login to squirrelmail (and thunderbird), it is just user (rather than user.domain.com)

and therefore, when the mail is sent from the server, it is from user@domain.com (this is how it is in thunderbird)

also, i'm using postfix/dovecot if that has any bearing

thanks dave

Sun, 04/30/2006 - 00:31
Joe
Joe's picture

Hey David,

There is an option in the Module Configuration labeled "Include domain name in usernames?". Select "Only to avoid a clash" and then delete and recreate the user.

Note that if you have another user with the same name, the domain name will then get appended, anyway because names must be unique.

--

Check out the forum guidelines!

Sun, 04/30/2006 - 01:22
DavidTran

oh ok, great thanks

is it possible to create virtual user mailboxes (as in it doesn't create a new unix user), it just creates a mailbox for a specified email address?

or is that in the works?

thanks again
dave

Sun, 04/30/2006 - 02:43 (Reply to #3)
Joe
Joe's picture

Hey David,

Short answer: no. We use Unix users because it gives us a lot of benefits and additional features that database-backed accounts do not.

Long answer: yes, maybe. There are some non-account methods of setting up Virtualmin, using LDAP or QMail+vpopmail. The LDAP method is probably a lot of trouble, as we've never actually done it, documented it, or tested it (but I seem to recall someone having success, after some effort). The QMail method is probably not worth the trouble, because it's QMail (before I get flamed: QMail is wonderful software, but it hasn't been maintained in years and no one can actually take it over because of DJB's nutty license, or lack thereof--life with QMail is a life of patching and dealing with a bunch of software from rather random sources...that's just no way to get peace of mind, in my book).

It's only slightly non-trivial to add more general (and tested) support for LDAP (non-user) accounts. And Jamie and I were talking about it today over lunch...I wouldn't be surprised if it shows up sometime after the EA period (finally) ends in a month or so. It will, of course, show up first in the Professional version, though there is going to be a major code merge at some point in the not too distant future to bring the codebases of GPL and Professional back into near parity (this does not mean a ton of Pro features will roll back--just that a lot of architectural improvements and quirk fixes will find their way back to GPL...but LDAP support would be an architectural change, and not a feature that we would reserve for Pro, so if it happens in Pro it'll happen in GPL soon after).

Hope this helps.

BTW-Why no user account? This comes up a lot, but I've yet to hear a single compelling argument for not having user accounts for mail users. I know the obvious ones, but they simply don't add up. Performance is the favorite red herring...but in a modern mail server, 90% or so of the actual CPU time, disk usage, and memory usage spent on each message is taken up with SpamAssassin and ClamAV processing. Address and home directory lookup has almost no measurable impact on performance (and LDAP or a database almost certainly won't be faster unless you have thousands of users). Security doesn't work as a reason either...Set the shell to /bin/false or /dev/null, and there's no login possible, and thus no security issue possible. If we're going to spend time optimizing, it should be spent workin on the spam/AV chain, and if worrying about security it should be time spent convincing our users not to set their password to "password" or "joe" (or whatever their username happens to be). Just a humble opinion from someone who refuses to be taken in by the "database-backed mail is so much faster/better/safer/sexier than mail with real user accounts". ;-)

--

Check out the forum guidelines!

Sun, 04/30/2006 - 05:37
DavidTran

cool, thanks for the detailed response

good to know the pros and cons of both sides

Sun, 04/30/2006 - 09:31
ADobkin

To add to Joe's response to your original question, removing the domain name from usernames is not the only way to solve this problem. I think that having domain names attached to the usernames is very sensible in this type of environment, since it helps track where your users belong and manage them properly. It is also the most consistent method, since otherwise you will have some users with domain names, and some without. I've done it that way on a previous server, and it got quite ugly after a while. It is[B>much</B> easier to manage a consistent environment than one with a bunch of exceptions everywhere.

The better answer, IMHO, is to leave domain names turned on for all usernames. Then, solving the problem with SquirrelMail is simple. The easiest answer is to have your users configure their e-mail address in the Options panel. That is what SM will use when sending outgoing mail, just like Thunderbird. Problem solved. There are other ways to accomplish the same thing though. For example, the[A HRef="http://www.SquirrelMail.org/plugin_view.php?id=181">New User Wizard</A> plugin forces the user "to enter their Full Name and Email Address prior to reading or composing" a message. That solves the problem the same way as having them enter it manually above, but it guarantees that it will happen right away. An even better solution (which can be used in combination with the New User Wizard and other plugins) is the[A HRef="http://www.SquirrelMail.org/plugin_view.php?id=47">Virtual Host Login</A> plugin, which "allows you to use just one SquirrelMail installation to host web mail for multiple domains. It is highly configurable," and it can automatically extract the virtual domain name out of the URL (i.e. webmail.domain.com) to determine how the user should log in (e.g. username instead of username.domain.com), how their outgoing e-mail address should be configured, etc.

< SoapBox ON]
The Virtual Host Login plugin is the "Right Way" to run SquirrelMail in a hosted environment. IMHO, this is how Virtualmin Professional should be adding value when installing SquirrelMail, by properly configuring these plugins for a system-wide installation, instead of by installing multiple copies of it for each domain. Doing that is the equivalent of installing multiple copies of Webmin and Usermin, which would certainly be considered a "Bad Thing". :-)
< SoapBox OFF]

The last part of your question was regarding sending mail from the command line. I don't think many people do this on a regular basis, so it is pretty rare for this to be a concern, especially in a virtual hosting environment where few if any users even have access to a shell. Nevertheless, there is a solution to this problem too. I believe it involves setting up the[A HRef="http://www.Postfix.org/canonical.5.html">canonical table</A> in postfix, which is similar to the sendmail genericstable. This is basically the reverse function of an virtual user / aliases file, so it converts local user names (i.e. username.domain.com) into their preferred e-mail address (i.e. user@domain.com). I believe this is simple to achieve, especially with the regex features in postfix, so I will submit this as a future enhancement request in the bug tracker.

Joe, not to toot my own horn, but I think other people could benefit from this information, especially regarding the New User Wizard plugin in SquirrelMail. Could you add it to the FAQ or documentation? (You can leave out my soap box for now.)

Sun, 06/07/2009 - 06:59 (Reply to #6)
ADobkin

Okay, I've done some testing on my server, and I think I've found the final answer to this problem. The solution is to configure a very simple canonical map in Postfix. This small change rewrites all outgoing mail on the server, including from the command line, webmail, etc. It automatically converts the format as follows:

user.domain.com@domain.com --> user@domain.com

To make this possible, simply add a single line to your Postfix main.cf file:

sender_canonical_maps = regexp:/etc/postfix/sender_canonical.regexp

Then, create the file sender_canonical.regexp with the following line:
/^(.*).([[^.]]*.[[^.]]*)@/ ${1}@${2}

Finally, reload the Postfix configuration with the command:
postfix reload

That's all there is to it! The regular expression above could probably be tweaked, but for now it works like a charm on my system. If anyone sees any problems with this configuration, please let me know.

Sun, 10/29/2006 - 01:32
theseacreaturet...

Hi Alan,
seem like you method is working but the expression needs to be treaked for me hope you can advise me on the appropriate expression modification.

My user's address is displayed as:
tim.tan-testdomain.sg@mail3.testdomain.sg

after applying your expression I get:
tim@tan-testdomian.sg

What I want is:
tim.tan@testdomain.sg

Please advise me Alan, Thanks.

Topic locked