View Full Version : "Virtual Users And Domains With Postfix, Courier And MySQL (Ubuntu 6.10 Edgy Eft)"
4integration
1st June 2007, 11:05
Hello,
I have tested the howto "Virtual Users And Domains With Postfix, Courier And MySQL (Ubuntu 6.10 Edgy Eft)" @ http://www.howtoforge.com/virtual_postfix_mysql_quota_courier_ubuntu_edgy but on my Feisty Fawn.
Adding domains/users to the mail system is it only necessary to add them to the tables? Does it require changes to the file system as well, in the /home/vmail/?? I think so since I get this in the logs:
Jun 1 10:17:51 vm-mail imapd: chdir mydomain.com/testuser/: No such file or directory
It's not covered in the howto...
Should I create anything manually?
What should I create?
What permissions (group/user) should the files/directories have?
falko
2nd June 2007, 15:36
Adding domains/users to the mail system is it only necessary to add them to the tables?Yes.
Does it require changes to the file system as well, in the /home/vmail/??No.
Please compare your setup again with the one from the tutorial. Maybe you've made a typo somewhere.
fchevitarese
13th June 2007, 17:50
Hello all ... i´m in the same tutorial... all things are getting work but now i have one problem!
After amavisd instalation, the tutorial ask me to type netstat -tap and it should be show this :
root@server1:/usr/local/sbin# netstat -tap
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 localhost.localdo:10024 *:* LISTEN 16043/amavisd (mast
tcp 0 0 localhost.localdo:10025 *:* LISTEN 15794/master
tcp 0 0 localhost.localdo:mysql *:* LISTEN 4783/mysqld
tcp 0 0 *:smtp *:* LISTEN 15794/master
tcp6 0 0 *:imaps *:* LISTEN 13452/couriertcpd
tcp6 0 0 *:pop3s *:* LISTEN 13517/couriertcpd
tcp6 0 0 *:pop3 *:* LISTEN 13480/couriertcpd
tcp6 0 0 *:imap2 *:* LISTEN 13412/couriertcpd
tcp6 0 0 *:www *:* LISTEN 4489/apache2
tcp6 0 0 *:ssh *:* LISTEN 3193/sshd
the thing that i have marked whit red is my problem... This sh.... is not showed when i type the command!
I have already done all the things again... but the problem persists!
Can anyone help me?
What i have to do?!
Thanks!!!
:confused:
falko
14th June 2007, 22:37
Did you modify /etc/postfix/master.cf as shown in the tutorial? Did you restart Postfix?
4integration
22nd June 2007, 12:08
Please compare your setup again with the one from the tutorial. Maybe you've made a typo somewhere.
I have compared the installation with the tutorial but can not find anything strange.
What configuration handles the creation of the mailbox directory?
I created the directory /home/vmail/mydomain.com/testuser (owned by vmail user).
Then when I connect the mail client it creates the .Trash folder:
drwx------ 6 vmail vmail 4096 2007-06-22 11:15 .Trash
and the client (Thunderbird) says:
"The current command did not succeed: The mail server responded: Unable to open this mailbox"
Any idea?
till
22nd June 2007, 12:48
Please post the output of:
ls -la /home/vmail/mydomain.com/testuser
and
ls -la /home/vmail/mydomain.com/
4integration
22nd June 2007, 13:31
sh-3.2$ ls -al /home/vmail/mydomain.com/
total 12
drwxr-xr-x 3 vmail vmail 4096 2007-06-22 11:15 .
drwxr-xr-x 3 vmail vmail 4096 2007-06-22 11:14 ..
drwxr-xr-x 3 vmail vmail 4096 2007-06-22 11:15 testuser
sh-3.2$ ls -al /home/vmail/mydomain.com/testuser/
total 12
drwxr-xr-x 3 vmail vmail 4096 2007-06-22 11:15 .
drwxr-xr-x 3 vmail vmail 4096 2007-06-22 11:15 ..
drwx------ 6 vmail vmail 4096 2007-06-22 11:15 .Trash
Also worth to mention is that this installation is running in a VMWare Workstation with KUbuntu Feisty Fawn (updated) with internal IP 192.168.1.10 for evaulation. The "production" mail server runs on 192.168.1.2 and mail ports are forwarded from the firewall to 192.168.1.2.
The mail accounts for test are configured to use 192.168.1.10 and not mail.mydomain.com which the real accounts are using.
falko
23rd June 2007, 21:58
The permissions look ok... :confused:
4integration
24th June 2007, 11:58
Shouldn't the file /etc/postfix/main.cf be one of the key files here?
When are Postfix notitfied to create the mailbox, when the domain/user are inserted into the DB postfix are not aware so I assume that it should be created at the first login try, right?
EDIT: Sorry it should of course be one of the Courier files such as /etc/courier/authmysqlrc
4integration
24th June 2007, 20:23
Sorry, but I have to admit one thing. I have left out one step "3 Apply The Quota Patch To Postfix".
Falko: Do you think that this could cause my problem?
Which creates the mail dirs, Postfix or Courier?
4integration
25th June 2007, 00:34
Hi,
Some good news from my labs..
I installed the quota patch according to http://www.howtoforge.com/virtual_users_and_domains_with_postfix_debian_etch (due to matching versions)
Then I also compared the configuration and found some differences on Saslauthd so I updated the configuration and now things are happening.
http://www.howtoforge.com/virtual_users_and_domains_with_postfix_debian_etch _p3
I will test things out...
One thing I noticed very quickly was the structure used in Thunderbird...
<account>
+ Inbox
+ Draft
+ Sent
+ Trash
I would like it to be ...
<account>
+ Inbox
+ Draft
+ Sent
+ Trash
How can I control that?
jimflip
27th June 2007, 14:07
I am also getting a very similar problem.
Basically it's not creating the user directory in /home/vmail/mydomain.com
Should this be done by saslauthd?
My /etc/default/saslauthd file was incorrect at first, I have now adjusted this but still the problem persists.
Any help would be very useful.
Thanks,
Jim.
jimflip
27th June 2007, 14:21
Actually my /etc/default/saslauthd file was correct.
Don't help me though :(
jimflip
27th June 2007, 14:53
Actually my /etc/default/saslauthd file was correct.
Don't help me though :(
jimflip
27th June 2007, 19:35
Found the solution:
You need to send an email to the user before the user can login. The maildir isn't created until an email is sent to that user.
Jim.
4integration
27th June 2007, 21:20
Yes, I found that too ...after a lot of testing :)
Maybe it's possible to have a script that insert the user (+ ev. domain) and then sends a welcome email...to overcome this.
Falko: Any input on this?
fowie
11th September 2007, 03:44
This thread sounds like the same problem I'm having. First off my maildirs in /var/vmail are not being created? Which file would cause that? Second, you mentioned having to send an email to the user, do I need to do that locally on the server, or will any email directed to the user@mydomain.com work?
Third, and slightly more complex,
I was originally using postfix and dovecot and had a user already set up on the server. I removed dovecot and installed courier & followed the tutorial step by step. When I send an email to myuser it gets sent to /var/mail/myuser instead of being put into the /home/vmail/mydomain.com/myuser folder where I believe it should go? When I connect via imap I still see the messages I received before I set up courier, but the new messages I send don't show up?
Fourth, and again slightly more complex,
I was using squirrelmail with dovecot and postfix, now after this install I get:
ERROR: Connection dropped by IMAP server. when I log in (if I log in with an incorrect user I get the expected "Username/Password invalid" message, so I know it's authenticating with the DB.
Any help would be appreciated. I enjoyed the tutorial though, good job.
falko
12th September 2007, 20:54
or will any email directed to the user@mydomain.com work?Any email will work.
Third, and slightly more complex,
I was originally using postfix and dovecot and had a user already set up on the server. I removed dovecot and installed courier & followed the tutorial step by step. When I send an email to myuser it gets sent to /var/mail/myuser instead of being put into the /home/vmail/mydomain.com/myuser folder where I believe it should go? When I connect via imap I still see the messages I received before I set up courier, but the new messages I send don't show up?What's in /etc/postfix/main.cf?
Fourth, and again slightly more complex,
I was using squirrelmail with dovecot and postfix, now after this install I get:
ERROR: Connection dropped by IMAP server. when I log in (if I log in with an incorrect user I get the expected "Username/Password invalid" message, so I know it's authenticating with the DB.
Any errors in your mail log and auth log? What's the output of netstat -tap?
fowie
12th September 2007, 21:01
So a slight recommendation. On the first page you talk about applying the "quota" patch to postfix. Since I didn't want quotas I didn't originally install the patch, hence nothing worked correctly. My guess is that the patch does more than just patch quotas?
That problem with sending to the old mail folders was because dovecot wasn't completely removed (got rid of dovecot, missed dovecot-common).
The squirrelmail problem was also with the folders not being created (which are created automatically now, thank you), once the folders were created correctly squirrelmail works great. Thanks for the tutorial, works like a charm!
fowie
13th September 2007, 18:40
My system seems to be working, but it looks as if I'm only receiving emails that are sent locally, none from remote hosts. (I.e. only if I use the sendmail command from the command line). It would appear that my emails sent using any other system just disappear into the big void.
Also, I've noticed that I used to get emails about the status of a few custom cron jobs I had running. Now I don't receive those. When I log in I still get a notification that I have new mail in /var/mail/fowie and when I less that file I see the new message, but that message never shows up in my inbox via my mail client or via squirrelmail. My /etc/aliases is pointing to my fowie@domain.com account, so I'm not sure why mail is still getting stuck in there? Any why can't I receive mail from outside email sources?
netstat -tap returns:
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 localhost:10024 *:* LISTEN 17987/amavisd (mast
tcp 0 0 localhost:10025 *:* LISTEN 18155/master
tcp 0 0 localhost:57417 *:* LISTEN 5200/hpiod
tcp 0 0 localhost:mysql *:* LISTEN 5935/mysqld
tcp 0 0 localhost:ipp *:* LISTEN 20813/cupsd
tcp 0 0 *:smtp *:* LISTEN 18155/master
tcp 0 0 localhost:40316 *:* LISTEN 5209/python
tcp 0 0 localhost:53586 localhost:57417 ESTABLISHED5209/python
tcp 0 0 localhost:57417 localhost:53586 ESTABLISHED5200/hpiod
tcp6 0 0 *:imaps *:* LISTEN 8838/couriertcpd
tcp6 0 0 *:pop3s *:* LISTEN 8733/couriertcpd
tcp6 0 0 *:pop3 *:* LISTEN 16831/couriertcpd
tcp6 0 0 *:imap2 *:* LISTEN 16807/couriertcpd
tcp6 0 0 *:www *:* LISTEN 2895/apache2
tcp6 0 0 *:ssh *:* LISTEN 6075/sshd
falko
13th September 2007, 19:24
My system seems to be working, but it looks as if I'm only receiving emails that are sent locally, none from remote hosts. (I.e. only if I use the sendmail command from the command line). It would appear that my emails sent using any other system just disappear into the big void.Please check that the MX record for yout domain points to the right server: dig mx yourdomain.com
Also, I've noticed that I used to get emails about the status of a few custom cron jobs I had running. Now I don't receive those. When I log in I still get a notification that I have new mail in /var/mail/fowie and when I less that file I see the new message, but that message never shows up in my inbox via my mail client or via squirrelmail. My /etc/aliases is pointing to my fowie@domain.com account, so I'm not sure why mail is still getting stuck in there?
It seems that mails for system users are sent to mbox instead of Maildir. What's the output of postconf -n?
fowie
13th September 2007, 19:34
postconf -n returns:
broken_sasl_auth_clients = yes
config_directory = /etc/postfix
content_filter = amavis:[127.0.0.1]:10024
mydestination = localhost, localhost.localdomain
myhostname = ******.com
mynetworks = 127.0.0.0/8
proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps
receive_override_options = no_address_mappings
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_tls_cert_file = /etc/postfix/smtpd.cert
smtpd_tls_key_file = /etc/postfix/smtpd.key
smtpd_use_tls = yes
transport_maps = proxy:mysql:/etc/postfix/mysql-virtual_transports.cf
virtual_alias_domains =
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf
virtual_create_maildirsize = yes
virtual_gid_maps = static:5000
virtual_mailbox_base = /home/vmail
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
virtual_mailbox_limit_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailbox_limit_maps.cf
virtual_mailbox_limit_override = yes
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf
virtual_maildir_limit_message = "The user you are trying to reach is over quota."
virtual_overquota_bounce = yes
virtual_uid_maps = static:5000
I didn't have the mx record, so I just fixed that. I'll let you know what happens.
fowie
13th September 2007, 19:44
I can admit it. Anyway, the MX record solved that problem with external mail. Now if I can just get it to deliver my /etc/aliases mail from root and others, I'll be set....
fowie
17th September 2007, 19:02
Falco,
Everything else seems to be working...thanks for the help. I understand I'll need to add that home_mailbox parameter to my main.cf, but I'm not sure what it should be since my mail directories are all located under /home/vmail now?
Fowie
falko
18th September 2007, 19:40
All you need is
virtual_mailbox_base = /home/vmail:)
fowie
18th September 2007, 20:26
I've got that in my main.cf, but I'm still not getting those mails. Here's my postconf -m:
broken_sasl_auth_clients = yes
config_directory = /etc/postfix
content_filter = amavis:[127.0.0.1]:10024
mydestination = localhost, localhost.localdomain
myhostname = myhostname.com
mynetworks = 127.0.0.0/8
proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps
receive_override_options = no_address_mappings
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_tls_cert_file = /etc/postfix/smtpd.cert
smtpd_tls_key_file = /etc/postfix/smtpd.key
smtpd_use_tls = yes
transport_maps = proxy:mysql:/etc/postfix/mysql-virtual_transports.cf
virtual_alias_domains =
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf
virtual_create_maildirsize = yes
virtual_gid_maps = static:5000
virtual_mailbox_base = /home/vmail
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
virtual_mailbox_limit_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailbox_limit_maps.cf
virtual_mailbox_limit_override = yes
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf
virtual_maildir_limit_message = "The user you are trying to reach is over quota."
virtual_overquota_bounce = yes
virtual_uid_maps = static:5000
falko
19th September 2007, 16:06
Are the mails you're not receiving for virtual users of for system users?
fowie
19th September 2007, 17:03
The mails I'm not receiving are the report emails from some of my cron jobs. They're being emailed to root, my /etc/aliases file redirects like this:
root: postmaster
clamav: root
postmaster: myemail@mydomain.com
falko
20th September 2007, 16:20
And is myemail@mydomain.com a virtual account on the server, or is it an account on a remote system?
fowie
20th September 2007, 17:10
It's a virtual account. myemail is an actual user on the system though, and it's /var/mail/myemail where the cron status emails are currently getting sent to.
falko
21st September 2007, 19:00
myemail is an actual user on the system though
Ok, that is the problem. Do you use mydomain.com in the mydestination line in main.cf?
fowie
21st September 2007, 19:40
No, I don't have myhostname.com in the mydestination field, it's just
mydestination = localhost, localhost.localdomain
falko
22nd September 2007, 13:25
Does it work if you specify another email address (that isn't identical with a system user in the left part)?
fowie
24th September 2007, 17:35
No, that doesn't seem to fix it. I chaned my aliases to look like:
# Added by installer for initial user
root: postmaster
clamav: root
postmaster: info@myhostname.com
and ran newaliases but checking the email for info using squirrelmail doesn't show me getting any new emails. They're not being delivered to /var/mail/ anymore though either. Now I really have no idea where they are going.
falko
25th September 2007, 21:28
What's in the mail log when a mail gets sent to root?
fowie
25th September 2007, 22:30
I did a sendmail root and sent a test message from the command line and this is what the log shows (mail.info, mail.err did not have anything in it from this command):
Sep 25 13:25:32 localhost postfix/pickup[19012]: D838A7E5CA: uid=1000 from=<fowie>
Sep 25 13:25:32 localhost postfix/cleanup[19082]: D838A7E5CA: message-id=<20070925192532.D838A7E5CA@myhost.com>
Sep 25 13:25:32 localhost postfix/qmgr[21477]: D838A7E5CA: from=<fowie@myhost.com>, size=308, nrcpt=1 (queue active)
Sep 25 13:25:42 localhost postfix/qmgr[21477]: CDB697E5CB: from=<fowie@myhost.com>, size=712, nrcpt=1 (queue active)
Sep 25 13:25:42 localhost amavis[4981]: (04981-09) Passed CLEAN, <fowie@myhost.com> -> <root@myhost.com>, Message-ID: <20070925192532.D838A7E5CA@myhost.com>, mail_id: QshtS7RgLL7w, Hits: 2.167, 9997 ms
Sep 25 13:25:43 localhost postfix/smtp[19083]: D838A7E5CA: to=<root@myhost.com>, orig_to=<root>, relay=127.0.0.1[127.0.0.1], delay=11, status=sent (250 2.6.0 Ok, id=04981-09, from MTA([127.0.0.1]:10025): 250 Ok: queued as CDB697E5CB)
Sep 25 13:25:43 localhost postfix/qmgr[21477]: D838A7E5CA: removed
Sep 25 13:25:43 localhost postfix/virtual[19093]: CDB697E5CB: to=<root@myhost.com>, relay=virtual, delay=1, status=bounced (unknown user: "root@myhost.com")
Sep 25 13:25:43 localhost postfix/cleanup[19082]: 14D317E5CA: message-id=<20070925192543.14D317E5CA@myhost.com>
Sep 25 13:25:43 localhost postfix/qmgr[21477]: 14D317E5CA: from=<>, size=2273, nrcpt=1 (queue active)
Sep 25 13:25:43 localhost postfix/qmgr[21477]: CDB697E5CB: removed
Sep 25 13:25:43 localhost postfix/virtual[19093]: 14D317E5CA: to=<fowie@myhost.com>, relay=virtual, delay=0, status=sent (delivered to maildir)
Sep 25 13:25:43 localhost postfix/qmgr[21477]: 14D317E5CA: removed
I noticed that it automatically tried to send the mail I sent to root to root@myhost.com, but I can't put an entry
root@myhost.com: postmaster
in my /etc/aliases file.
falko
26th September 2007, 16:53
Do you use your hostname (myhost.com) for virtual email addresses? If so, you should change your hostname in /etc/postfix/main.cf.
fowie
26th September 2007, 17:01
Yes, I do use my hostname for virtual email addresses. Mostly only because I didn't know it was possible to have emails for users with my hostname not be virtual addresses. What would I change my hostname to? I tried changing it to mail.myhostname.com but I still get a bounce message in my mail.info:
Sep 26 07:57:28 localhost postfix/smtp[21338]: warning: numeric domain name in resource data of MX record for mail.myhost.com: 2my.ip.add.ress
Sep 26 07:57:28 localhost postfix/smtp[21329]: C80337E5CA: to=<root@mail.myhost.com>, orig_to=<root>, relay=127.0.0.1[127.0.0.1], delay=8, status=sent (250 2.6.0 Ok, id=04982-08, from MTA([127.0.0.1]:10025): 250 Ok: queued as B4FBB7E5CB)
Sep 26 07:57:29 localhost postfix/qmgr[21317]: C80337E5CA: removed
Sep 26 07:57:29 localhost postfix/smtp[21338]: B4FBB7E5CB: to=<root@mail.myhost.com>, relay=none, delay=1, status=bounced (mail for mail.myhost.com loops back to myself)
Sep 26 07:57:29 localhost postfix/cleanup[21325]: 15CBB7E5CA: message-id=<20070926135729.15CBB7E5CA@mail.myhost.com>
Sep 26 07:57:29 localhost postfix/qmgr[21317]: 15CBB7E5CA: from=<>, size=2421, nrcpt=1 (queue active)
Sep 26 07:57:29 localhost postfix/qmgr[21317]: B4FBB7E5CB: removed
Sep 26 07:57:29 localhost postfix/smtp[21338]: warning: numeric domain name in resource data of MX record for mail.myhost.com: my.ip.add.ress
Sep 26 07:57:29 localhost postfix/smtp[21338]: 15CBB7E5CA: to=<fowie@mail.myhost.com>, relay=none, delay=0, status=bounced (mail for mail.myhost.com loops back to myself)
Sep 26 07:57:29 localhost postfix/qmgr[21317]: 15CBB7E5CA: removed
Another interesting point. Through the process of this conversation I tried chaning my /etc/aliases file so that
postmaster: fowdawgg[at]gmail[dot]com
so it's not going to a local box and I'm still not getting those cron emails sent to me?
--EDIT--
I think I've got it now. I had forgotten about the forwardings table in mysql. I was changing the forwardings in /etc/aliases but didn't have an entry in the forwarding table for root@myhost.com
I'll let you know if that works.
--Update--
Yep, works great. Getting all my emails. Thanks for the help!
ruan567
27th September 2007, 11:37
Hi everybody
I have a similar setup to this - (i just used the tutorial for Dapper Drake) - and now I am wondering how to get the transports table to point to a php script on a regex match for a whole domain? I wish to filter subject lines for a specific clause and if I get a match not pass on the e-mail but reply with php's mail() function. If I don't get a match the mail should go directly to the user's inbox like normal.
I did a man transport but it seems like there isn't really any method for pointing to a file - the regex bit is supported though.
Anybody have any ideas?
Ruan
falko
27th September 2007, 16:56
Maybe you can do this with Postfix filters...
http://www.postfix.org/FILTER_README.html
ruan567
28th September 2007, 05:41
Thanks I already had a look at that - seemed a bit like overkill :)
There must be another way - but since I can't seem to find it I'll probably have to go this route.
Will write a tutorial for howtoforge as I go along...
Ruan
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.