Configuring Virtualmin to work with Postfix

18 posts / 0 new
Last post
#1 Thu, 03/01/2007 - 16:14
kcackler

Configuring Virtualmin to work with Postfix

Hi everyone! I'm completely new to managing my own server (moved from shared to reseller to managed VPS to unmanaged dedicated) and I'm trying to configure virtualmin to work with postfix. I've got it working absolutely beautifully with everything else, but am stuck on postfix configuration.

When I create an email address in virtualmin, it adds the mail dir (For example, for kevin@thatscriptguy.com it adds the following directory: /home/thatscri/homes/kevin)

But when I attempt to send a mail to that address, postfix bounces it back. So obviously postfix is working - it just isn't configured correctly in regards to the usermap.

Tell me what you need to know to help me fix this Thanks! Kevin

Thu, 03/01/2007 - 16:30
kcackler

Also - when I go to compose an email from within webmin, the reply-to address is kevin.thatscri@thatscriptguy.com

Obviously I want the created email address to be kevin@thatscriptguy.com (perhaps why postfix bounced it?)

Kevin

Thu, 03/01/2007 - 18:10
kcackler

OK, an update here:

Mail sent to kevin.thatscri@thatscriptguy.com gets delivered to /var/mail
Mail sent to kevin@thatscriptguy.com gets bounced back as an unknown user...

Thu, 03/01/2007 - 17:39
JohnFord

This is a setting that can be changed.

Browse to:
Virtualmin/System Settings/Module Config/Defaults for New Domains - if your using the standard theme the "Defaults for New Domains" will be an option in the drawdown selections box.

Find the setting named:
Include domain name in usernames? - set this to "Only if there is a clash" - it's probably not set to "Always" or maybe you have a clash with some other username.

You might have made your administrator "kevin" instead of the default and so when you made one for you it was already present and so added the $PREFIX (first part of domain name) to the username.

Don't forget you can click for help on almost every setup option on the setup and template pages for helpful information about the setup option.

I hope that helps

Thu, 03/01/2007 - 17:47
JohnFord

I should have read my post for typos.

I mean it probably is [list]
<b>now</b>[/list]
set to "Always".

Also there is a setting in the "Default Template" that addresses this issue but it does not come into effect unless this setting dictates.

---------------------------------

What I was saying about the adminstration email/user is because when you create a domain the adminstation user is created on the system and if you change it from the default - which is the $PREFIX of the domain name or the first part of the domain name. To someone, like "Kevin", then kevin is already a user and virtualmin will have to append (or change somehow) the username because you cannot have two of the same usernames.

Thu, 03/01/2007 - 18:16
kcackler

AHA. That default setting was it.

Now for the next question: I'm moving several hundred accounts from a cpanel server (login user@domain) to this server. the user@domain user format allows each domain to have any email address. Is there any way to set this up on webmin/virtualmin/postfix? IE kevin@thatscriptguy.com AND kevin@thecacklers.com can co-exist?
Kevin

Thu, 03/01/2007 - 18:37
JohnFord

the next setting below the "always" one addresses this issue. be sure to mouse over the name of setting and you can click it for help on each setting.

Thu, 03/01/2007 - 18:49
kcackler

Hmm...none of my setting titles are clickable....Is there an alternate theme that offers help for all of the settings?

The setting under the always one is

Domain name style in username
and the choices are
Full domain name
Username or first part of domain
First part of domain

None of those seem like they'd offer the ability to have user@domain (I'm sure I'm wrong though) :)

Thu, 03/01/2007 - 19:27
JohnFord

I just made one myself. You caught me when I was trying to figure this out too.

I'm still trying to figure it out. I believe you'll want the FULL NAME option and set it back to "Always".

Then browse to the "System Settings/Server Templates/Default Settings - (If the Default Settings template is the one affecting your domains that you are trying to setup).

Then go to the "Mail for domain" page and set the option in "Format for usernames that include domain" to "username@domain".

Then you'll get what you want. The problem that just happened to me is that two user with same UID were created. I don't know why or how it happened or if it works. I have two browser windows open on separate machines and don't know if I clicked to quit to see changes or if deleting the same user over and over until I get it right causes issues.

I think that maybe it has something to do with my operating system (Fedora 6) and a user name with the @ symbol. I will keep playing with it.

I need the same username under separate domains too. You can also have alias once you get them set up correctly. That is my plan after I'm finished creating them.

Here's what the help windows say for the option we've been discussing.

under default templates/email for domain:
<b>Format for usernames that include domain</b>
------------------------------------------------------------
When a username has the domain name appended, this option selects the format. Not all options are available on all OS platforms, as some characters are not allowed in usernames. Whether the domain name is the full username, i.e. "virtualmin.com", or just the first part, i.e. "virtualmin", is dictated by the next option.

