postfix 설치 완료후. 사용자 계정 생성
로빈아빠
본문
전 mysql디비에 저장해서 사용하고 있습니다.
메일 계정을 많이 많들려면 useradd로는 한계가 있을꺼 같네요
1. mysql> grant select, insert, update, delete on mail.* to 'mail_admin'@'localhost' identified by 'password';
mysql> grant select, insert, update, delete on mail.* to 'mail_admin'@'192.168.1.%' identified by 'password';
2. mysql> flush privileges;
3. * 'mail_admin'@'localhost' 은 localhost 에서 db 접근을 허용
* 'mail_admin'@'192.168.1.%' 은 192.168.1 네트워크에서 db 접근을 허용
table 생성
1. mysql> USE mail;
1. CREATE TABLE mail_domains (
domain varchar(50) NOT NULL,
PRIMARY KEY (domain) )
TYPE=MyISAM;
1. CREATE TABLE mail_forwardings (
source varchar(80) NOT NULL,
destination TEXT NOT NULL,
PRIMARY KEY (source) )
TYPE=MyISAM;
1. CREATE TABLE mail_users (
email varchar(80) NOT NULL,
password varchar(20) NOT NULL,
quota INT(10) DEFAULT '10485760',
PRIMARY KEY (email)
) TYPE=MyISAM;
vi /etc/postfix/mysql-virtual_domains.cf
가상 도메인을 지정하는 mail_domains 테이블 설정 파일이다.
user = mail_admin
password = mail_admin_password
dbname = mail
query = SELECT domain AS virtual FROM mail_domains WHERE domain='%s'
hosts = 127.0.0.1
vi /etc/postfix/mysql-virtual_mailboxes.cf
user = mail_admin
password = mail_admin_password
dbname = mail
query = SELECT CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/')
FROM mail_users_v WHERE email='%s
hosts = 127.0.0.1
vi /etc/postfix/mysql-virtual_email2email.cf
user = mail_admin
password = mail_admin_password
dbname = mail
query = SELECT email FROM mail_users_v WHERE email='%s'
hosts = 127.0.0.1
postconf -e 'virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf'
postconf -e 'virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf'
뭐 이런식입니다.
메일 계정을 많이 많들려면 useradd로는 한계가 있을꺼 같네요
1. mysql> grant select, insert, update, delete on mail.* to 'mail_admin'@'localhost' identified by 'password';
mysql> grant select, insert, update, delete on mail.* to 'mail_admin'@'192.168.1.%' identified by 'password';
2. mysql> flush privileges;
3. * 'mail_admin'@'localhost' 은 localhost 에서 db 접근을 허용
* 'mail_admin'@'192.168.1.%' 은 192.168.1 네트워크에서 db 접근을 허용
table 생성
1. mysql> USE mail;
1. CREATE TABLE mail_domains (
domain varchar(50) NOT NULL,
PRIMARY KEY (domain) )
TYPE=MyISAM;
1. CREATE TABLE mail_forwardings (
source varchar(80) NOT NULL,
destination TEXT NOT NULL,
PRIMARY KEY (source) )
TYPE=MyISAM;
1. CREATE TABLE mail_users (
email varchar(80) NOT NULL,
password varchar(20) NOT NULL,
quota INT(10) DEFAULT '10485760',
PRIMARY KEY (email)
) TYPE=MyISAM;
vi /etc/postfix/mysql-virtual_domains.cf
가상 도메인을 지정하는 mail_domains 테이블 설정 파일이다.
user = mail_admin
password = mail_admin_password
dbname = mail
query = SELECT domain AS virtual FROM mail_domains WHERE domain='%s'
hosts = 127.0.0.1
vi /etc/postfix/mysql-virtual_mailboxes.cf
user = mail_admin
password = mail_admin_password
dbname = mail
query = SELECT CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/')
FROM mail_users_v WHERE email='%s
hosts = 127.0.0.1
vi /etc/postfix/mysql-virtual_email2email.cf
user = mail_admin
password = mail_admin_password
dbname = mail
query = SELECT email FROM mail_users_v WHERE email='%s'
hosts = 127.0.0.1
postconf -e 'virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf'
postconf -e 'virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf'
뭐 이런식입니다.
관련링크
댓글목록
등록된 댓글이 없습니다.