Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Virtual Mailhosting System with Postfix Guide
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
ragarwal
n00b
n00b


Joined: 21 Apr 2005
Posts: 20

PostPosted: Sat Apr 23, 2005 11:30 pm    Post subject: Virtual Mailhosting System with Postfix Guide Reply with quote

http://www.gentoo.org/doc/en/virt-mail-howto.xml

This guid is so screwed up that it is beyond belief that it is still up on Gentoo Forums. :( :(
Spent countless number of hours fighting with this thing!!!! UUUUFFF.. I give up.

Is there a kind soul who could work with me on updating this documentation? I'd be willing to provide my experience and time to update it. I don't conplete understand all of postfix yet, so I need some guidance (minimal).

Thanks,
-Raj
Back to top
View user's profile Send private message
steveb
Advocate
Advocate


Joined: 18 Sep 2002
Posts: 4564

PostPosted: Sun Apr 24, 2005 10:25 am    Post subject: Reply with quote

I am willing to help you. What do you want to change?
Back to top
View user's profile Send private message
tomxaak
n00b
n00b


Joined: 28 Apr 2005
Posts: 5

PostPosted: Thu Apr 28, 2005 12:38 pm    Post subject: courier Reply with quote

the first problem is that the courier daemon is now using authlib, not authdaemon
_________________
all your base are belong to us
Back to top
View user's profile Send private message
steveb
Advocate
Advocate


Joined: 18 Sep 2002
Posts: 4564

PostPosted: Thu Apr 28, 2005 9:40 pm    Post subject: Re: courier Reply with quote

tomxaak wrote:
the first problem is that the courier daemon is now using authlib, not authdaemon

Okay. I don't see this as a very big issue. Anyway... Only section 10.2 needs to be changed. If you compare, then you will see that the change is very minimal:

Code Listing 10.2 wrote:
Next, we need to edit courier's authentication config's.
Code Listing 10.2: Configuring authentication
Code:
# nano -w /etc/courier/authlib/authdaemonrc

Code:
authmodulelist="authmysql authpam"


Code:
# nano -w /etc/courier/authlib/authmysqlrc
Code:
MYSQL_SERVER            localhost
MYSQL_USERNAME          mailsql
MYSQL_PASSWORD          $password
MYSQL_SOCKET            /var/run/mysqld/mysqld.sock
MYSQL_PORT              0
MYSQL_OPT               0
MYSQL_DATABASE          mailsql
MYSQL_USER_TABLE        users
(Make sure the following line is commented out since we're storing plaintext.)
#MYSQL_CRYPT_PWFIELD    crypt
MYSQL_CLEAR_PWFIELD     clear
MYSQL_UID_FIELD         uid
MYSQL_GID_FIELD         gid
MYSQL_LOGIN_FIELD       email
MYSQL_HOME_FIELD        homedir
MYSQL_NAME_FIELD        name
MYSQL_MAILDIR_FIELD     maildir
MYSQL_QUOTA_FIELD       quota


Code:
# /etc/init.d/courier-authlib restart
# /etc/init.d/saslauthd restart


We're almost there I promise! Next, set up the rest of the necessary config's for postfix to interract with the database for all it's other transport needs.



cheers

SteveB
Back to top
View user's profile Send private message
tomxaak
n00b
n00b


Joined: 28 Apr 2005
Posts: 5

PostPosted: Tue May 03, 2005 9:50 pm    Post subject: username to uid Reply with quote

yes, this is exactly what I've already changed

btw. newer version of the howto can be found here:
http://www.etherpunk.com/node/232

but following these instructions, comparing with both
howtos, i got this problem:

<1000@mail.domainxyz.tld> (expanded from <myusername@domainxyz.tld>): unknown user: "1000"

1000 is uid of myusername. But this is the opposite of virtual hosts, no?
advantage of virtual hosts is in omitting usage of uids.

configuration files are set just like in the howto.

In the database I've:

id 1

email myusername@domainxyz.tld

clear somepassword

name blablabla local user

uid 1000

gid 100

homedir /home/vmail/domainxyz.tld/myusername

maildir /home/vmail/domainxyz.tld/myusername/.maildir

quota

postfix y



(domainxyz.tld and mail.domainxyz.tld have been replaced with valid domain with valid mx record of course and
myusername is valid system account with uid 1000 and gid 100)


tail /var/log/mail/current

May 3 23:44:40 [postfix/pickup] 71DF476B3A: uid=0 from=<root>
May 3 23:44:40 [postfix/cleanup] 71DF476B3A: message-id=<20050503214440.GA4522@myhostname.domainxyz.tld>
May 3 23:44:40 [postfix/qmgr] 71DF476B3A: from=<root@mail.domainxyz.tld>, size=391, nrcpt=1 (queue active)
May 3 23:44:40 [postfix/local] 71DF476B3A: to=<1000@mail.domainxyz.tld>, orig_to=<myusername@domainxyz.tld>, relay=local, delay=0, status=bounced (unknown user: "1000")
May 3 23:44:40 [postfix/qmgr] 71DF476B3A: removed
_________________
all your base are belong to us
Back to top
View user's profile Send private message
predisposition
n00b
n00b


Joined: 30 Apr 2005
Posts: 23

PostPosted: Tue May 03, 2005 11:08 pm    Post subject: Reply with quote

steveb: thank you! I was trying to ask the same question earlier but didn't phrase it right -- this change helps me a ton!
_________________
http://predisposition.com/stuff
thank you gentoo community!
Back to top
View user's profile Send private message
predisposition
n00b
n00b


Joined: 30 Apr 2005
Posts: 23

PostPosted: Wed May 04, 2005 11:01 pm    Post subject: Reply with quote

tomxaak...

my set up is now working. Thanks for the link to the newer version of the tutorial -- that one has some better explanations... I have some questions for you regarding your last post...

-is this example user a virtual user? If so, is 1000 the vmail user id?
-in the maildir field you need a slash at the end: maildir /home/vmail/domainxyz.tld/myusername/.maildir/
-in addition to the mail log, check the /var/log/mail.err log to make sure that a proper connection is being made to the database -- I was getting the unknown user error for a while, then I realized I had a typo in my pam_mysql config files that was screwing up the db connection

These are just thoughts -- hth

Sam
_________________
http://predisposition.com/stuff
thank you gentoo community!
Back to top
View user's profile Send private message
tomxaak
n00b
n00b


Joined: 28 Apr 2005
Posts: 5

PostPosted: Thu May 05, 2005 1:43 pm    Post subject: Reply with quote

in fact, I've tried both cases,
existing valid system user and virtual user.

in the case of virtual user:
1) 1000 is the uid of user vmail
2) slash at the end of the path, fixed, nothing has been changed
3) the connection to the db must be working because the system was able to translate the myusername@domainxyz.tld to 1000@dmainxyz.tld, and only record that myusername is mapped to the uid 1000 is in the db