------------------------------------------------------------

under module config/default for new domains:
Include domain name in usernames?

--------------------------------------------------------------------------------
This option selects how usernames will be generated. By default, Virtualmin will use the base username requested, but if it clashes with an existing username it will append the domainname in the manner specified in the next option. If consistency is preferable, set this to "Always", and all usernames within sub-servers will have the domain name appended.

--------------------------------------------------------------------------------

Domain name style in usernames

--------------------------------------------------------------------------------
This option determines whether the domain name used in usernames that contain the domain will be the full domain name, i.e. "virtualmin.com", just the first part, i.e. "virtualmin", or the user/group name for the domain. By default, the group name is used for new top-level servers, and the first part of the domain is used for sub-servers.
In some environments, it may be easier for users to understand a username like "joeuser@virtualmin.com" for their POP/IMAP or FTP login name than "joeuser.virtualmin".
---------------------------------------

I am using the "Virtualmin Framed Theme" which provides help links under the titles of each option.

Thu, 03/01/2007 - 19:27
kcackler

OK, I found the online docs and read up in chapter 6, but my changes still aren't taking affect.

I've got the following set in the module config:

Include domain names in usernames: Always
Domain name style in username: Full domain

But when I create a new email user (kevin@thatscriptguy.com) the username is still created as kevin.thatscri

I don't see any other settings in the module config that control how usernames are created, so I'm really puzzled here...

Kevin

Thu, 03/01/2007 - 19:28
kcackler

Eww...I'm using FC6 too. Hopefully we can get this sorted out...
Kevin

Thu, 03/01/2007 - 19:31
kcackler

Just installed the framed theme - beautiful....

I'm heading out for an hour or so, but when I get back I can hopefully nail this down. I've got to get it working like I need it

Thanks for your help so far!

Thu, 03/01/2007 - 20:08
JohnFord

Hello Kevin,

It looks like you set it ok. But still need to do the important part I was telling you about in the "Default Template"

It is the place to where you can select the format "kevin@somedomain.com"

Thu, 03/01/2007 - 21:16
kcackler

Yup - already set up the default template and it looks like it's going to work great. Now I just need to configure dovecot to connect and maybe we'll be OK :)

Thu, 03/01/2007 - 22:41
kcackler

OK, I've got a bit of an issue here....

Slowly but surely we're getting there, but I've run into a bit of a snag..

I sent an email to kevin@thatscriptguy.com and instead of being delivered to /var/mail/kevin@thatscriptguy.com it was delivered to /var/mail/kevin-thatscriptguy.com

So when I'm in virtualmin looking at email accounts, it shows that kevin@thatscriptguy.com has no mail..

Any ideas here? Is there a setting to tell it to deliver to kevin@thatscriptguy.com or to tell virtualmin (and dovecot) to look at kevin-thatscriptguy.com?
Kevin

Sun, 06/07/2009 - 07:01
kcackler

SWEET! Just figured out (by myself too) how to configure dovecot to use user-domain to check email.

I just added the following line to dovecot.conf:

mail_location = mbox:~/mail:INBOX=/var/mail/%n-%d

It seems to work OK (and I'm sure there are caveats..there usually are)

Sun, 06/07/2009 - 07:01
kcackler

SWEET! Just figured out (by myself too) how to configure dovecot to use user-domain to check email.

I just added the following line to dovecot.conf:

mail_location = mbox:~/mail:INBOX=/var/mail/%n-%d

It seems to work OK (and I'm sure there are caveats..there usually are)

Fri, 03/02/2007 - 04:34
Joe
Joe's picture

Hey Kevin,

Your solution works, and good on you for getting it figured...Or, you could just login with the @ in the username. Dovecot doesn't mind, and should go for the right mailbox.

Postfix is the only package in the stack that really doesn't like the @ in a username, and that's why Virtualmin will create two users when using Postfix and @ in the username. Oh, I guess SASL also doesn't like it. But you can force it to work with them...there's a FAQ about that one:

http://www.virtualmin.com/faq/one-faq?faq_id=1511#51230

(Second paragraph, specifically.)

We never ran into the spool dichotomy problem with Virtualmin Professional because we use Maildir (Maildirs are stored in the users home directory, so their is no difference between user-domain and user@domain.com since they share /home/domain/homes/user-domain for home. You might consider going the Maildir route. It's faster, lives in /home (which resolves some quota issues on many systems, and makes backups simpler), and I've found it to be a more robust format. My old mailbox on an old server running with mbox spools broke down a few weeks ago at about 20000 messages and I haven't been able to fix it (admittedly, I haven't actually spent any time on trying to fix it...but I grumble about it sometimes, and it hasn't helped). My Virtualmin box has even more than that and hums along like there's nothing wrong with the world.

--

Check out the forum guidelines!

Topic locked