Alias Domains

From QmailToaster
Jump to navigation Jump to search
Assumes Many-Domain backend
Create alias domain Qmail & Dovecot
1) Create alias domain table and insert alias domain
  a) # mysql -u root -p vpopmail
  b) MariaDB [vpopmail]> create table aliasdomains ( domain char(96) not null, alias char(96) not null);
  c) MariaDB [vpopmail]> insert into aliasdomains (domain,alias) values ('domain.com','domain.org');
2) Change dovecot mysql password query
  password_query = SELECT CONCAT( pw_name ,'@', pw_domain ) AS user, \
    pw_passwd AS password, \
    pw_dir as userdb_home, \
    89 AS userdb_uid, \
    89 AS userdb_gid \
    FROM vpopmail vp \
    LEFT JOIN aliasdomains ad ON ad.alias = '%d' \
    WHERE  ( vp.pw_domain = ad.domain  OR vp.pw_domain = '%d') AND ( vp.pw_name = '%n' )
3) Test Dovecot:
   doveadm auth test user@domain.com 'password'
   doveadm auth test user@domain.org 'password'
4) Create domain alias for Qmail ( /var/qmail/users/assign )
  a) # /home/vpopmail/bin/vaddaliasdomain domain.com domain.org 
     # cat /var/qmail/users/assign
        +domainA.com-:domainA.com:89:89:/home/vpopmail/domains/domainA.com:-::
        +domain.com-:domain.com:89:89:/home/vpopmail/domains/domain.com:-::
        +domain.org-:domain.com:89:89:/home/vpopmail/domains/domain.com:-::