in the case of existing valid system user:
1) 1000 is the uid of system user, not vmail user
2) ..
3) ..
_________________
all your base are belong to us
Back to top
View user's profile Send private message
predisposition
n00b
n00b


Joined: 30 Apr 2005
Posts: 23

PostPosted: Thu May 05, 2005 1:59 pm    Post subject: Reply with quote

is 1000 just a made up number here for example's sake? I'm confused how the system user and the vmail user could both have the same uid... Are there any messages at all in the mail error log?
_________________
http://predisposition.com/stuff
thank you gentoo community!
Back to top
View user's profile Send private message
tomxaak
n00b
n00b


Joined: 28 Apr 2005
Posts: 5

PostPosted: Thu May 05, 2005 3:02 pm    Post subject: Reply with quote

given uids have been generated only for this example of course, in real they are different.
system users have different uid than vmail user. uids of virtual users are mapped to vmail user.

log:

May 5 16:39:50 [postfix/pickup] 52DCB76B3A: uid=0 from=<root>
May 5 16:39:50 [postfix/qmgr] 52DCB76B3A: from=<root@mail.domainxyz.tld>, size=387, nrcpt=1 (queue active)
May 5 16:39:50 [postfix/local] 52DCB76B3A: to=<1000@mail.domainxyz.tld>, orig_to=<myusername@domainxyz.tld>, relay=local, delay=0, status=bounced (unknown user: "1000")
May 5 16:39:50 [postfix/qmgr] 52DCB76B3A: removed

