Postfix and Postfix Admin's MySQL databases

Hi all,

I followed the instructions here:

http://library.linode.com/email/postfix … l-centos-5">http://library.linode.com/email/postfix/dovecot-mysql-centos-5

to configure Postfix to work with MySQL and Dovecot before discovering PostfixAdmin.

Since I had created MySQL database for managing virtual domains and users already..

My question now is: is there anyway to make all these work with Postfix admin/Postfix Admin's database for the creationg and use of virtual users/mailboxes?

Thanks.

5 Replies

Yes, there is. It's been a long time since I set it up, though so the details are a bit murky. I seem to recall postfixadmin providing sample scripts in the download for adding/deleting users/mailboxes, etc.

Sorry, I don't mean to be a smart-ass; I just remember being in your shoes. I followed that guide, then skipped the guide's mysql setup and followed postfixadmin's.

Hi @derfy

Your post was helpful, really.

So, if I decided to use Postfixadmin for administering virtual users/domains how do I tell postfix/dovecot to use Postfixadmin's database instead?

(…bearing in mind I have carried out all the settings on http://library.linode.com/email/postfix … l-centos-5">http://library.linode.com/email/postfix/dovecot-mysql-centos-5 )

How did you do it?

Can you remember?

(since you too had carried out all the other steps in that guide to configure Postfix to work with Dovecot and MySQL on CentOS).

Again, many thanks.

I really appreciate any help I can get here.

Here's a start: http://pastebin.com/tQVeYi6q

If I remember anything noteworthy, I'll add it.

Updated with dovecot values; I think you should have most of the required ones.

Hi @defry

Thanks for you help. I think I have been able to pull it off.

I followed your lead in giving postfix UID of 640, so I did:

I did [root@myserver1 ~]# usermod -u 640 postfix

..and it resulted in the following in the /var/log/maillog files:

May 17 20:22:52 myserver1 postfix/postfix-script[2139]: warning: not owned by postfix: /var/lib/postfix/.
May 17 20:22:52 myserver1 postfix/postfix-script[2140]: warning: not owned by postfix: /var/lib/postfix/./prng_exch
May 17 20:22:52 myserver1 postfix/postfix-script[2141]: warning: not owned by postfix: /var/lib/postfix/./master.lock
May 17 20:22:52 myserver1 postfix/postfix-script[2154]: starting the Postfix mail system
May 17 20:22:52 myserver1 postfix/master[2155]: fatal: open lock file /var/lib/postfix/master.lock: cannot open file: Permission denied
May 17 20:44:03 myserver1 dovecot: auth: mysql: Connected to 127.0.0.1 (postfixadmin)
May 17 20:44:03 myserver1 dovecot: imap-login: Login: user=<user2@domain2.com>, method=PLAIN, rip=123.45.67.89, lip=123.45.67.89, mpid=2308, secured
May 17 20:44:03 myserver1 dovecot: imap(user2@domain2.com): Disconnected: Logged out bytes=29/405</user2@domain2.com> 

So, I had to do:

[root@ myserver1 /]# chown -R postfix /var/lib/postfix
[root@ myserver1 /]# service postfix restart
Shutting down postfix:                                     [FAILED]
Starting postfix:                                          [  OK  ]
[root@myserver1 /]# service postfix restart
Shutting down postfix:                                     [  OK  ]
Starting postfix:                                          [  OK  ]

..and everything seemed to work fine. I was able to send mails and administer email addresses via PostfixAdmin.

Why did you assign a high UID number to postfix?

What are the consequences of making postfix the owner of the files I have made postfix to own? Are there any?

Everything seems to work fine, but I would appreciate it if you took a look at my log files just to make sure everything is working fine.

Here’s the section of the /var/log/mailog

May 17 22:29:22 myserver1 postfix/postfix-script[4387]: stopping the Postfix mail system
May 17 22:29:22 myserver1 postfix/master[4171]: terminating on signal 15
May 17 22:29:22 myserver1 postfix/postfix-script[4459]: starting the Postfix mail system
May 17 22:29:22 myserver1 postfix/master[4460]: daemon started -- version 2.6.6, configuration /etc/postfix
May 17 22:29:22 myserver1 postfix/pickup[4462]: A54BE3C696: uid=48 from= <me@domain1.com>May 17 22:29:22 myserver1 postfix/cleanup[4464]: A54BE3C696: message-id= <a52f5b7579932468ddd5a1e31f6bd786@domain1.com>May 17 22:29:22 myserver1 postfix/qmgr[4463]: A54BE3C696: from=<me@domain1.com>, size=525, nrcpt=1 (queue active)
May 17 22:29:22 myserver1 postfix/pickup[4462]: A89AF3C6F2: uid=48 from= <me@domain1.com>May 17 22:29:22 myserver1 postfix/cleanup[4464]: A89AF3C6F2: message-id= <a003964cb7ddf4b443cba2f7f162e7aa@domain1.com>May 17 22:29:22 myserver1 postfix/qmgr[4463]: A89AF3C6F2: from=<me@domain1.com>, size=525, nrcpt=1 (queue active)
May 17 22:29:22 myserver1 postfix/pipe[4469]: A54BE3C696: to=<me@domain1.com>, relay=dovecot, delay=1403, delays=1403/0.01/0/0.02, dsn=2.0.0, status=sent (delivered via dovecot service)
May 17 22:29:22 myserver1 postfix/qmgr[4463]: A54BE3C696: removed
May 17 22:29:22 myserver1 postfix/pipe[4470]: A89AF3C6F2: to=<me@domain1.com>, relay=dovecot, delay=511, delays=511/0.02/0/0.02, dsn=2.0.0, status=sent (delivered via dovecot service)
May 17 22:29:22 myserver1 postfix/qmgr[4463]: A89AF3C6F2: removed
May 17 22:29:52 myserver1 dovecot: imap-login: Login: user=<me@domain1.com>, method=PLAIN, rip=123.45.67.89, lip=123.45.67.89, mpid=4475, secured
May 17 22:29:52 myserver1 dovecot: imap(me@domain1.com): Disconnected: Logged out bytes=38/390
May 17 22:29:52 myserver1 dovecot: imap-login: Login: user=<me@domain1.com>, method=PLAIN, rip=123.45.67.89, lip=123.45.67.89, mpid=4478, secured
May 17 22:29:52 myserver1 dovecot: imap(me@domain1.com): Disconnected: Logged out bytes=44/401
May 17 22:30:17 myserver1 dovecot: imap-login: Login: user=<me@domain1.com>, method=PLAIN, rip=123.45.67.89, lip=123.45.67.89, mpid=4484, secured
May 17 22:30:17 myserver1 postfix/pickup[4462]: 57EBE3C696: uid=48 from= <me@domain1.com>May 17 22:30:17 myserver1 postfix/cleanup[4464]: 57EBE3C696: message-id=<5cd70c1ee48bee43cd588f06a7bb5e0c@domain1.com>
May 17 22:30:17 myserver1 postfix/qmgr[4463]: 57EBE3C696: from=<me@domain1.com>, size=525, nrcpt=1 (queue active)
May 17 22:30:17 myserver1 postfix/pipe[4469]: 57EBE3C696: to=<me@domain1.com>, relay=dovecot, delay=0.04, delays=0.02/0/0/0.02, dsn=2.0.0, status=sent (delivered via dovecot service)
May 17 22:30:17 myserver1 postfix/qmgr[4463]: 57EBE3C696: removed
May 17 22:30:17 myserver1 dovecot: imap(me@domain1.com): Disconnected: Logged out bytes=465/511
May 17 22:30:18 myserver1 dovecot: imap-login: Login: user=<me@domain1.com>, method=PLAIN, rip=123.45.67.89, lip=123.45.67.89, mpid=4494, secured
May 17 22:30:18 myserver1 dovecot: imap(me@domain1.com): Disconnected: Logged out bytes=44/401
May 17 22:30:20 myserver1 dovecot: imap-login: Login: user=<me@domain1.com>, method=PLAIN, rip=123.45.67.89, lip=123.45.67.89, mpid=4497, secured
May 17 22:30:20 myserver1 dovecot: imap(me@domain1.com): Disconnected: Logged out bytes=267/3148
May 17 22:30:20 myserver1 dovecot: imap-login: Login: user=<me@domain1.com>, method=PLAIN, rip=123.45.67.89, lip=123.45.67.89, mpid=4500, secured
May 17 22:30:20 myserver1 dovecot: imap(me@domain1.com): Disconnected: Logged out bytes=82/469
May 17 22:31:21 myserver1 dovecot: imap-login: Login: user=<me@domain1.com>, method=PLAIN, rip=123.45.67.89, lip=123.45.67.89, mpid=4511, secured
May 17 22:31:21 myserver1 dovecot: imap(me@domain1.com): Disconnected: Logged out bytes=91/795</me@domain1.com></me@domain1.com></me@domain1.com></me@domain1.com></me@domain1.com></me@domain1.com></me@domain1.com></me@domain1.com></me@domain1.com></me@domain1.com></me@domain1.com></me@domain1.com></me@domain1.com></a003964cb7ddf4b443cba2f7f162e7aa@domain1.com></me@domain1.com></me@domain1.com></a52f5b7579932468ddd5a1e31f6bd786@domain1.com></me@domain1.com> 

Thanks a whole lot.

I was unclear, my bad. I meant those .cf files were owned by root, and chown'd to postfix, with a chmod of 640, hence -rw-r–---.

I apologize for any confusion.

Looks good so far.

Welcome to the 'joy' of admining your own mail server!

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct