I have a mail server (postfix, courier-imap, cyrus-sasl, amavisd-new, spamassasin, roundcube, squirrelmail, ...) set up many years ago following a Gentoo guide which no longer exists. The setup has worked fine.
However, in 2017 there was an upgrade of postfixadmin from 2.3.8 to 3.2.3 which I never got around to doing because I couldn't risk breaking my mail server and once the sql tables were setup with postfixadmin there really was no need anymore for PFA. If I needed to add or delete accounts, I could always use phpmyadmin to directly change the mysql tables as needed. If it ain't broke don't fix it.
But now I'd like to migrate over to the PFA-3.2.3. I just created a new mysql database and let the PFA setup create everything from scratch.
There is a new Gentoo "Complete Virtual Mail Server" guide which uses the new PFA tables: https://wiki.gentoo.org/wiki/Complete_V ... base#MySQL
Pretty straight forward changes to the "mysql-*.cf" postfix config files referencing the new table names and column names.
The guide also shows how to setup the /etc/courier/authlib/authmysqlrc file but uses the old PFA database tables and names:
https://wiki.gentoo.org/wiki/Complete_V ... authdaemon
/etc/courier/authlib/authmysqlrc:
Code: Select all
MYSQL_SERVER localhost
MYSQL_USERNAME mailsql
MYSQL_PASSWORD $password
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
Code: Select all
The new setup from MYSQL_SERVER localhost
MYSQL_USERNAME mail-courier
MYSQL_PASSWORD topsecret
MYSQL_SOCKET /var/run/mysql/mysql.sock
MYSQL_OPT 0
MYSQL_DATABASE postfix
MYSQL_USER_TABLE mailbox
MYSQL_CLEAR_PWFIELD password # if you use cleartext passwords - or -
# MYSQL_CRYPT_PWFIELD password # if you use encrypted passwords
MYSQL_UID_FIELD '20000'
MYSQL_GID_FIELD '100'
MYSQL_LOGIN_FIELD username
MYSQL_HOME_FIELD '/var/vmail/' as home
MYSQL_NAME_FIELD name
MYSQL_MAILDIR_FIELD maildir
MYSQL_QUOTA_FIELD concat(quota,'S')
MYSQL_WHERE_CLAUSE active=1
but the new PFA-3.2.3 has a table "mailbox" with fields "username" instead of "email", no selectable "uid" or "gid" fields, no "homedir" and no selectable "maildir"
old PFA mailsql fields for table "users":
id, email, clear, name, uid, gid, homedir, maildir, quota, postfix
and the new PFA mailsql fields for table "mailbox":
username, password, name, maildir, quota, local_part, domain, creative, modified, active, phone, email_other, token, token_validity
In the old setup in "/etc/postfix/main.cf" I had "virtual_mailbox_base = /"
and had absolute pathnames stored in the mailsql "users" table, eg.
email=user1@mydomain,; homedir=/home/user1; maildir=/home/user1/.maildir/
email=user2@virtualdomain; homedir=/home/vmail; maildir=/home/vmail/virtualdomain/user2
When I create users using the new PFA it creates fields similar to following for local and virtual users:
username=user1@mydomain; maildir=user1@mydomain
username=user2@virtualdomain; maildir=virtualdomain/user2
Code: Select all
joe@mydomain.com 1011 100 /home/joe /home/joe/.maildir/
jane@virtualdomain.com 5006 5022 /home/vmail /home/vmail/virtualdomain.com/jane/.maildir/
Also the new PFA scheme doesn't let you specify the path and name of the maildir folder. (I have /home/vmail/.maildir)
The various PFA docs show Maildir as the expected folder but maybe that's actually determined by the delivery agent and not postfix?
I can switch virtual_mailbox_base in /etc/postfix/main.cf easily enough to work the the new PFA:
Code: Select all
virtual_mailbox_base = /
#virtual_mailbox_base = /home/vmail
# virtual mails go to <base>/home/vmail/virtualdomain/user/.maildir/
#trailing slash needed for a maildir folder instead of a mailbox file
authenumerate shows all system users and virtual users,
so real account users with logins at /home/{user1, user2, etc}
and virtual users with no shell access at /home/vmail/{virtualdomain1/user(s), virtualdomain2/user(s)}
plus other system accounts like ftp, amavis, clamav, nginx, etc.
Maybe, regular user accounts with shell logins in /home don't need to be listed in the "mailbox" table and authlib will still automatically figure out how to authenticate
those users and where their homedirs and maildirs are located? Maybe their explicit listing in the old PFA "users" table wasn't necessary for postfix ?
I originally setup this mail server because Verizon only offered pop3 which was inconvenient for multiple people checking emails from multiple devices.
So setup courier-imap to solve the problem and used system accounts for authentication and to let users run shell processing on their maildir folders.
Later added some virtual domains when needed more emails but didn't want them to have shell accounts. So i'd like to keep both regular user accounts and virtual emails.
Thanks for any help.