thats all I've in the log related to this email.
Postfix is trying to translate myusername to uid, and that is what I don't understand yet.
_________________
all your base are belong to us
Back to top
View user's profile Send private message
predisposition
n00b
n00b


Joined: 30 Apr 2005
Posts: 23

PostPosted: Thu May 05, 2005 3:23 pm    Post subject: Reply with quote

What do you have in the other mysql tables (besides user)? Is there something in the relocated or virtual table that could be causing this? Also, are you sure the fields are properly identified in the the /etc/postfix/mysql* files? In my set up, I don't have anything in the virtual or relocated tables... I've got three domains. They are all identified as "virtual:" in the transport table, one of my users does have system account, two other test accounts do not and they each work fine. I'm just trying to think what might be different from your installation and mine... do you have separate mail logs? On my system there is "mail.log", "mail.info", "mail.err" and "mail.warn" -- all in /var/log/ -- the useful stuff for me is in mail.err
_________________
http://predisposition.com/stuff
thank you gentoo community!
Back to top
View user's profile Send private message
tomxaak
n00b
n00b


Joined: 28 Apr 2005
Posts: 5

PostPosted: Fri May 06, 2005 10:19 am    Post subject: Reply with quote

solved, my mistake

this was the problem (lame):

mysql-virtual.cf:select_field = uid

instead of

mysql-virtual.cf:select_field = destination

too many configuration files, I've checked all of them for 3 times at least, but this typo..

It was good at least for "forced" understading of how it works,
not just copy&paste from the howto :)

anyway tnx for your time & support
_________________
all your base are belong to us
Back to top
View user's profile Send private message
o5gmmob8
Guru
Guru


Joined: 17 Oct 2003
Posts: 505

PostPosted: Fri May 06, 2005 1:25 pm    Post subject: postfix configuration Reply with quote

Hi guys,

I am running postfix and everything looks like it is working correctly - I can send emails authenticated correctly, but when I send emails to that user (the user is local, but in my mailsql database, I have it setup to be virtual) it puts it in that user's home directory/.maildir. I want all mail regardless if it is local to be put in /home/vmail/domain/user/.maildir so I can then read that email with squirrelmail or an IMAP client.

Is this possible - how do I completely remove local users and setup only virtual ones? Is this supposed to happen by default with the mailsql configuration?


So what I did now is change:

Code:

local_transport = local


to

Code:

local_transport = virtual


However, now it cannot open the maildir because it is a directory not a file.

Thanks,
Walter
Back to top
View user's profile Send private message
rsmereka
n00b
n00b


Joined: 23 Mar 2005
Posts: 18
Location: Southwestern Ontario Canada

PostPosted: Fri May 06, 2005 3:16 pm    Post subject: Reply with quote

I too have been battling with the guide for a couple of months now. I have had to come here to ask questions at times and I must say that even though the guide is very confusing, the community here is great and we end up learning alot. The last issue I had using the old guide was that no remote users were being authenticated. I took the advice of this post and modifed the config for the alternate guide at:
http://www.etherpunk.com/node/232
Here is what I am getting now:
Code:
May  5 15:54:56 nereid authdaemond: modules="authmysql authpam", daemons=5
May  5 15:54:56 nereid authdaemond: Installing libauthmysql
May  5 15:54:56 nereid authdaemond: libauthmysql.so: cannot open shared object file: No such file or directory
May  5 15:54:56 nereid authdaemond: Installing libauthpam
May  5 15:54:56 nereid authdaemond: Installation complete: authpam
May  5 15:55:00 nereid postfix/postfix-script: starting the Postfix mail system
May  5 15:55:00 nereid postfix/master[1709]: daemon started -- version 2.1.5
May  5 15:55:00 nereid saslauthd[1762]: detach_tty      : master pid is: 1762
May  5 15:55:00 nereid saslauthd[1762]: ipc_init        : listening on socket: /var/lib/sasl2/mux

Authdaemond can't find the mysql libauth module. Where do I get this from? The alternate guide seems to be generic since it does not discuss installation or any Gentoo specific stuff like the USE variable. My current USE is:
Code:
USE="sasl ssl perl mysql pam-mysql imap libwww apache2 maildir pam xml xml2 vda"

Any ideas on how I can correct this?
cheers,
Rick
_________________
Linux Registered User #371570
http://counter.li.org/
"In the maze of abstraction, there is only one reality"
Back to top
View user's profile Send private message
rsmereka
n00b
n00b


Joined: 23 Mar 2005
Posts: 18
Location: Southwestern Ontario Canada

PostPosted: Fri May 06, 2005 3:56 pm    Post subject: Reply with quote

[solved] I found the problem. I needed to re-
Code:
emerge courier-authlib

since the new guide changes (or is it corrects) the way that authentication takes place.

Rick
_________________
Linux Registered User #371570
http://counter.li.org/
"In the maze of abstraction, there is only one reality"
Back to top
View user's profile Send private message
o5gmmob8
Guru
Guru


Joined: 17 Oct 2003
Posts: 505

PostPosted: Fri May 06, 2005 3:59 pm    Post subject: libauthmysql.so Reply with quote

Hi,

Normally when you get those errors, it means that you have compiled in support for mysql authentication, but the library has since been removed. If you didn't have mysql during compilation, it would have removed support, and you wouldn't get that error message about the library being missing.

I would recommend that you look for both mysql and pam_mysql (via emerge -s), also make sure the latest version is installed.

I see you fixed the problem, I knew it was one of those packages.


Walter
Back to top
View user's profile Send private message
o5gmmob8
Guru
Guru


Joined: 17 Oct 2003
Posts: 505

PostPosted: Fri May 06, 2005 11:49 pm    Post subject: virtual users' mailboxes Reply with quote

Hi,

I figured out my problem, so postfix has several options apparently. When doing virtual users, if the maildir in the mailsql database (or text file) has an ending slash: /home/vmail/domain/user/.maildir/, then the format of the mailbox is UNIX maildir. In my mailsql database, I did not have the trailing slash and it wanted to use the path as the location of the textfile for mbox format.


Walter
Back to top
View user's profile Send private message
Nazadus
n00b
n00b


Joined: 20 Aug 2004
Posts: 20
Location: Groves, Texas, USA, Earth, Sol, Milky Way

PostPosted: Thu May 26, 2005 2:43 pm    Post subject: Reply with quote

I'm the orginal creator of etherpunnk and the person updating that page.
Here is the wiki page:

http://gentoo-wiki.com/HOWTO_Linux_Virtual_Hosting_Server

I bring this up becuase I'm updating my website and the node number won't be the same...
Back to top
View user's profile Send private message
rprescott
n00b
n00b


Joined: 09 Apr 2004
Posts: 16

PostPosted: Thu Jun 09, 2005 12:15 am    Post subject: Reply with quote

Hi There,

I followed this guide exactly http://www.gentoo.org/doc/en/virt-mail-howto.xml but, I have one problem virtual users are not getting their mail delieved to their mailbox while non-virtual users are?

This something with courier-imap and Im not sure what. But its driving me nutts any help would be great!

Thanks,
Rob
Back to top
View user's profile Send private message
Nazadus
n00b
n00b


Joined: 20 Aug 2004
Posts: 20
Location: Groves, Texas, USA, Earth, Sol, Milky Way

PostPosted: Thu Jun 09, 2005 3:14 am    Post subject: Reply with quote

Could be any number of things.
Firstly, try running 'postconf -n' to get a list of all your variables.
Check for spelling.
If you believe the vars to be right (which, if you've never set this up before you don't really know... you just have to guess/hope) then the enxt thing to do is to add verbosity to your logs.
Open up /etc/postfix/master.cf
Lines are in a format like this:
Code:

smtp      inet  n       -       n       -       -       smtpd


Add a -v (or -vv for extra verbosity) to the right variable to make:

Code:

smtp      inet  n       -       n       -       -       smtpd -vv


This will add extra verbosity to your /var/log/messages log file.
You can add the '-vv' to many of those, but the main ones are:
smtpd, smtp (all of them), local, and virtual

This will probably help you determine where the problem is happening (for example, it might fail on the SQL lookups... or it might fail due to permissions, etc)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum